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

Help Creating a NULL in SDK

Engaged ,
May 10, 2024 May 10, 2024

Hi gang;

 

So I need to create a Null layer from within my plugin, and link a point parameter to it. I've never done this before but my understanding is that it needs to be done via Javascript. I thought I had the creation part done but it crashes upon execution. This is what I have:

 

 

AEGP_SuiteHandler suites(in_data->pica_basicP);
A_Boolean outAvailablePB;
AEGP_MemHandle outResultPH;
AEGP_MemHandle outErrorStringPH;

const char* javascriptCode =
"var comp = app.project.activeItem;\r\n"
"comp.layers.addNull();\r\n";

ERR(suites.UtilitySuite4()->AEGP_IsScriptingAvailable(&outAvailablePB));
ERR(suites.UtilitySuite4()->AEGP_ExecuteScript(NULL, javascriptCode, true, &outResultPH, &outErrorStringPH));
A_char* result = NULL;
ERR(suites.MemorySuite1()->AEGP_LockMemHandle(outResultPH, reinterpret_cast<void**>(&result)));
ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(outResultPH));
ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(outErrorStringPH));

 

Any suggestions as to what is wrong here?

 

I haven't done the linking part but I have a question about that too. Is that a separate javascript command that must be sent after creating the Null or can it be combined together with the Null creation?

 

Thanks in advance.

 

Richard

TOPICS
SDK
167
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 ,
May 11, 2024 May 11, 2024
LATEST

1. on what line does your code crash?

2. not that i think it's the problem, but you're not checking the state of outAvailablePB before conditionally calling the script.
3. you're not checking if outResultPH is non null before locking it.

4. you can use AEGP_CreateNullInComp instead of javascript, if you'd like...

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