Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Get AEGP_LayerH from AEGP_EffectRefH

Explorer ,
May 19, 2025 May 19, 2025

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.

TOPICS
SDK
274
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 19, 2025 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 20, 2025 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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 20, 2025 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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 20, 2025 May 20, 2025

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 20, 2025 May 20, 2025

oh! another idea! maybe use AEGP_GetStreamIndexInParent with the layer stream, and then use  AEGP_GetCompLayerByIndex.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
May 20, 2025 May 20, 2025

First of all, thanks for helping out.

AEGP_GetStreamIndexInParent  only works for streams of type AEGP_StreamGroupingType_INDEXED_GROUP, and layer streams are AEGP_StreamGroupingType_NAMED_GROUP.

 

It would be perfect if I could get the layer from the effect, but I think I have to go with a different approach, even if I have to look through the whole tree. I would rather avoid this since I'm calling it in the idle hook...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 24, 2025 May 24, 2025
LATEST

it sounds stupid... but perhaps querying in javascript using AEGP_ExecuteSctip will return an answer faster...
(if performece has become an actual issue, you might want to check this route)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines