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

Communication between plugin and extension

Enthusiast ,
Feb 09, 2012 Feb 09, 2012

Hi,

I'm learning how to create extension (flex - extension builder) for Illustrator and how to make it communicate with a plugin.

The samples provided in the SDK detailed how to load /unload extension from a menu item from Illustrator, and how to add / remove EventListeners 

to make the magic happen.

to sum up, this is something like that:

1- click on the menu item

2- load extension

3- add listeners

4- do your stuff......

5- remove listeners

6- unload extension

Basically my plugin is a module/service which is in charge of dealing with / modifying artwork tree. It has no User Interface.

My extension will have a user of this service.  

What I would like to do is to load my extension as soon as my plugin is loaded, and unload the extension when the plugin will be unloaded.

Or notify when extension is loaded or unloaded.

Is that possible and hw could I achieve that?

Thx,

Thomas.

TOPICS
SDK
1.6K
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

Enthusiast , Feb 28, 2012 Feb 28, 2012

I have finally managed to do what I wanted.

Just like it has been done in the SDK sample, I have used a Controller class to deal with event listeners and extensions.

The plugin class, Illustrator notification system is used, and I have overwritten PostStartupPlugin, StartupPlugin, SetGlobal, SetGlobal, .. methods.

This is working pretty fine.

Translate
Adobe
Explorer ,
Feb 15, 2012 Feb 15, 2012

Hi Thomas,

Yes that is possible. If we use your summary as an example in order to load/unload your extension when the plugin is loaded/unloaded you would move the code in step 2 from the menu click event to the event that you want your plugin to be loaded in. Then you would move the code from the menu being unclicked to the unload event.

As a more concrete example if we take the code in FreeGridPlugin.cpp

if(visible)

                              {

                                             result = freeGridDialogController->UnloadExtension();

                                             freeGridDialogController->SetPanelReady(false);

                              }

  else

                              {

                                             result = freeGridDialogController->LoadExtension();

                              }

you would take:

result = freeGridDialogController->UnloadExtension();

freeGridDialogController->SetPanelReady(false);

and put that under your unload listener and put

freeGridDialogController->LoadExtension();

under your load listener.

I would just warn that the C++ plugin load and unload events are to do with Illustrator loading and unloading your plugin in memory and I would guess are not necessary the events that you would want to use for your UI as it may well load on startup and disappear seemingly arbitrarily to the user and reappear when it is reloaded. You might want to pick an event that is more closely tied to the function of your extension

I hope that helps.

Let me know if you have any further questions.

Thanks,

Robert

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
Enthusiast ,
Feb 28, 2012 Feb 28, 2012
LATEST

I have finally managed to do what I wanted.

Just like it has been done in the SDK sample, I have used a Controller class to deal with event listeners and extensions.

The plugin class, Illustrator notification system is used, and I have overwritten PostStartupPlugin, StartupPlugin, SetGlobal, SetGlobal, .. methods.

This is working pretty fine.

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