MotionBuilder Forum
Welcome to Autodesk’s MotionBuilder Forums. Share your knowledge, ask questions, and explore popular MotionBuilder topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Set Local translation Z and Local Rotation X,Y to zero and clear the keys

1 REPLY 1
Reply
Message 1 of 2
angelo.samson
1487 Views, 1 Reply

Set Local translation Z and Local Rotation X,Y to zero and clear the keys

Hi

 

Sorry for asking too much, I have another question in Motion Builder 2014 python, How can I set Lcl Translation Z and Lcl Rotation X,Y to zero and clear their keys.

 

 

Manip.jpg

 

Is there a simple way to do this in python motion builder 2014? Thank you so much for your help!

 

Gelo

 

1 REPLY 1
Message 2 of 2
StepanK
in reply to: angelo.samson

from my notes, I hope I won't write a nonsense here, no time to doublecheck, apologies:

access Fcurve with this long thingy:

objectreference.Translation.GetAnimationNode().Nodes[0].FCurve.Keys[0]

here meaning of separate elements is:
-- objectreference is a reference to the object. Eg. a=FBModelNull("NewNull") stores the reference to variable a. Use objref=FBFindModelByLabelName("namespace:myObjectName") to find specific object by its long name.
-- Translation or Rotation or Scaling - access curve set You need.

-- Nodes[0] - returns X, [1] is Y and [2] is Z curve of Trans, Rot or Scaling. Please note this will fail if these properties are not animated(!!)

-- .FCurve - this returns the reference to a function curve. From here, You can clear all keys etc. specifically.FCurve.EditClear() removes all keys on that curve... You probably may want to leave one key with a still value, or set this value manually in a property.

-- and if You continue in the statement, so .Keys returns an array of all keys in the curve. You can alter them as needed. Keys[0] returns the first key structure, Keys[1] next, Keys[-1] is the last one etc. - these are of FBFCurveKey class.


also, You can make the property static, not animated...
objectreference.Translation.SetAnimated(False) - this kills all keys on all XYZ curves of translation. Use objref.Rotation or .Scaling for other curves.

 

Regards,
Stepan

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report