• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Retrieving pluginart edit/result art data

Community Beginner ,
Dec 30, 2020 Dec 30, 2020

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?

 

TOPICS
SDK

Views

179

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Jan 02, 2021 Jan 02, 2021

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)

 

Votes

Translate

Translate
Adobe
Community Beginner ,
Jan 02, 2021 Jan 02, 2021

Copy link to clipboard

Copied

LATEST

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)

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines