Hot Door CORE Forum
dictionary art entries - Printable Version

+- Hot Door CORE Forum (http://hotdoorcore.com/forum)
+-- Forum: All forums (http://hotdoorcore.com/forum/forumdisplay.php?fid=1)
+--- Forum: General discussion (http://hotdoorcore.com/forum/forumdisplay.php?fid=3)
+--- Thread: dictionary art entries (/showthread.php?tid=204)



dictionary art entries - Rick Johnson - 01-26-2019

It's my understanding that art objects can be stored in a dictionary, either document dictionary or another art object's dictionary. I tried this two ways.

- A function is passed the argument hdi::core::Art* theArt, which is a path art object.
- Variable myDict is my dictionary with a document or art object dictionary.

Code:
hdi::core::Art recoverArt;
bool success = myDict.setArtEntry("XMLID_12_", *theArt);
theArt->dispose();
success = myDict.getArtEntry("XMLID_12_", recoverArt);

Code:
hdi::core::ai::Entry artEntry = hdi::core::ai::Entry::FromArt(*theArt);
success = myDict.setEntry("XMLID_12_", artEntry);
theArt->dispose();
success = myDict.getEntry("XMLID_12_", artEntry);
success = artEntry.asArt(recoverArt);

Either way, recoverArt has an aiArtHandle and the original XML ID, but is empty and not valid. Ideally, I'd like to store a backup copy of art before it's transformed, to make it easy to do a perfect Undo at any time in the future. Am I misunderstanding how this works, or am I doing it wrong? Any suggestions would be much appreciated.


RE: dictionary art entries - garrett - 01-30-2019

Yes, I think this is just a misunderstanding of the functionality. I suppose the documentation could be a little clearer so I'll add that to our TODOs.

In any event, you cannot store an entire copy of a piece of art in a dictionary. Instead, what you're storing is a reference to the piece of art in the document, and if you dispose of the original piece of art then the reference is useless. Here's another way to look at it: in Illustrator, it is not possible to have a piece of art exist purely in memory – it must exist on the document to even get an AIArtHandle (and therefore a hdi::core::Art object) for it.