Copy link to clipboard
Copied
I'm developing an ARB (After Effects custom parameter) that manages multiple layers.
Within the ARB, I store `AEGP_LayerID`s and use `AEGP_GetLayerFromLayerID` to retrieve `LayerH` handles. Then, I obtain frame data using the render suite. However, when the layer associated with a given ID changes (for example, a shape layer's path is modified), the cache is not invalidated the previously cached result is still used. This happens even though the visual content of the layer has clearly changed.
Since these layers are not referenced through effect parameters, After Effects doesn't automatically detect the dependency.
Is there a reliable way to detect changes in such unreferenced layers in order to manually invalidate the cache? Or is there a better or more robust alternative approach to ensure the cached results remain accurate?
Copy link to clipboard
Copied
In pre_render, can you store the data obtained from those layerH's inside the mix_guid_ptr? Then if any of it changes you will get another smart_render call.
Copy link to clipboard
Copied
AEGP_WorldH textureLayerWorldH = NULL;
ERR(suites.RenderSuite5()->AEGP_GetReceiptWorld(layerFrameReceiptH, &textureLayerWorldH));
if (textureLayerWorldH) {
PF_EffectWorld textures;
ERR(suites.WorldSuite3()->AEGP_FillOutPFEffectWorld(textureLayerWorldH, &textures));
}
I use PF_EffectWorld from layerH during the SmartRender phase. As far as I understand, this is only possible during SmartRender, and it's not possible to obtain PF_EffectWorld during the PreRender phase. Am I mistaken?
In this case, it is impossible to mix_guid_ptr the data you do not get, so the method seems impossible.
Copy link to clipboard
Copied
I was thinking mixing the layer2world matrix of the layerH, but it's not foolproof because the transform may not change but the pixels might. I think the only sure way would then be to have each tracked layer as layer params.
Copy link to clipboard
Copied
Thanks for thinking this through with me. I’ve reached a similar conclusion myself and am currently working with a temporary solution that resets the cache every frame, even though it's inefficient. I hope someone comes up with a more groundbreaking idea
Find more inspiration, events, and resources on the new Adobe Community
Explore Now