Checkout Other Frames Using Pre-Render
Hi gang;
I would love some guidance here.
As we know, there are two ways to check out a layer. One is the old-fashioned way like so:
AEFX_CLR_STRUCT(checkoutLayer);
ERR(PF_CHECKOUT_PARAM(in_data,
SKELETON_CHECKOUTLAYER,
in_data->current_time,
in_data->time_step,
in_data->time_scale,
&checkoutColorLayer));
ERR(PF_CHECKIN_PARAM(in_data, &checkoutLayer));The other, is the method used for SmartRender plugins where you check them out in PreRender like so:
ERR(extraP->cb->checkout_layer(in_dataP->effect_ref,
SKELETON_CHECKOUTLAYER,
SKELETON_CHECKOUTLAYER,
&req,
in_dataP->current_time,
in_dataP->time_step,
in_dataP->time_scale,
&in_result));
UnionLRect(&in_result.result_rect, &extraP->output->result_rect);
UnionLRect(&in_result.max_result_rect, &extraP->output->max_result_rect);
And then when we are ready to use it in SmartRender, we call it like this:
ERR(extraP->cb->checkout_layer_pixels(in_data->effect_ref, SKELETON_CHECKOUTLAYER, &checkoutLayer));
// And once finished:
ERR2(extraP->cb->checkin_layer_pixels(in_data->effect_ref, SKELETON_CHECKOUTLAYER));
Now, with the old fashioned method, it was easy to seek through the time during rendertime and grab whichever frame we wanted.
With the SmartRender method, it's trickier because we need to get those frames beforehand in the PreRender function and store them in checkout_idl.
This thread kind of discusses it but I still need clarification as my attempts haven't worked: https://community.adobe.com/t5/after-effects-discussions/checkout-previous-frame-in-smart-render/m-p/10943196#M104699
Here are my questions. Let's say I want to checkout a layer over 100 frames. Let's say 0-100:
1 - In the header file, under ENUMS, if my ENUM is called SKELETON_CHECKOUTLAYER, do I need 100 of these or just one? I assume 1 because I don't want 100 checkout layer parameters. And we will modify the ID anyway, not the index, right?
2 - In the ParamsSetup, similarly, we only want 1 instance of it.
3 - In Pre-Render, we would have something like the following:
for (int i = 0; i < 100; i++)
{
ERR(extraP->cb->checkout_layer(in_dataP->effect_ref,
SKELETON_CHECKOUTLAYER,
SKELETON_CHECKOUTLAYER+i,
&req,
i * in_dataP->time_step,
in_dataP->time_step,
in_dataP->time_scale,
&checkoutColorLayer));
UnionLRect(&checkoutLayer.result_rect, &extraP->output->result_rect);
UnionLRect(&checkoutLayer.max_result_rect, &extraP->output->max_result_rect);
}This should store the checkout layer at time 0 through to 100. I do not increase the parameter index because we don't want 100 parameter checkouts. Then in SmartRender, I can call that particular time like so (where timeindex is the time of the checked out layer):
ERR(extraP->cb->checkout_layer_pixels(in_data->effect_ref, SKELETON_CHECKOUTLAYER + timeindex, &checkoutColorLayer));
// And upon finishing:
ERR2(extraP->cb->checkin_layer_pixels(in_data->effect_ref, SKELETON_CHECKOUTLAYER + timeindex));
However, this is incorrect. I get a crash and an error: "Node received more checkout requests than expected."
Any suggestions on what I'm doing wrong here?
Thanks,
-Richard
