07-11-2020, 04:39 PM
(This post was last modified: 07-12-2020, 06:10 AM by Rick Johnson.)
I'm having some trouble reading the ActionGoMessageType message, hid::core::ActionMessage.
Here's a snippet from the GoAction callback from my Concatenate plugin from pre-CC days, pre-CORE, written with the SDK:
This code worked "back in the day" as they say. Now in CORE I'm subscribed to the dispatcher ActionGoMessageType. Here's a snippet from my CORE counterpart in the ActionGo callback:
When I run this by playing the Action in AI, it crashes on AIActionGetInteger, or any function to retrieve a value from valueParameterBlock with "Thread 1: EXC_BAD_ACCESS (code=EXC_I386_GPFLT)" after a trip to hdi::aip:ispatcher::message.
Debugging in Xcode 10, I added a string item with the value "TEST" hoping I could see it when I viewed the memory of valueParameterBlock, but no luck. I also tried casting msg with "message = (DoActionMessage*)msg;" and also as an AIActionParamValueRef but it made no difference.
I believe the values it's trying to read were set correctly. I registered the action event, and while running Illustrator it recorded normally. All fields appeared in Illustrator's Actions panel with proper keys and values. Is there a better way to cast the message from lastMessage? Is there a simple way to get the DoActionMessage directly through the SDK after notification from CORE's dispatcher?
Any suggestions would be very much appreciated! If I get this working, I'll post a summary of all of the steps to share with others.
Here's a snippet from the GoAction callback from my Concatenate plugin from pre-CC days, pre-CORE, written with the SDK:
Code:
AIErr doAction( DoActionMessage *message ){
AIErr error = kNoErr;
AIActionParamValueRef valueParameterBlock = message->param;
long mode = 0;
error = sActionManager->AIActionGetInteger(valueParameterBlock, 'mode', &mode);
This code worked "back in the day" as they say. Now in CORE I'm subscribed to the dispatcher ActionGoMessageType. Here's a snippet from my CORE counterpart in the ActionGo callback:
Code:
hdi::core::Message* msg = this->__corePlug->dispatcher()->lastMessage();
DoActionMessage* message = reinterpret_cast<DoActionMessage*>(msg);
AIActionParamValueRef valueParameterBlock = message->param;
AIErr error = kNoErr;
long mode = 0;
error = sAIAction->AIActionGetInteger(valueParameterBlock, 'mode', &mode);
When I run this by playing the Action in AI, it crashes on AIActionGetInteger, or any function to retrieve a value from valueParameterBlock with "Thread 1: EXC_BAD_ACCESS (code=EXC_I386_GPFLT)" after a trip to hdi::aip:ispatcher::message.
Debugging in Xcode 10, I added a string item with the value "TEST" hoping I could see it when I viewed the memory of valueParameterBlock, but no luck. I also tried casting msg with "message = (DoActionMessage*)msg;" and also as an AIActionParamValueRef but it made no difference.
I believe the values it's trying to read were set correctly. I registered the action event, and while running Illustrator it recorded normally. All fields appeared in Illustrator's Actions panel with proper keys and values. Is there a better way to cast the message from lastMessage? Is there a simple way to get the DoActionMessage directly through the SDK after notification from CORE's dispatcher?
Any suggestions would be very much appreciated! If I get this working, I'll post a summary of all of the steps to share with others.