How can I use the AEGP_GetLayerFlags with a layer from the layer param? I looked in the Artie example plugin and it seems like a very convoluted process. I feel like I need to learn more about the AE SDK. It's going over my head.
Could you run me through how to use this function with a layer parameter? What steps are necessary and why is each step necessary?
so the end game is to get the layer flags.
to get that, we need a layer handle (AEGP_LayerH).
but the layer param doesn't hold a layerH, it holds a layer ID,
so we need to get the layerH using the layerID.
for that we need the comp handle (compH).
because the layer id resides in a certain comp, so we need to reference it.
to get the compH, we need our own layer.
because an effect can't tell in which comp it's at, but it can tell on which layer it's at, and a layer can tell which comp it's at.
//getting the layer our effect is on.
ERR(suites.PFInterfaceSuite1()->AEGP_GetEffectLayer(in_data->effect_re f, &selfLayerH));
//now we can get the comp we're at.
//now let's look for our target layer
//we start by getting our effect's own effectH
ERR(suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(NULL, in_data->effect_ref, &effectH));
//so now we can find the streamRef for the layer param
ERR(suites.StreamSuite2()->AEGP_GetNewEffectStreamByIndex(NULL, effectH, MY_LAYER_PARAM, &streamH));
//we're getting there...
//we can now get the value of the layer param
ERR(suites.StreamSuite2()->AEGP_GetNewStreamValue(NULL, streamH, AEGP_LTimeMode_LayerTime, &timeT, FALSE, &valueP));
//converting the layer ID gotten from the value of the layer param, to a layerH.
ERR(suites.LayerSuite5()->AEGP_GetLayerFromLayerID(compH, valueP.val.layer_id, &targetLayerH));
//and finally, getting the target layer's flags!
now dispose of everything you worked so hard to get!