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

I'm new to the AE SDK and want to know how to get the name of the selected layer. Thank you very muc

New Here ,
Jun 10, 2024 Jun 10, 2024

Hi, I'm just getting started with the AE SDK and learning how to make plugins, but the first problem I'm having is how to get the name of the selected layer in the AE project. I've tried. A lot of things. It's all wrong. Can help write a simple code, I refer to. Is that OK? Thank you very much. I am currently using the 2020 version of SDK

TOPICS
Error or problem , FAQ , Scripting , SDK
773
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

correct answers 1 Correct answer

Community Expert , Jun 13, 2024 Jun 13, 2024

you traverse the collection using AEGP_GetCollectionItemByIndex(). for each such call, you get a AEGP_CollectionItemV2 for that collection item. this is that structure:

typedef struct {
AEGP_CollectionItemType type;
// the union is not used for AEGP_CollectionItemType_STREAMREF
union {
AEGP_LayerCollectionItem layer;
AEGP_MaskCollectionItem mask;
AEGP_EffectCollectionItem effect;
AEGP_StreamCollectionItem stream;
AEGP_MaskVertexCollectionItem mask_vertex;
AEGP_KeyframeCollectionItem keyframe;
} u;


AEGP_St

...
Translate
Community Expert ,
Jun 11, 2024 Jun 11, 2024

start off with AEGP_GetNewCollectionFromCompSelection(). then traverse the collection using AEGP_GetCollectionNumItems() and AEGP_GetCollectionItemByIndex().

now that you've got the currently selected layer (there may be more than one selected...), use AEGP_GetLayerName().

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
New Here ,
Jun 13, 2024 Jun 13, 2024

Hello, thank you very much for your answer, but I have a question. I used the function AEGP_GetCollectionItemByIndex to obtain the parameter AEGP_CollectionItem. Then I use AEGP_GetLayerName to get the name of the layer, but I find that AEGP_GetLayerName needs to be passed in AEGP_LayerH. So how can AEGP_LayerH be obtained? Thank you very much for your reply

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 ,
Jun 13, 2024 Jun 13, 2024

you traverse the collection using AEGP_GetCollectionItemByIndex(). for each such call, you get a AEGP_CollectionItemV2 for that collection item. this is that structure:

typedef struct {
AEGP_CollectionItemType type;
// the union is not used for AEGP_CollectionItemType_STREAMREF
union {
AEGP_LayerCollectionItem layer;
AEGP_MaskCollectionItem mask;
AEGP_EffectCollectionItem effect;
AEGP_StreamCollectionItem stream;
AEGP_MaskVertexCollectionItem mask_vertex;
AEGP_KeyframeCollectionItem keyframe;
} u;


AEGP_StreamRefH stream_refH; // valid for all types
} AEGP_CollectionItemV2;

 

you can tell what that item is by the value of the "type" var. if it's a layer type, the value in the "layer" var will be a valid AEGP_LayerH.

 

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
New Here ,
Jun 14, 2024 Jun 14, 2024

问题解决了,非常感谢您的回答

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
New Here ,
Jun 14, 2024 Jun 14, 2024
LATEST

Problem solved, thank you very much for your answer

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