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

About getting key frame values

New Here ,
Jul 04, 2024 Jul 04, 2024

Copy link to clipboard

Copied

Hello, I would like to ask a question, that is, in the development of AE SDK plug-in, how to get the value of the key frame selected by the mouse. I checked the SDK documentation and AEGP_GetNewStreamValue () seemed to work, but when I ran it, it showed no current constext. I don't know what the problem is. Or is there a similar case? Let me learn from it. Thank you very much

TOPICS
Crash , Error or problem , Scripting , SDK

Views

284

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 ,
Jul 05, 2024 Jul 05, 2024

Copy link to clipboard

Copied

there are two steps here.

1. tell which keyframe is selected. for that, look into "collections". these are arrays of selected items.

2. get the keyframe value. for that, use AEGP_GetNewKeyframeValue().

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 ,
Jul 07, 2024 Jul 07, 2024

Copy link to clipboard

Copied

Hello, just a few minutes of your time. Is that what it says? After I wrote it this way, when I run AEGP_GetNewKeyframeValue inside AE it says: no current context. the Description Failed to obtain the key frame value is then displayed. Here is the code I wrote, I don't know whether it is correct or not. Could you take a look for me, please? Thank you very much.

 

A_Err PanelatorUI_Plat::GetKeyframe() {
A_Err err = A_Err_NONE;
AEGP_CompH compH = NULL;
AEGP_ItemH activeItemH = NULL;
AEGP_SuiteHandler i_sp = sP;
AEGP_Collection2H collectionPH = NULL;
A_u_long num_itemsPL = 0;

if (plugin_id == 0) {
MessageBox(NULL, "Plugin ID is not initialized", "Error", MB_OK);
return A_Err_GENERIC;
}

if (i_sp.ItemSuite1() == NULL) {
return A_Err_GENERIC;
}

err = i_sp.ItemSuite1()->AEGP_GetActiveItem(&activeItemH);

if (err == A_Err_NONE && activeItemH != NULL) {
AEGP_ItemType itemType;
err = i_sp.ItemSuite1()->AEGP_GetItemType(activeItemH, &itemType);
if (err != A_Err_NONE) {
return err;
}

if (err == A_Err_NONE && itemType == AEGP_ItemType_COMP) {
err = i_sp.CompSuite9()->AEGP_GetCompFromItem(activeItemH, &compH);
if (err != A_Err_NONE) {
return err;
}
}
else {
return A_Err_GENERIC;
}
}
else {
return A_Err_GENERIC;
}

if (err == A_Err_NONE && compH != NULL) {
err = i_sp.CompSuite10()->AEGP_GetNewCollectionFromCompSelection(NULL, compH, &collectionPH);
if (err != A_Err_NONE) {
return err;
}

if (err == A_Err_NONE) {
err = i_sp.CollectionSuite2()->AEGP_GetCollectionNumItems(collectionPH, &num_itemsPL);
if (err != A_Err_NONE) {
return err;
}
}

if (err == A_Err_NONE) {
for (A_u_long i = 0; i < num_itemsPL && err == A_Err_NONE; ++i) {
AEGP_LayerH layerH = NULL;
AEGP_CollectionItemV2 collection_itemP;

err = i_sp.CollectionSuite2()->AEGP_GetCollectionItemByIndex(collectionPH, i, &collection_itemP);
if (err != A_Err_NONE) {
break;
}

if (err == A_Err_NONE && collection_itemP.type == AEGP_CollectionItemType_LAYER) {
AEGP_LayerCollectionItem layerCollectionItem = collection_itemP.u.layer;
layerH = layerCollectionItem.layerH;

if (layerH != NULL) {
AEGP_StreamRefH streamH = nullptr;

err = i_sp.StreamSuite4()->AEGP_GetNewLayerStream(NULL, layerH, AEGP_LayerStream_POSITION, &streamH);

A_long keyframe_count = 0;
err = i_sp.KeyframeSuite3()->AEGP_GetStreamNumKFs(streamH, &keyframe_count);

A_short num_dimensions = 0;
err = i_sp.KeyframeSuite3()->AEGP_GetStreamTemporalDimensionality(streamH, &num_dimensions);

AEGP_StreamType stream_type;
err = i_sp.StreamSuite5()->AEGP_GetStreamType(streamH, &stream_type);
if (err == A_Err_NONE && stream_type == AEGP_LayerStream_POSITION) {
for (A_long j = 0; j < keyframe_count; ++j) {
A_Time keyframe_time = { 0, 1 };

err = i_sp.KeyframeSuite3()->AEGP_GetKeyframeTime(streamH, j, AEGP_LTimeMode_LayerTime, &keyframe_time);

AEGP_StreamValue value;
AEFX_CLR_STRUCT(value);
err = i_sp.KeyframeSuite3()->AEGP_GetNewKeyframeValue(plugin_id, streamH, j, &value);

if (err != A_Err_NONE) {
MessageBox(NULL, "Description Failed to obtain the key frame value", "Info", MB_OK);
return err;
}

ERR(i_sp.StreamSuite2()->AEGP_DisposeStreamValue(&value));
}
}
ERR(i_sp.StreamSuite4()->AEGP_DisposeStream(streamH));
}
}
}
}
}
return err;
}

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 ,
Jul 07, 2024 Jul 07, 2024

Copy link to clipboard

Copied

it's hard to tell because the error codes are not check in the few calls before AEGP_GetNewKeyframeValue. please run through the debugger and watch step by step if an err is gotten somewhere. it's most likely you're arriving at AEGP_GetNewKeyframeValue with a bad StreamRef.

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

Copy link to clipboard

Copied

Hi, excuse me. Parameters in AEGP_GetNewKeyframeValue are OK. I just pressed F11 to start debugging. err then returns error code 3. And in AE: internal verification failure, sorry! {no current context}. And in Visual Studio: TDB.pdb is not loaded. TDB.pdb contains debugging information needed to find the source file for the module TDB.dll.

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

Copy link to clipboard

Copied

LATEST

i don't understand. is it debugging correctly or is it not? can you set breakpoints and hit them?

if you're debugging successfully, on what line do you get err code 3? are you positive the err is not gotten on a previous line?

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