Skip to main content
Inspiring
May 19, 2025
Question

Get AEGP_LayerH from AEGP_EffectRefH

  • May 19, 2025
  • 1 reply
  • 617 views

Is is possible to get the AEGP_LayerH if I only have the AEGP_EffectRefH? I have some complicated way of getting the effect reference I need, and I want to go back up to the comp. I can get the comp from the layer using AEGP_GetLayerParentComp, but I'm missing the first step.

1 reply

Braniac
May 19, 2025

well, if the effect is question is the currently called effect, you can use AEGP_GetEffectLayer directly to get the current effect's layer.

otherwise, i'd ask how did you obatin the AEGP_EffectRefH in the first place? surely somewhere along the line a LayerH was involved, no?

octaviosaAuthor
Inspiring
May 20, 2025

I'm doing this in the IdleHook, I don't have access to the current effect because it might not be any current effect. I use 2 methods for getting the effect I want. I either use the CollectionSuite to get the selected effect, or in case there's no effect selected, I use the current layer to get the active comp and then look for all the effects in all the layers to get the one I want (I'm using an identifyer stored in the effect).

 

So in summary, I either want the selected effect or a specific one that I only know the UUID. I have a function for this that will return an AEGP_EffectRefH. But now I want to know the layer so I can compare it's ID to the one I have stored. I could also get the active comp and run the whole tree again, but I feel like there should be a way to get the parent layer of an effect. The feature is there for the current effect, why not for an AEGP_EffectRefH?

octaviosaAuthor
Inspiring
May 20, 2025

i see. ok, here's a theory for a solution:

1. get the stream ref for the first param using AEGP_GetNewEffectStreamByIndex.
2. get the effects stream ref (yes, a stream fer for the effect) using AEGP_GetNewParentStreamRef on the first stream ref. (you can use that stream ref to change the effect's name, or tell it's index on the layer using AEGP_GetStreamIndexInParent, b.t.w).

and now for the theorecital part that i didn't check yet:
3. keep using AEGP_GetNewParentStreamRef and work your way up to the layer stream. deduce if the gotten stream is a layer using AEGP_GetStreamGroupingType and AEGP_GetMatchName.
4. now that you have the stream ref of the layer, PERHAPS you could get it's layeH using AEGP_GetNewStreamValue.


That's exactly what I tried, I got into a stream with the MatchName "ADBE AV Layer", which I assumed was the stream for the layer I wanted. However, there's no way to get the AEGP_LayerH from the stream. I tried the AEGP_GetNewStreamValue you suggested, but AE says there's no data there.