1 Reply Latest reply on Jan 16, 2015 7:29 AM by peter@project44.be

    How to avoid Illustrator to apply "effects" to a group plugin




      Is there any (or a better) way to block illustrator from applying effects to an object created by a plugin.


      What I have found till now is that one can receive a message when this is about to happen by watching  kSelectorAINotifyEdits looking for e.g. the  kStyleOperationCode "code" in the  kCheckOperationTime or  kBeforeOperationTime "time"

      These messages are indeed received by the plugin. At that time I can display a MessageAlert telling the user this is not allowed, but then Illustrator  continues displaying the dialog for the effect (e.g. 3D extrude and bevel options). That  triggers the same event again and if I return kRefusePluginGroupReply the effect is not applied and an internal error is displayed. Not very elegant.

      Related: when I apply  opacity to the plugin object, the message is received after that Illustrator has applied the opacity and there does not seem a way to block the operation at all.


      I am trying to get my head around the documentation of kSelectorAINotifyEdits hoping to figure out what I could return from the message handler so that  Illustrator stops the effect action immediately, without displaying its effect dialog box, but I have not had any success trying different return codes.

      So, all suggestions to get this working warmly welcomed indeed!


      Documentation of kSelectorAINotifyEdits extracted:

      #define kSelectorAINotifyEdits   "AI Notify Edits"

      Notifies a plug-in group of edits to the edit group.

      An AIPluginGroupMessage::code value indicates the type of editing operation being performed. An AIPluginGroupMessage::time value indicates what stage of the operation is in progress.

      When the handler returns kNoErr, the plug-in object is marked as "dirty" (in need of kSelectorAIUpdateArt). To prevent this, return kMarkValidPluginGroupReply. If the handler returns kDontCarePluginGroupReply, retains the state of the object, and does not mark it as clean or dirty.

      If the handler returns kWantsAfterMsgPluginGroupReply from a kBeforeOperationTime notify-edits message, a single kAfterOperationTime message is sent at the end of the transaction, just before the Undo recording is closed, and before the update message. The code is kChangeOperationCode, regardless of whether a more specific code was sent at kBeforeOperationTime). This is the appropriate place to make any changes to the edit art.