07-07-2021, 02:38 PM
(This post was last modified: 07-09-2021, 07:23 AM by Rick Johnson.)
(01-20-2021, 01:03 PM)garrett Wrote: Pushing and popping context is required whenever your plugin is messaged through any other means than via Illustrator directly; which is to say, if your PluginMain() function (which hdi_core abstracts away so you don't have to deal with it) is NOT called, then you have to push context if you want to interact with Illustrator and pop context when you're done interacting with Illustrator. An example of this is when the OS itself messages your plugin, perhaps in response to e.g. some event in a custom widget you have created completely from scratch, or in response to a timer you registered directly with the OS, or response to your interacting with a third-party library that later calls your code of its own accord.
I think I understand this, but need to make sure: When notifiers and key press monitors are registered with hdi::core::Dispatcher, then returned to my plugin through its callback, do I still need to push and pop context?
I have a few custom widgets, but they all work entirely through callbacks set within the hdi::core::CustomWidget class when the widget is created in my post-startup event. I've assumed that these don't need to push or pop context, either.
Also, custom art receives update events not necessarily from the plugin, but from Illustrator, so it seems push/pop context should not be needed there, I believe.
I would think an example of an external event in need of push/pop would be if I created a hook for a JavaScript, and that would require manually pushing and popping the context. Right?
Thanks a ton in advance. :-/