• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
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

Copy link to clipboard

Copied

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

Views

433

Translate

Translate

Report

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

...

Votes

Translate

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

Copy link to clipboard

Copied

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().

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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.

 

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

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

Copy link to clipboard

Copied

LATEST

Problem solved, thank you very much for your answer

Votes

Translate

Translate

Report

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