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
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
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().
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
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.
Copy link to clipboard
Copied
问题解决了,非常感谢您的回答
Copy link to clipboard
Copied
Problem solved, thank you very much for your answer