Skip to main content
Known Participant
May 8, 2021
Question

AEGP_GetProjectByIndex() AEGP_ProjectH always NULL

  • May 8, 2021
  • 1 reply
  • 589 views

Hi guys, I'm new to After Effects SDK develop. I try to edit project "Panelator" in sdk folder.

In my codes, I want to create an folder in After Effects.

I can get "index = 0" with  `AEGP_GetNumProjects`, but "projH" always be `NULL`

I cannot find any solution now = =

 

PanelatorUI_Plat::PanelatorUI_Plat(SPBasicSuite* spbP, AEGP_PanelH panelH,
	AEGP_PlatformViewRef platformWindowRef,
	AEGP_PanelFunctions1* outFunctionTable)
	: PanelatorUI(spbP, panelH, platformWindowRef, outFunctionTable),
	i_prevWindowProc(NULL)
{
	S_sp_basic_suiteP = spbP;
        …… OTHER CODE ……
}


void PanelatorUI_Plat::CreateNormalFolder() {
	A_Err	err		= A_Err_NONE;
	AEGP_ProjectH	projH	= NULL;
	A_long		index	= -100;

	AEGP_SuiteHandler	suites(S_sp_basic_suiteP);
	ERR(suites.ProjSuite5()->AEGP_GetNumProjects(&index));
	ERR(suites.ProjSuite5()->AEGP_GetProjectByIndex(0, &projH));  // &projH returns NULL...
	
	A_UTF16Char folder_name[256] = {'a', 'b'};
	ERR(suites.ItemSuite9()->AEGP_CreateNewFolder(folder_name, NULL, NULL));
}

 

 

Thanks for any discussion.

This topic has been closed for replies.

1 reply

Community Expert
May 8, 2021

strange. it works fine for me.

perhaps you're calling CreateNormalFolder() at an abnormal time? (such as when the AEGP loads before AE fully launches...)

if you get tired of fingding the cause to this strange issue, you can always create the folder via javascript using AEGP_ExecuteScript(). it doesn't require an external script file if that matters to you. the operation of creating a folder is rare enough for the javascript overhead to not matter.

Crown丶Author
Known Participant
May 10, 2021

Good idea! Thanks~

 

It's also a strange issue for me, I tried to use another project "Projector", it's the same code as mine, but Projector works.

Thanks for your advice, and I will try my best find some other solutions later.