How to get animated weight property curve in motionbuilder

I’m trying to write a tool to manage animation layers in motionbuilder. And one of the attributes I would like to query is animation layer weight ( animated ).
However I can’t seem to find a way to get a handle on this, so I wondered if anyone has done this and could help me out.

I’ve tried to grab it my running through the properties of the layer and catching any animated ones. However when I do this and It correctly returns the weight property. It breaks the keys on the layer and does not return any keys…Any ideas?

props = layer.PropertyList
print props
for p in props:
if p and p.IsAnimatable() and p.IsAnimated():
anim_node = p.GetAnimationNode()

f_curve = anim_node.FCurve

This seems like some prime Motionbuilder fuckery™ - getting the FCurve from a layer seems to clear the keys from that layer, but only the first time you do. Any subsequent attempts doesn’t trigger this bug and returns the proper amount of keys.

Yeah really odd. It clears the keys but retains the animation. To return the subsequent keys, I had to re add those keys. Is that the same with you. eg. I re keyed the weight, and then the next time it picks them up. However I can’t see how this will help as I couldn’t re-key those keys with a script as I can’t find out what they are before destroying them :confused:

Yes, there is a bug like that. Tricky thing is that even it shows you that keys are removed, you can save scene, load and have your keys back. One of the way out to get information about keys is to save (even selected only one take) into a tiny fbx file. Read fbx with fbx sdk to get animation layer weight curve keys and rebuild curve in motionbuilder.

Thanks, that sounds promising. Could you give me some pointers / where to look things up on using the fbx sdk as I’ve not done that before?