The render does not update when the timeline time changes
Hi!
I can't figure out why when using SmartRender() my render doesn't update when I adjust the slider on the timeline. The value in this line
does change but the render itself doesn't update. When I use the deprecated Render() everything works fine. How can I ensure that the render is updated when the timeline time changes?
This code is supposed to shift the image to the right as the timeline time changes. It works with video, but not with images. Perhaps I need to set the correct flag?
out_data->out_flags = PF_OutFlag_DEEP_COLOR_AWARE |
PF_OutFlag_SEND_UPDATE_PARAMS_UI |
PF_OutFlag_WIDE_TIME_INPUT;
out_data->out_flags2 = PF_OutFlag2_FLOAT_COLOR_AWARE |
PF_OutFlag2_SUPPORTS_SMART_RENDER |
PF_OutFlag2_DOESNT_NEED_EMPTY_PIXELS |
PF_OutFlag2_AUTOMATIC_WIDE_TIME_INPUT |
PF_OutFlag2_SUPPORTS_THREADED_RENDERING;
static PF_Err
SmartRender(
PF_InData* in_data,
PF_OutData* out_data,
PF_ParamDef* params[],
PF_SmartRenderExtra* extraP)
{
PF_Err err = PF_Err_NONE;
PF_EffectWorld* inputP = nullptr;
PF_EffectWorld* outputP = nullptr;
AEGP_SuiteHandler suites(in_data->pica_basicP);
if (!suites.HandleSuite1()->host_lock_handle(
reinterpret_cast<PF_Handle>(extraP->input->pre_render_data)))
{
return PF_Err_INTERNAL_STRUCT_DAMAGED;
}
err = extraP->cb->checkout_layer_pixels(in_data->effect_ref, INPUT, &inputP);
if (err) {return err;}
err = extraP->cb->checkout_output(in_data->effect_ref, &outputP);
if (err || !outputP) { return err;}
// In this line the time is not updated if you use a picture. With video everything works
A_long shift = in_data->current_time / in_data->time_step;
PF_Rect src_rect = { -shift, 0, outputP->width - shift, outputP->height };
PF_Rect dest_rect = { 0, 0, outputP->width, outputP->height };
err = PF_COPY(inputP, outputP, &src_rect, &dest_rect);
ERR(extraP->cb->checkin_layer_pixels(in_data->effect_ref, INPUT));
suites.HandleSuite1()->host_unlock_handle(
reinterpret_cast<PF_Handle>(extraP->input->pre_render_data));
return err;
}
