I have been working on a script to convert an fbx to a json format to bridge into another system. I’m using the fbx python bindings.
It seems I just cannot properly understand how to extract rotation values that match what Maya shows when I just do a straight FBX import of the same source file. Furthermore, I am not even using the proper number of frame samples to match Maya. I’ve tried researching and found a number of similar question talking about accounting for the pre/post rotation, or sampling the transform from the evaluator. No matter what I do, I am missing the mark.
I feel I am just sampling the wrong way. I did find this just recently from the faq, and would also love a bit of an expansion from someone:
4.8 How do I correctly get/set the number of frames and the frame rate in a FBX file?
Watch out. The number of keys in an animation curve is not the same as the number of frames in an animation.
Up until I had read this, I have been looping on FbxAnimCurve.KeyGetCount(), which I now understand is not really the right way. Here are the details of my siuation:
I am focusing right now only on the RX of the camera in my FBX file.
After import into Maya, the curve shows a range of frames 0-496 (unbaked), but GetKeyCount reports 506 keys. While other animation curves in the scene have their own varied time spans. Again, obviously this is the wrong way to sample, so I really need some help understanding FAQ 4.8 and how to properly sample for each anim curve to get the real keyed frames that Maya sees.
For the rotation values I am pulling, the first few frames of data from my script look like:
I tried adding together (euler) preRot + val + postRot , and this resulted in values that seemed to agree with maya, but then diverged towards the end, I am assuming, because of my poor frame sampling approach.
In a nutshell I want to correct two issues:
1. Sample the same key frames in that 0-496 that Maya is seeing (I don’t care if they are baked or not).
2. Produce a rotation value that matches what Maya shows me from import.PitTest-1700.FBX
As an update to this problem, I have found that there is something specific to the camera in this FBX that I am handling incorrectly, versus another test I did…
In Maya I just create a simple camera in the root world, and added a couple keyframes to the rotation over a 1-48 frame range, and exported an FBX with default settings. Running this through my script, the rotations all match 1-to-1 with the unaltered value of each key in the curve.
Maybe someone could take a look at the previously reference fbx and offer some insight as to what is different about this camera that I need to consider in the rotation values?