Skip to main content
Inspiring
May 7, 2015 11:16 AM UTC
Answered

How do I attach a AIDictionary to an art object?

What I want to do is:

I want store some custom data to the art object, someone told me that i can use AIDictionary. But I don't know how to attach the AIDictionary to the specific art object. Is there some one give me some suggestions or send me a example, thanks!

Best Regards.

This topic is closed to new replies. Start a new post to keep the conversation going.
BlyskawicaCorrect answer
Participating Frequently
May 9, 2015 12:48 PM UTC

All art objects already have dictionaries; you just need to add an entry to them. For example:

AIDictionaryRef artDict;

AIErr error = sAIArt->GetDictionary(art, &artDict);

if (!error) {

     sAIDictionary->SetIntegerEntry(artDict, sAIDictionary->Key("myKey"), value);

}

sAIDictionary->Release(artDict);

5 replies

BlyskawicaCorrect answer
Participating Frequently
May 9, 2015 12:48 PM UTC

All art objects already have dictionaries; you just need to add an entry to them. For example:

AIDictionaryRef artDict;

AIErr error = sAIArt->GetDictionary(art, &artDict);

if (!error) {

     sAIDictionary->SetIntegerEntry(artDict, sAIDictionary->Key("myKey"), value);

}

sAIDictionary->Release(artDict);

Translate
Inspiring
May 14, 2015 2:46 AM UTC

Thanks for your answer, it is correct!

Translate