Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® MotionBuilder® / Python / 2009 Constraint Add
  RSS 2.0 ATOM  

2009 Constraint Add
Rate this thread
 
22268
 
Permlink of this thread  
avatar
  • _mg_
  • Posted: 03 February 2009 01:13 PM
  • Total Posts: 28
  • Joined: 15 December 2006 04:58 AM

Hi,

We’ve just moved on to 2009 and i’m finding that some of the scripts aren’t working. I’ve been able to resolve some of my issues, but constraints have me stumped.

Relations are working fine, but ConstraintAdd has been removed. Looking at the help file it says,

use FBScene.Constraints

In the python reference doc it says that this is a tuple. I feel a bit silly for asking this, but can someone explain how i add a constraint using this function?

Thanks
mg



Replies: 0
avatar

Hey Mike,

It doesn’t seem that your constraint needs to be registered in the FBConstraintManager manually anymore.
It’s done auto0matically when creating an FBConstraint instance.
Try the following and you will see what I mean:

mrkr FBModelMarker ("Mkr")
mrkr.Show 1
mrkr
.Size200


nll 
FBModelNull ("Nll")
nll.Show 1
nll
.Size =  200


vector 
FBVector3d(0500 ,0)
nll .SetVector(vectorFBModelTransformationMatrix.kModelTranslation)
FBSystem().Scene.Evaluate()


cMgr 
FBConstraintManager()

#Creating a position constraint
cnst cMgr.TypeCreateConstraint(6)
cnst.ReferenceAdd 0mrkr )    
cnst.ReferenceAdd 1nll )    


cnst.PropertyList.Find("Active").Data True

Cheers,

E.



Replies: 0
avatar
  • _mg_
  • Posted: 04 February 2009 07:32 AM

Brilliant, thanks Eric,

So it seems that the constraint will only appear in the navigator once an object has been added to the constraint.

I was battering away at this, not taking the next step as i couldn’t get the constraint to appear as before. Doh!

_mg_



Replies: 0
avatar
  • Serguei
  • Posted: 17 February 2009 08:11 PM

There seems to be some confusion with the SDK regarding tuples.
For example:

FBScene.Constraints.append (cns)

This will add the constraint to the scene. However, according to the documentation FBScene.Constraints returns a tuple, which means the above line should’ve thrown an error seeing as how tuples have no methods. So I guess they are actually returning lists instead.



Replies: 0