Sair
  • Comunidade global
    • Idioma:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Communication between plugin and extension

Entusiasta ,
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.

TÓPICOS
SDK
1.6K
Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines

correct answers 1 resposta correta

Entusiasta , 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.

Traduzir
Adobe
Explorador ,
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

Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines
Entusiasta ,
Feb 28, 2012 Feb 28, 2012
MAIS RECENTE

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.

Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines