Skip to main content
Participant
February 17, 2009
Question

Any way to create or influence Animation-Frames by a script?

  • February 17, 2009
  • 1 reply
  • 474 views
Is there any command or any way to create, change or influence animation-frames with a script?
I searched the documentation, the net and this forum - and found nothing yet.
This topic has been closed for replies.

1 reply

Participant
February 18, 2009
I solved the problem by now using the ScriptingListener. If you encounter the same problems, the functions below may help. However, I found no way of requesting the current frame - so you have to take track on how much frames you have and which frame is the current frame.

function jumpToFrame(frameNumber)
{
var idslct = charIDToTypeID( "slct" );

var desc30 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref25 = new ActionReference();
var idanimationFrameClass = stringIDToTypeID( "animationFrameClass" );

ref25.putIndex( idanimationFrameClass, frameNumber );
desc30.putReference( idnull, ref25 );
executeAction( idslct, desc30, DialogModes.NO );
}

function previousFrame()
{
var idanimationFrameActivate = stringIDToTypeID( "animationFrameActivate" );

var desc26 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref21 = new ActionReference();
var idanimationFrameClass = stringIDToTypeID( "animationFrameClass" );

var idOrdn = charIDToTypeID( "Ordn" );
var idPrvs = charIDToTypeID( "Prvs" );
ref21.putEnumerated( idanimationFrameClass, idOrdn, idPrvs );
desc26.putReference( idnull, ref21 );
executeAction( idanimationFrameActivate, desc26, DialogModes.NO );
}

function nextFrame()
{
var idanimationFrameActivate = stringIDToTypeID( "animationFrameActivate" );
var desc27 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref22 = new ActionReference();
var idanimationFrameClass = stringIDToTypeID( "animationFrameClass" );
var idOrdn = charIDToTypeID( "Ordn" );
var idNxt = charIDToTypeID( "Nxt " );
ref22.putEnumerated( idanimationFrameClass, idOrdn, idNxt );
desc27.putReference( idnull, ref22 );
executeAction( idanimationFrameActivate, desc27, DialogModes.NO );
}

function newFrame()
{
var idDplc = charIDToTypeID( "Dplc" );
var desc39 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref33 = new ActionReference();
var idanimationFrameClass = stringIDToTypeID( "animationFrameClass" );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref33.putEnumerated( idanimationFrameClass, idOrdn, idTrgt );
desc39.putReference( idnull, ref33 );
executeAction( idDplc, desc39, DialogModes.NO );
}