Plugin - refresh document state after InvokeMenuAction()
Hello, I am working on plugin and I would like to change document color mode in code from RGB to CMYK.
Since
sAIDocument->SetDocumentColorModel(kDocCMYKColor);only changes the document flag, but does not do the actual conversion, I though the easiest way to do proper conversion was to invoke the already present functionality, as if the user changed the color mode manually:
AICommandID to_cmyk_id;
sAICommandManager->GetCommandIDFromName(kDocColorCmykCommandStr, &to_cmyk_id);
sAIMenu->InvokeMenuAction(to_cmyk_id); This does exactly what I want, it changes the color mode to CMYK with proper conversion. It however breaks the document state inside the plugin.
For example, even the following simple call to get document fails, if the InvokeMenuAction codeblock is executed before it.
AIDocumentHandle doc = nullptr;
sAIDocument->GetDocument(&doc);
Is it possible to refresh the state inside the plugin after InvokeMenuAction()? Any help would be greatly appreciated!
