|
|
|
Tell us what you think of the site.
|
Autodesk Media & Entertainment User Community
|
Autodesk® 3ds Max®
|
|
Autodesk® Maya®
|
|
Autodesk® Softimage®
|
|
Autodesk® MotionBuilder®
|
|
Autodesk® Mudbox™
|
|
Autodesk® ImageModeler™
|
|
Autodesk® Sketchbook® Pro
|
|
Autodesk® Smoke on Mac®
|
|
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
|
|
|
|
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.Size= 200
nll = FBModelNull ("Nll") nll.Show = 1
nll.Size = 200
vector = FBVector3d(0, 500 ,0) nll .SetVector(vector, FBModelTransformationMatrix.kModelTranslation) FBSystem().Scene.Evaluate()
cMgr = FBConstraintManager()
#Creating a position constraint cnst = cMgr.TypeCreateConstraint(6) cnst.ReferenceAdd ( 0, mrkr ) cnst.ReferenceAdd ( 1, nll )
cnst.PropertyList.Find("Active").Data = True
Cheers,
E.
|
|
|
|
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_
|
|
|
|
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.
|
|
|
|
|
|