Can someone explain the difference between the art attributes kArtSelected and kArtTargeted? Is kArtTargeted the same as targeting art in the Layers panel? Is targeting, vs. selecting, only relevant for certain art types such as graphs, groups, and plugin art? TIA
I just asked ChatGPT “What is the difference between kArtSelected and kArtTargeted in the Adobe Illustrator SDK” and got this:
In the Adobe Illustrator SDK, kArtSelected and kArtTargeted refer to different states of a selected object.
kArtSelected refers to an object that has been selected by the user, typically by clicking on it with the selection tool. This object can be manipulated and edited in various ways.
kArtTargeted refers to the object that is currently the target of an action or command. This object may or may not also be selected. For example, if the user is using the pen tool to draw a path, the path being drawn would be the targeted object, but it would not be selected until the user completes the path.
In short, kArtSelected refers to an object that is selected by user and kArtTargeted refers to an object that is currently the target of an action or command.
I would imagine, then, that there are only a few specialized reasons a plugin would want to target the art to manipulate it itself rather than select it for the user to manipulate? But if you have its handle and want to modify it somehow, why would you want to set it to kArtTargeted? Would it not leave the art in a more predictable state for the user to optionally just set it to kArtSelected when the plugin is done?
But if you have its handle and want to modify it somehow, why would you want to set it to kArtTargeted?
Hi @Rick E Johnson, I don't use the SDK, but if ChatGPT's example is right, then if a plug-in did path adjustments while the user was drawing it, then kArtTargeted might come into play? - Mark
That makes sense. If it's an extended interactive process, you'd want it to LOOK selected, but not necessarily BE selected for user operations like move, delete, etc. But if the plugin just quickly does its work, then I suspect there's no need to target it, just optionally select it when it's done.
My plugin finds and selects art based on various criteria, and I just want to be sure if there are circumstances where targeting would be more appropriate than selecting (I've seen code samples that target rather than select). I'm leaning pretty heavily toward simply selecting art, never targeting it, since my plugin is now done with it.