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

Example of AEGP_GetNewText()?

New Here ,
Mar 23, 2007 Mar 23, 2007

Copy link to clipboard

Copied

Can anyone post up an example of AEGP_GetNewText.

I am basically here (everything executes properly I am just adding some snippets to frame the context):

AEGP_StreamValue val;
AEGP_StreamRefH text_streamH = NULL;
A_Time timeT = {0,1};

suites.StreamSuite2()->AEGP_GetNewLayerStream(
S_my_id,
layerH, AEGP_LayerStream_SOURCE_TEXT,
&text_streamH);

suites.LayerSuite5()->AEGP_GetLayerCurrentTime(layerH, AEGP_LTimeMode_LayerTime, &timeT);

suites.StreamSuite2()->AEGP_GetNewStreamValue(
S_my_id,
text_streamH,
AEGP_LTimeMode_LayerTime,
&timeT,
TRUE,
&val);

So that is where I sit. Now when I do this:
AEGP_MemHandle textMemory;
suites.TextDocumentSuite1()->AEGP_GetNewText(S_my_id, val.val.text_documentH, &textMemory);

I get the following Error from After Effects when I run the plugin:
After Effects error: internal verification failure, sorry! {Must clear unicodePH}
(5027 :: 0)

So clearly I am doing something wrong here.. Any Pointers?
TOPICS
SDK

Views

3.5K

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 ,
Mar 23, 2007 Mar 23, 2007

Copy link to clipboard

Copied

Looking in AE_GeneralPlug.h on line: 1649 it says:
"handle of A_u_short, must be disposed with AEGP_FreeMemHandle"

So I figured, ok, I will make an A_u_short, and pass it into the argument as reference. Then throws an error on compile:
Invalid conversion from 'A_u_short to '_Up_OpaqueMem**'

Which makes sense since the signature of the method says it wants an AEGP_MemHandle. But I figured it was worth a shot.

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 ,
Mar 30, 2007 Mar 30, 2007

Copy link to clipboard

Copied

Can anyone tell me how I go about clearing something?

I have tried delete and AEFX_CLR_STRUCT but no matter what i do I get an error:

Must clear unicodePH

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 ,
Mar 30, 2007 Mar 30, 2007

Copy link to clipboard

Copied

Here is where I am at so far:

AEGP_StreamVal stream_valP;
AEGP_StreamType stream_type = AEGP_StreamType_TEXT_DOCUMENT;
AEGP_MemHandle unicodePH = NULL;
A_u_short *stringValue = NULL;

AEFX_CLR_STRUCT(stream_valP);

ERR(suites.StreamSuite2()->AEGP_GetLayerStreamValue(layerH,
AEGP_LayerStream_SOURCE_TEXT,
AEGP_LTimeMode_LayerTime,
&timeT,
TRUE,
&stream_valP,
&stream_type));


ERR(suites.MemorySuite1()->AEGP_NewMemHandle( S_my_id,
"Text Title Data",
sizeof(A_u_short),
AEGP_MemFlag_CLEAR,
&unicodePH));

ERR(suites.TextDocumentSuite1()->AEGP_GetNewText(S_my_id, stream_valP.text_documentH, &unicodePH));

ERR(suites.MemorySuite1()->AEGP_LockMemHandle(unicodePH, (void **)&stringValue));

ERR(suites.MemorySuite1()->AEGP_UnlockMemHandle(unicodePH));
ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(unicodePH));

I know I am not doing anything with it... I am just trying NOT to get a Must clear unicodePH Error anymore and I will go from there...

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 ,
Mar 30, 2007 Mar 30, 2007

Copy link to clipboard

Copied

After Effects error: internal verification failure, sorry! {Must clear unicodePH}

( 5027 :: 0 )

^ that is the full error
That windows pops up 3 times in After Effects (7)

if I comment out this line:
ERR(suites.TextDocumentSuite1()->AEGP_GetNewText(S_my_id, stream_valP.text_documentH, &unicodePH));

I don't get that error window

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
Adobe Employee ,
Apr 02, 2007 Apr 02, 2007

Copy link to clipboard

Copied

First, congratulations on trying so many things on your own; nice work!

Second, any time the function name contains 'new', AE will allocate the handle to hold the text for you.

Try this (works here).

AEGP_MemHandle my_cool_textH = NULL;

ERR(suites.TextDocumentSuite1()->AEGP_GetNewText(S_my_id, stream_valP.text_documentH, &my_cool_textH));

There's your unicode string.

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 Beginner ,
Aug 27, 2014 Aug 27, 2014

Copy link to clipboard

Copied

I have the following code, and it fails all the time:

    AEGP_StreamVal2 stream_valP;

    AEFX_CLR_STRUCT(stream_valP);

    A_Time inPoint = {0,0}, layerDuration = {0,0};

    ERR( suites.LayerSuite7()->AEGP_GetLayerInPoint(layerH, AEGP_LTimeMode_CompTime, &inPoint) );

    ERR( suites.LayerSuite7()->AEGP_GetLayerDuration(layerH, AEGP_LTimeMode_CompTime, &layerDuration) );

    AEGP_CompH comp = NULL;

    ERR( suites.LayerSuite7()->AEGP_GetLayerParentComp(layerH, &comp) );

    A_FpLong fps = 0.0;

    ERR( suites.CompSuite8()->AEGP_GetCompFramerate(comp, &fps) );

    A_u_long interval = static_cast< A_u_long >(static_cast< A_FpLong >(layerDuration.scale) / fps);

    for (A_Time timeT = inPoint; stream_valP.text_documentH == NULL || *stream_valP.text_documentH == NULL || inPoint.value * layerDuration.scale == layerDuration.value * inPoint.scale; timeT.value += interval) {

        AEGP_StreamType stream_type = AEGP_StreamType_TEXT_DOCUMENT;

        AEGP_MemHandle unicodePH = NULL;

        A_u_short *stringValue = NULL;

        AEFX_CLR_STRUCT(stream_valP);

        ERR(suites.StreamSuite4()->AEGP_GetLayerStreamValue(layerH,

            AEGP_LayerStream_SOURCE_TEXT,

            AEGP_LTimeMode_CompTime,

            &timeT,

            TRUE,

            &stream_valP,

            &stream_type));

    };

    if (stream_valP.text_documentH != NULL && *stream_valP.text_documentH != NULL) {

        AEGP_MemHandle my_cool_textH = NULL;

        ERR(suites.TextDocumentSuite1()->AEGP_GetNewText(pluginId, stream_valP.text_documentH, &my_cool_textH));

        wchar_t *ch = NULL;

        ERR(suites.MemorySuite1()->AEGP_LockMemHandle(my_cool_textH, (void **)&ch));

        std::wstring tmp = ch;

        ERR(suites.MemorySuite1()->AEGP_UnlockMemHandle(my_cool_textH));

        ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(my_cool_textH));

    }


Edit:

I get: Unhandled exception at 0x00000000060C6342 (U.dll) in AfterFX.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF, and that happens on the line:

ERR(suites.TextDocumentSuite1()->AEGP_GetNewText(pluginId, stream_valP.text_documentH, &my_cool_textH));

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 ,
Feb 19, 2022 Feb 19, 2022

Copy link to clipboard

Copied

LATEST

wchar_t* res16B;

ERR(suites.TextDocumentSuite1()->AEGP_GetNewText(S_my_id, val.val.text_documentH, &memH));

ERR(suites.MemorySuite1()->AEGP_LockMemHandle( memH, reinterpret_cast<void**>(&res16B)));

....

ERR(suites.MemorySuite1()->AEGP_UnlockMemHandle(memH));

ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(memH));

Found here, 

Solved: Convert A_UTF16Char to Standard String - Adobe Support Community - 10539987

 

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