Copy link to clipboard
Copied
Hi all,
I have a set of photoshop files, each of which contain a number of animation frames within them. My goal is seemingly simple - create a plugin to iterate over each frame and save specific layers to disk. The problem is I cannot figure out how to retrieve or set the current frame of animation in code. After a few days of digging through the SDK documentation, both online and in the SDK folder, I have failed to come up with anything concrete.
Does anyone happen to know how to retrieve/set the current frame of animation? Or even how to determine whether or not a document has animation frames to begin with? Any help would be *tremendously* appreciated.
- Graf
Copy link to clipboard
Copied
I don't see a way to get any information about the animation frames. (I use the Getter plug-in to answer these types of questions.)
I did get this when setting frames from the UI. (I use the Listener plug-in to answer these types of questions.)
SPErr PlayeventSelect(/*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 desc0000000000000EC0 = NULL;
error = sPSActionDescriptor->Make(&desc0000000000000EC0);
if (error) goto returnError;
// Move this to the top of the routine!
PIActionReference ref0000000000000758 = NULL;
error = sPSActionReference->Make(&ref0000000000000758);
if (error) goto returnError;
error = sPSActionControl->StringIDToTypeID("animationFrameClass", &runtimeClassID);
if (error) goto returnError;
error = sPSActionReference->PutIndex(ref0000000000000758, runtimeClassID, 7);
if (error) goto returnError;
error = sPSActionDescriptor->PutReference(desc0000000000000EC0, keyNull, ref0000000000000758);
if (error) goto returnError;
error = sPSActionControl->Play(&result, eventSelect, desc0000000000000EC0, plugInDialogSilent);
if (error) goto returnError;
returnError:
if (result != NULL) sPSActionDescriptor->Free(result);
if (desc0000000000000EC0 != NULL) sPSActionDescriptor->Free(desc0000000000000EC0);
if (ref0000000000000758 != NULL) sPSActionReference->Free(ref0000000000000758);
return error;
}
SPErr PlayeventSelect(/*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 desc0000000000000EE0 = NULL;
error = sPSActionDescriptor->Make(&desc0000000000000EE0);
if (error) goto returnError;
// Move this to the top of the routine!
PIActionReference ref0000000000000768 = NULL;
error = sPSActionReference->Make(&ref0000000000000768);
if (error) goto returnError;
error = sPSActionControl->StringIDToTypeID("animationFrameClass", &runtimeClassID);
if (error) goto returnError;
error = sPSActionReference->PutIndex(ref0000000000000768, runtimeClassID, 4);
if (error) goto returnError;
error = sPSActionDescriptor->PutReference(desc0000000000000EE0, keyNull, ref0000000000000768);
if (error) goto returnError;
error = sPSActionControl->Play(&result, eventSelect, desc0000000000000EE0, plugInDialogSilent);
if (error) goto returnError;
returnError:
if (result != NULL) sPSActionDescriptor->Free(result);
if (desc0000000000000EE0 != NULL) sPSActionDescriptor->Free(desc0000000000000EE0);
if (ref0000000000000768 != NULL) sPSActionReference->Free(ref0000000000000768);
return error;
}