How to get the frame count of a scene
Willy2
Posts: 175
Hi,
I would like to obtain, with a script, the total number of frames of a scene.
I tried with the following two primitives, but didn't get the right value:
- Scene.getPlayRange()
- Scene.getAnimRange()
Comments
Hi,
I would like to obtain, with a script, the total number of frames of a scene.
I tried with the following two primitives, but didn't get the right value:
It's a Daz-ism. The units are "ticks" which is 1/4800 th of a second.
I am not interested in the intrinsic meaning of this variable.
I want to get this value to use in a for loop.
On the attached image, it is equal to 215.
To my knowledge, DS doesn't reckon time in terms of frames, but rather ticks. You have to be interested in the intrinsic meaning of this variable to convert from the ticks returned by the time functions to frames. Something like:
auto start = dzScene->getPlayRange().getStart() / timeStep;
auto end = dzScene->getPlayRange().getEnd() / timeStep;
But you are asking a script question in the SDK forum.
I got this value in the following way:
Thanks
Hopefully, this simple script should demonstrate how it works:
print( "Time Step: " + Scene.getTimeStep() );
print( "Start Time: " + Scene.getPlayRange().start );
print( "End Time: " + Scene.getPlayRange().end );
var startFrame = Scene.getPlayRange().start / Scene.getTimeStep();
var endFrame = Scene.getPlayRange().end / Scene.getTimeStep();
print( "Start Frame: " + startFrame );
print( "End Frame: " + endFrame );
var totalFrames = endFrame - startFrame;
print( "Total Frames: " + totalFrames );
HTH.
- Greg
Threads merged.