Hot Door CORE Forum

Full Version: dictionary art entries
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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.