baku89 / ISF4AE

After Effects Plug-in enabling to use GLSL written in ISF as an effect
MIT License
233 stars 17 forks source link

Set an expression 'thisLayer.time' as a default value for Time property #4

Open baku89 opened 2 years ago

baku89 commented 2 years ago

As discarding the 'Use Layer Time' checkbox, it'd be useful if the remaining 'Time' slider automatically refers the layer time that the effect is applied.

Since PF_AD_PARAM only supports non-expression values as a default, I tried to use AEGP suites to modify a parameter like the below code at the timing PF_Cmd_SEQUENCE_SETUP has called:

// Set the default expression to parameters
AEGP_EffectRefH effectH = NULL;
AEGP_StreamRefH streamH = NULL;

ERR(suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(G_my_plugin_id, in_data->effect_ref, &effectH));
ERR(suites.StreamSuite5()->AEGP_GetNewEffectStreamByIndex(G_my_plugin_id, effectH, FILTER_TIME_ID, &streamH));
ERR(suites.StreamSuite2()->AEGP_SetExpressionState(G_my_plugin_id, streamH, true));
ERR(suites.StreamSuite2()->AEGP_SetExpression(G_my_plugin_id, streamH, "thisLayer.time"));

if (effectH) ERR(suites.EffectSuite3()->AEGP_DisposeEffect(effectH));
if (streamH) ERR(suites.StreamSuite2()->AEGP_DisposeStream(streamH));    

But it raises an error, which says ”internal verification failure, sorry! {child not found in parent} (20::0)”. Does any guru know how to handle this?