AREA forums upgrade
Read more about the planned upgrade of our forums
  • 1/3
You are here: Forum Home / Autodesk® MotionBuilder® / Python / How to verify if a RigidBody exists?
IMPORTANT ANNOUNCEMENT ABOUT AREA FORUMS
  RSS 2.0 ATOM  

How to verify if a RigidBody exists?
Rate this thread
 
64824
 
Permlink of this thread  
avatar
  • Total Posts: 1
  • Joined: 28 February 2012 09:48 AM

Hello, I’m new to python and I’ve been ask at work to make a script which is supposed to save us a lot of time cleaning Mocap captures.

I got my code working pretty well. The idea is to get a list of components which have the FBModelMarkerOptical class, and then for each one of those, get it’s RigidBody and work with it.

The problem is that MotionBuilder crashes when it finds a component which DOESN’t have a RigidBody, and I don’t really know how to ask if it has one.

My code looks like this:

if lMarker and lMarker.ClassName() == "FBModelMarkerOptical":
    
RigidObject lMarker.GetRigidBody()
    
RigidObject.Done False
    RigidObject
.Done True

Earlier today, I tried with if lMarker.GetRigidBody().IsValid(): but it’s still crashing when it finds a component without RigidBody.

How can I check if it has a RigidBody and then set RigidObject?

Thanks very much!



Replies: 0