Skip to main content
Participant
June 5, 2025
Question

Cache Invalidation Caused by Unrelated Layer Parameters

  • June 5, 2025
  • 1 reply
  • 301 views

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?

1 reply

James Whiffin
Legend
June 6, 2025

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. 

Mind5E43Author
Participant
June 8, 2025

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.

James Whiffin
Legend
June 8, 2025

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.