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

Using Thread in a Plugin

Explorer ,
Jan 08, 2016 Jan 08, 2016

Hello, and best wishes for 2016.

I have an issue with a thread process in a plugin.

Before calling a thread task,

functions like :

           ERR(suites.LayerSuite8()->AEGP_GetActiveLayer(&current_layerH));

            ERR(suites.ProjSuite6()->AEGP_GetProjectByIndex(0, &projH));

            ERR(suites.ProjSuite6()->AEGP_GetProjectRootFolder(projH, &root_itemH));

            err = suites.CompSuite10()->AEGP_CreateComp( startedParentFolder,

                                                       u16str,

                                                       700,

                                                       900,

                                                       &comp_parRt,

                                                       &durationT,

                                                       &fps,

                                                       &new_compH);

are working.

But after calling a basic function using thread,  like

static void myFunc(){

    for(int i = 0; i<100; i++){

        cout << i << endl;

        //std::cout << "I " << i << "  " << std::this_thread::get_id() << std::endl;

    }

}

             std::thread t(myFunc);

             t.join();

             ERR(suites.LayerSuite8()->AEGP_GetActiveLayer(&current_layerH));  ===> works

but

            ERR(suites.ProjSuite6()->AEGP_GetProjectByIndex(0, &projH));  ==== >doesn't. projH return NULL

My question is how can I use (If it is possible) threads in a plugin, and manipulate AE UI (Plugin Effect panel, TimeLine ...)

I have to say that my main thread id is the same before and after my process.

Cheers Jim

TOPICS
SDK
700
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

correct answers 1 Correct answer

Community Expert , Jan 08, 2016 Jan 08, 2016

i don't know what you're doing wrong, but launching and joining threads is

entirely possible.

ae does behave weirdly if you use it's calls from any other thread (with

very few exceptions). you say the thread id is the same, so i don't know

what you did wrong there.

i can only say i launch threads (using boost) often, and as long as calls

are made only from the main thread, all is ok.

perhaps you made some calls to AE from the other thread? if you did, AE can

become a bit of a "zombie" afterwards, even i

...
Translate
Community Expert ,
Jan 08, 2016 Jan 08, 2016

i don't know what you're doing wrong, but launching and joining threads is

entirely possible.

ae does behave weirdly if you use it's calls from any other thread (with

very few exceptions). you say the thread id is the same, so i don't know

what you did wrong there.

i can only say i launch threads (using boost) often, and as long as calls

are made only from the main thread, all is ok.

perhaps you made some calls to AE from the other thread? if you did, AE can

become a bit of a "zombie" afterwards, even if the process has already

returned to the main thread.

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
Explorer ,
Jan 09, 2016 Jan 09, 2016
LATEST

Thanks Shachar,

I'm actually a lot of testing, I will resume my code and simplify.

it's true that my post is confused, and I try to do many things, I'm going back to zero and find the right solution.

Thank you to confirm that this is possible, which seems to me obvious.

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