At our company, we are using Photoshop to animate 2D sprites for video games. To export the files from Photoshop, we are using custom scripts. However, our programmers encounterted a couple of problems with some of the functionality here.
First of all, there does not seem to be a documented API for large portions of the animation segment of Photoshop. However, this is one of the most important parts for automation, since it is very time consuming to manipulate each frame manually.
We've encountered two similar problems here:
var id45 = charIDToTypeID( "setd" );
var desc21 = new ActionDescriptor();
var id46 = charIDToTypeID( "null" );
var ref42 = new ActionReference();
var id47 = stringIDToTypeID( "animationFrameClass" );
var id48 = charIDToTypeID( "Ordn" );
var id49 = charIDToTypeID( "Trgt" );
ref42.putEnumerated( id47, id48, id49 );
desc21.putReference( id46, ref42 );
var id50 = charIDToTypeID( "T " );
var desc22 = new ActionDescriptor();
var id51 = stringIDToTypeID( "animationFrameDelay" );
desc22.putDouble( id51, 10.000000 );
var id52 = stringIDToTypeID( "animationFrameClass" );
desc21.putObject( id50, id52, desc22 );
executeAction( id45, desc21, DialogModes.NO );
In this example, the frame exposure is set to 10.0. However, the reference of "animationFrameClass" is zero, which means this value can only be read but not written.
The second example is this:
var idsetd = charIDToTypeID( "setd" );
var desc2 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref1 = new ActionReference();
var idanimationClass = stringIDToTypeID( "animationClass" );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref1.putEnumerated( idanimationClass, idOrdn, idTrgt );
desc2.putReference( idnull, ref1 );
var idT = charIDToTypeID( "T " );
var desc3 = new ActionDescriptor();
var idanimationLoopCount = stringIDToTypeID( "animationLoopCount" );
desc3.putInteger( idanimationLoopCount, 6 );
var idanimationClass = stringIDToTypeID( "animationClass" );
desc2.putObject( idT, idanimationClass, desc3 );
executeAction( idsetd, desc2, DialogModes.NO );
Here we are trying to set the loop count to 6 and we encounter a similar problem as described above.
Thank you!