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

Again PluginGroup

New Here ,
Nov 06, 2008 Nov 06, 2008

Copy link to clipboard

Copied

Hello world,
I have still problems with those parts of my plugin whith are dealing with
PluginGroup (I have posted 2 months ago).
I'm using CS3 (and the SDK for CS3)and Visual Studio 2005
After I called UseAIPluginGroup( newArt, g->myPluginGroup) whitch doesn't return an error Illustrator crashes on the next call with newArt in it.
For example GetPluginArtResultArt() or SetTag(),...
g->myPluginGroup is initialised after the Plugin receives the AIApplikationStartedNotifier using AddPluginGroup()
If I don't work with arts of type kPluginArt my plugin runs without any problems.
There is on think im not totaly sure these are the arguments of AddPluginGroup() What are working entries for name (char*) and data (AIAddPlugnData*)

Hope someone can help me
thanks
TOPICS
SDK

Views

1.4K

Translate

Translate

Report

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
Adobe
Guide ,
Nov 07, 2008 Nov 07, 2008

Copy link to clipboard

Copied

Well, first of all you should be aware that PluginGroupArt has more than a few bugs in it. It's possible you're just running into one of those. We used PluginGroups in our application and currently its the chief source of headaches for us (which is a shame, because idea behind the suite is fantastic!)

One thing you might try is registering your PluginGroup earlier -- I know we do it pretty much as soon as the plugin is loaded, rather than as late as the application started notifier. I'm not sure how much difference that will make though.

One thing to make sure is that you're not using a local variable when setting the members of AIAddPluginData -- AI seems to take ownership of those char*. If you're just assigning the addresses of local buffers to that struct, you might be causing AI to use bad pointers and crash.

Votes

Translate

Translate

Report

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
New Here ,
Nov 09, 2008 Nov 09, 2008

Copy link to clipboard

Copied

Thanks very mutch,
I will trie both hints
1. Until now I allway tried to registern my PluginGroup later I never
thought to register it before the application started notifier. I
will trie this

2. That could be the solution as I use local variables in
AddPluginGroup

It's realy nice to hear that I'm not the onlyone how has problems with this suite

Votes

Translate

Translate

Report

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
Engaged ,
Sep 15, 2016 Sep 15, 2016

Copy link to clipboard

Copied

I just want to pop this up to the top again. I am running into a similar issue.

I am registering my plugin group in my StartupPlugin(...) method, and I did not using a local variable for AIAddPluginData.

My code to generate the PluginGroup seems to work fine. The art is created as I expect and shows up in the document. My problem seems to be around Undo/Redo.

Sometimes when I debug my code, there are several extra "Undo" steps created. I undo, undo, undo until I get to the step that actually "undo's" my art creation. Sometimes just the one undo is created like I'd expect.

Then, if I choose "Redo", Illustrator hangs. There's no crash, and when I pause in the debugger it seems to be in Illustrator code outside my plugin. If I let it go, I can see the used memory climb as Illustrator continues to try and do.... something?

If I comment out the one line where I SetPluginArtResultArt(...), the code works fine. If I leave that line in, it returns no error code.

I know it's hard to diagnose without me posting my whole code. Maybe there's some aspect of setting up a plugin art that I've overlooked?

For the time being I haven't bothered to handle the PluginGroupUpdate(...) stuff because it didn't seem necessary for my application, but maybe it is?

Votes

Translate

Translate

Report

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
Guide ,
Sep 15, 2016 Sep 15, 2016

Copy link to clipboard

Copied

Need a little more information to help. How are you actually populating the PluginArt? You said you create, but then how does it get filled with, well, stuff?

Undo is a mess with PluginArt, but I don't recall seeing multiple undo-steps. I'm guessing there's an obvious source once we drill down to it.

Votes

Translate

Translate

Report

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
Engaged ,
Sep 15, 2016 Sep 15, 2016

Copy link to clipboard

Copied

In response to my menu event:

     AIArtHandle pluginGroupArt;

     AIErr err = sAIArt->NewArt(kPluginArt, kPlaceInsideOnBottom, prep, &pluginGroupArt);

     sAIPluginGroup->UseAIPluginGroup( pluginGroupArt, gPlugin->GetPluginGroupHandle() );

       

     AIArtHandle resultGroupArt;

     sAIArt->NewArt(kGroupArt, kPlaceInsideOnBottom, prep, &resultGroupArt);

       

     AIArtHandle tickMarkArt;

     sAIArt->NewArt(kPathArt, kPlaceInsideOnTop, resultGroupArt, &tickMarkArt);

       

     AIPathSegment segments[3];

     segments[0] = { .corner = true, .p = {.h = 0, .v = 0}, .in = {.h = 0, .v = 0}, .out = {.h = 0, .v = 0} };

     segments[1] = { .corner = true, .p = {.h = 1, .v = 1}, .in = {.h = 1, .v = 1}, .out = {.h = 1, .v = 1} };

     segments[2] = { .corner = true, .p = {.h = 2, .v = 2}, .in = {.h = 2, .v = 2}, .out = {.h = 2, .v = 2} };

       

     sAIPath->SetPathSegments(tickMarkArt, 0, 3, segments);

     sAIPath->SetPathClosed(tickMarkArt, false);

       

     err = sAIPluginGroup->SetPluginArtResultArt(pluginGroupArt, resultGroupArt);

That is enough to recreate the issue. The art is drawn, then undo works, then redo hangs. Let me know if there's anything else I can show.

Votes

Translate

Translate

Report

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
Guide ,
Sep 15, 2016 Sep 15, 2016

Copy link to clipboard

Copied

Looking at our code, I think you're better off doing like us.

When you create the kPluginArt, you should get an notifier (caller=kCallerAIPluginGroup, selector=kSelectorAINotifyEdits). The AIPluginGroupMessage data block has a 'code' member that should be kAttachOperationCode (the first time). We respond to that and do all our creation in there.

Further more, we don't ever call SetPluginArtResultArt. You should be able to immediately call GetPluginArtResultArt(); the result & edit groups should already exist. Then you just populate them however you wish.

Try that and see if your undo/redo issues go away. It doesn't sound like you're doing anything remotely strange art-wise, so I suspect it's just the the trappings of kPluginArt that's screwing you up.

Votes

Translate

Translate

Report

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
Engaged ,
Sep 15, 2016 Sep 15, 2016

Copy link to clipboard

Copied

I changed:

AIArtHandle resultGroupArt;

sAIArt->NewArt(kGroupArt, kPlaceInsideOnBottom, prep, &resultGroupArt);

to:

AIArtHandle resultGroupArt;

sAIPluginGroup->GetPluginArtResultArt(pluginGroupArt, &resultGroupArt);

and now Undo/Redo works. I will have to port those results to my actual production code to see whether your other suggestions wind up being necessary. Thank you very much!

Votes

Translate

Translate

Report

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
Engaged ,
Sep 15, 2016 Sep 15, 2016

Copy link to clipboard

Copied

It looks like if I use

sAIArt->NewArt(kPathArt, kPlaceInsideOnTop, resultGroupArt, &tickMarkArt);

but if I

sAIArt->ReorderArt(tickMarkArt, kPlaceInsideOnTop, resultGroupArt);

then I get a 'PARM' error and the art is created, but left outside of the plugin group.

Votes

Translate

Translate

Report

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
Guide ,
Sep 16, 2016 Sep 16, 2016

Copy link to clipboard

Copied

Looking at our code, I don't see any places where we create art outside and move it inside (we always create it right in the sub-tree of the result or edit groups), so that may be a requirement. Odd though, I don't see why that shouldn't be allowed.

Votes

Translate

Translate

Report

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
Engaged ,
Sep 16, 2016 Sep 16, 2016

Copy link to clipboard

Copied

Neither do I! But I've got it working now, thanks. I couldn't have figured this out without your help.

Votes

Translate

Translate

Report

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
Engaged ,
Dec 12, 2016 Dec 12, 2016

Copy link to clipboard

Copied

Back to this old chestnut.

I updated everything to Illustrator CC 2017, and now I'm getting a crash when I save a file that I have created my plugin art in. The crash happens outside my code, but I have tracked the problem down to a spot in my code:

sAIArt->NewArt(kPluginArt, kPlaceInsideOnBottom, prep, &pluginGroupArt);

    AIErr err = sAIPluginGroup->UseAIPluginGroup(pluginGroupArt, myPluginGroupHandle);

err is 'VALD' here. The docs say "Return code for response to kSelectorAINotifyEdits at kAfterOperationTime, if the plug-in group has already updated the object." I'm not really sure why this code would return that error code. Maybe it's a bug?

My next thought was to try the function AIPluginGroupSuite->SetPluginArtPluginGroup(...), but that function seems to be unfinished. The docs say it takes two parameters, but the actual function only takes one and it's only the art handle to change, not the target plugin group. Another bug?

Votes

Translate

Translate

Report

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
Engaged ,
Dec 13, 2016 Dec 13, 2016

Copy link to clipboard

Copied

LATEST

It looks like this is related to my answer on this thread: https://forums.adobe.com/thread/2215301

In my handler for PluginGroupNotify(...), I was returning kMarkValidPluginGroupReply in response to kAttachOperationCode, kAfterOperationTime.

This is what was causing UseAIPluginGroup(...) to return kMarkValidPluginGroupReply. Apparently that causes other problems that I hadn't come across in previous versions.

I removed any handling in PluginGroupNotify and just return kUnhandledMsgErr there.

This seems to have cleared up my crashes on saving my file.

I can't even really remember what issue handling PluginGroupNotify was supposed to solve, I don't appear to be having the recursive draw issue I was having now without it.

Votes

Translate

Translate

Report

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