Skip to main content
Participant
May 23, 2017
Answered

Get frame animation Loop Info

  • May 23, 2017
  • 1 reply
  • 455 views

I am writing a script that exports the frame animation information from Photoshop timeline to a json file our game can load.  I have it exporting the frame order, names and delays just fine now, but I can't find a way to access whether the entire animation is set to loop once, 3 times, forever, etc.  I have seen some scripts on how to set the loop count, but nothing about how to read it?

Much thanks for any help!

This topic has been closed for replies.
Correct answer c.pfaffenbichler

#target photoshop

alert (getAnimationLoopCount ());

////// get framedelay //////

function getAnimationLoopCount (theIndex) {

var ref = new ActionReference(); 

ref.putProperty(charIDToTypeID('Prpr'), stringIDToTypeID('animationLoopCount')); 

ref.putEnumerated(stringIDToTypeID('animationClass'), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ));

var desc=new ActionDescriptor(); 

desc.putReference(charIDToTypeID('null'), ref);          

var aaa = executeAction(charIDToTypeID('getd'), desc, DialogModes.NO);

return aaa.getInteger(stringIDToTypeID('animationLoopCount'))

};

1 reply

c.pfaffenbichler
Community Expert
c.pfaffenbichlerCommunity ExpertCorrect answer
Community Expert
May 23, 2017

#target photoshop

alert (getAnimationLoopCount ());

////// get framedelay //////

function getAnimationLoopCount (theIndex) {

var ref = new ActionReference(); 

ref.putProperty(charIDToTypeID('Prpr'), stringIDToTypeID('animationLoopCount')); 

ref.putEnumerated(stringIDToTypeID('animationClass'), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ));

var desc=new ActionDescriptor(); 

desc.putReference(charIDToTypeID('null'), ref);          

var aaa = executeAction(charIDToTypeID('getd'), desc, DialogModes.NO);

return aaa.getInteger(stringIDToTypeID('animationLoopCount'))

};

FizzPowAuthor
Participant
May 23, 2017

This works perfectly, thanks so much!!!!!