Copy link to clipboard
Copied
I am creating an automation plug-in that needs to rotate the image. Here is the code to call the eventRotate command:
{
PIActionDescriptor rotation_desc;
sPSActionDescriptor->Make(&rotation_desc)
double degrees = 15;
SPErr rotate_error = sPSActionDescriptor->PutUnitFloat(rotation_desc, keyAngle, unitAngle, degrees); // No error here.
rotate_error = sPSActionControl->Play(&result, eventRotate, rotation_desc, plugInDialogSilent); // Returns error -25920.
Here is what Listener outputs for me and works on CS5. Your code failed for me so please check out this block of code.
SPErr PlayeventRotate(/*your parameters go here*/void)
{
PIActionDescriptor result = NULL;
DescriptorTypeID runtimeKeyID;
DescriptorTypeID runtimeTypeID;
DescriptorTypeID runtimeObjID;
DescriptorTypeID runtimeEnumID;
DescriptorTypeID runtimeClassID;
DescriptorTypeID runtimePropID;
DescriptorTypeID runtimeUnitID;
SPErr error = kSPNoError;
// Move this to the top of the routine!
PIActionDescri
...Copy link to clipboard
Copied
Here is what Listener outputs for me and works on CS5. Your code failed for me so please check out this block of code.
SPErr PlayeventRotate(/*your parameters go here*/void)
{
PIActionDescriptor result = NULL;
DescriptorTypeID runtimeKeyID;
DescriptorTypeID runtimeTypeID;
DescriptorTypeID runtimeObjID;
DescriptorTypeID runtimeEnumID;
DescriptorTypeID runtimeClassID;
DescriptorTypeID runtimePropID;
DescriptorTypeID runtimeUnitID;
SPErr error = kSPNoError;
// Move this to the top of the routine!
PIActionDescriptor desc0000000000000120 = NULL;
error = sPSActionDescriptor->Make(&desc0000000000000120);
if (error) goto returnError;
// Move this to the top of the routine!
PIActionReference ref0000000000000038 = NULL;
error = sPSActionReference->Make(&ref0000000000000038);
if (error) goto returnError;
error = sPSActionReference->PutEnumerated(ref0000000000000038, classDocument, typeOrdinal, enumFirst);
if (error) goto returnError;
error = sPSActionDescriptor->PutReference(desc0000000000000120, keyNull, ref0000000000000038);
if (error) goto returnError;
error = sPSActionDescriptor->PutUnitFloat(desc0000000000000120, keyAngle, unitAngle, 33);
if (error) goto returnError;
error = sPSActionControl->Play(&result, eventRotate, desc0000000000000120, plugInDialogSilent);
if (error) goto returnError;
returnError:
if (result != NULL) sPSActionDescriptor->Free(result);
if (desc0000000000000120 != NULL) sPSActionDescriptor->Free(desc0000000000000120);
if (ref0000000000000038 != NULL) sPSActionReference->Free(ref0000000000000038);
return error;
}