Skip to main content
Inspiring
June 20, 2022
Question

Art object uniqueness.

  • June 20, 2022
  • 1 reply
  • 565 views

Hi fellow developers,

 

I try to achieve a list/set/map of  art work objects, paths specificaly.

 

I tought that the art handle is unique to every object. It seemed so untill i discovered that when an artboject is changed, the art handle(a pointer adress basicly) is different. Even a small move causes the old handle to be invallid. So not usable to achieve somekind of std::vector or std::map wathever with this art  handles.

 

I tried using the UID suite... but again after the slightest possible change in the artwork, the UID of the object is renewed again making it rather useless to achieve a list of uniqueness. Also Handles would be better then unique id's.

 

Its seems that the only thing that keeps being attached to an art pobject is its dictionary. This is very usable but also creates some overhead of checking. Again Unique handles in a list would be ideal.

 

So does anybody has some experience with uniqueness in art object a the abbility to list/map/set/whatever them for later use?

 

Thx for any hint! 🙂

 

Doubl3

This topic has been closed for replies.

1 reply

Rick E Johnson
Inspiring
June 20, 2022

Have you tried the UUID? I have a plugin that stores the UUID for some objects and they have remained valid after the document has been edited, and even closesd and re-opened.

Doubl3Author
Inspiring
June 20, 2022

Hi Rick, thx for the quick suggestion. 

 

I quicktested the UUID suite. (wich is not production ready according to the manual... 🙂 )

 

It seems the the UUID's keep there link with the object in a session.

But for example when i swap objects in the layerstack. After save restart and reload. The UUID's are re-assigned in order of the stack. So the ID's are not saved within the file itself. And arent save to store as they could be swapped after one session to the next.

 

This is frustrating behavoir and weird that there is no straight forward sollution ready to use.

The swatches also have the same behavoir when changed the handles change...

It will probably end in creating something myself to counter this behavior.

The dictionaries are my best bet right now as they are kept exactly the same after saving...

 

 

Rick E Johnson
Inspiring
June 21, 2022

Hi Rick,

thnks for the link to the hot door core lib.

It looks nice. I looked upped the UI id part but in the documentation they state this:

So i don't know why, but this gives me the feeling that they are using the same UID's as the SDK wich arent stable all the time. It worked for you so it might for me... 🙂

Did you test it with 10k+ art objects and a big file?

It needs to be fast and stable even with very high counts of objects.

 

Thx again in any case for your replies! It at least got me the UUID's wich are allready more usable then the handles and the out of the box UID's from the SDK.


I should add that most CORE classes are simply thin wrappers on one or several SDK suites that add a few enhancements, occasional workarounds for Adobe bugs, and gives consisten syntax so one code base can be compiled for many versions of Illustrator for both Mac and Windows. The last CORE release compiled for AI 16 through 25, but currently supports 23 thrhough 26.

For best reliability, though, I agree with your suggestion for IDs stored in object dictionaries. If you go that route, I hope it doesn't slow Illustrator down much when parsing (tens of) thousands of art objects.