Is there a direct method to get the total number of frames or total frames per second for an animation ?
Using the Javadoc took me 3 seconds:
That seems to be the total time, though.
The number of frames per track would be something like http://javadoc.jmonkeyengine.org/com/jme3/animation/BoneTrack.html though it doesn’t expose getKeyframes but rather only setKeyframes.
Thanks , I was aware of the max time but that won’t tell you the number of frames unless you already know forehand. You can add/subtract the keys in blender and every other animation software.
The second part is more of what I was looking for. I just wish there was a more direct root. I thought blend files might tag the total key frame times in the meta data or something like that. Either way the bone track should suffice.
It would be good to know what you want to achieve, though.
The Animation System isn’t designed to allow modifications to it at all.
That is why it is not exposed. No usercode should actually mess with them either.
If it’s for you tools you might have no chance instead of a modificated engine.
To me it seems the engine keyframes are not “rasterized” to discreet frames but rather to time. That means depending on the import method there might not be a concept of frames actually.
I have a function for playing an animation backward or playing from a specified frame subset. Mostly I need it for playing animations backward.
Maybe you can set a negative speed? If not, I guess that would be a nice pull request/Issue thing.
And I’d change everything to time instead of frames, so playing after a specific time rather than frames.
I want the track times and/or frames specifically this way I can check time markers for throwing events such as between frame/time 24 - 26 play audio etc.
And what would you do if the Animation System is only a List of a KeyValuePair of Time and Vector3f?
And then the value is interpolated inbetween the value before the current time and the next one after the current time?
Then you have no frames. It could be implemented like this but I don’t know.
A look into the SourceCode might tell you
You should use time for this and not frames, I think. Time is at least universal.
I have never used “animation frames” once I get into jME, since it interpolates between the “fames” they are not as important (for my use cases). I have always worked with time / speed and max anim time, and on edge cases where I need an actual animation frame, it’s just some trivial math …
animationTime = (totatlTime / totalFrames) * desiredFrameNumber;