Copy link to clipboard
Copied
Hi,
I'm trying to retrieve data on art contained within a pluginart item by iterating pluginart items (not via a plugingroupmessage). I am restricting the matching art spec to only plugin art, however when I attempt to retrieve the plugin art data (GetPluginArtName, GetPluginArtEditArt, GetPluginArtResultArt) I encounter error message 1146045247 which I believe corresponds to DOC? - this makes no sense as a document is open and active in the application:
AIMatchingArtSpec matchingArtSpec[1] = {{kPluginArt,0,0}};
AIArtHandle **artStore = NULL;
ai::int32 artCount = 0;
// Retrieve the matches
ASErr result = kNoErr;
result = sAIMatchingArt->GetMatchingArt(matchingArtSpec, 1, &artStore, &artCount );
aisdk::check_ai_error(result);
if (artStore != NULL)
{
int index;
for (index = 0; index < artCount; index++)
{
AIArtHandle artHandle = (*artStore)[index];
// Always returns 0. Apparently no art within plugin art
size_t artCount = 0;
result = sAIPluginGroup->GetPluginArtDataCount(artHandle, &artCount);
// Attempting to retrieve name always returns error 1146045247 - DOC? - which means no document open, which is not correct - an active document is open
char* pluginName;
result = sAIPluginGroup->GetPluginArtName(artHandle, &pluginName);
// Always returns error 1146045247
AIArtHandle editArtHandle = NULL;
result = sAIPluginGroup->GetPluginArtEditArt(artHandle, &editArtHandle);
// Also always returns error 1146045247
AIArtHandle resultArtHandle = NULL;
result = sAIPluginGroup->GetPluginArtResultArt( artHandle, &resultArtHandle );
}
Does anybody know what might be wrong here?
OK - finally figured it out. After adding a call to push the app context from the original SPPluginRef, all works as it should!
Not sure how or why this is necessary - strange that some API calls worked fine, but others failed. Quirk of the SDK I guess..
// Seemingly no need to do anything with the context.. just pushing it is enough
AIAppContextHandle context = 0;
AIErr error = sAIAppContext->PushAppContext(panelController->fPluginRef, &context)
Copy link to clipboard
Copied
OK - finally figured it out. After adding a call to push the app context from the original SPPluginRef, all works as it should!
Not sure how or why this is necessary - strange that some API calls worked fine, but others failed. Quirk of the SDK I guess..
// Seemingly no need to do anything with the context.. just pushing it is enough
AIAppContextHandle context = 0;
AIErr error = sAIAppContext->PushAppContext(panelController->fPluginRef, &context)