the root of my problem stemmed from the fact that i wasn’t creating a relation constraint: i needed to find it in the scene and then find the boxes within it to manipulate them (when i said ‘trace through the graph’ what i meant was finding the boxes in the constraint GUI - sorry, maya hypergraph influence). all of the examples i’ve seen showed creation and manipulation, so all of the object names for the boxes and the constraint itself came for free since they are returned when everything is created.
the way i got around it was to use FBSystem().Scene and scene.Constraints to get the constraint, then constraint.Boxes to get a list of all of the boxes in the constraint… this list seems to be static, so no matter what namespace / name the box has, it’s always in the same index of the list. then, using the indices for 2 boxes, i can FBConnect / FBDisconnect. i’m not a big fan of using the indices, because they are prone to break if the constraint layout changes, but matching by name won’t work because the names change when files are merged (i.e. when you have more than 1 character in the scene). the only other option is to trace through the box connections(ie… find what box “X” is connected to, then find the next box after that), but if the box layout changes then that’s even messier to fix than an index.
so my actual connect looks like this:
if chk_posX.State:
print "tx connect"
src = FindAnimationNode(magicBoxRelationCons.Boxes[2].AnimationNodeOutGet(), 'X')
dest = FindAnimationNode(magicBoxRelationCons.Boxes[6].AnimationNodeInGet(), 'X')
FBConnect(src, dest)
else:
print "tx disconnect"
src = FindAnimationNode(magicBoxRelationCons.Boxes[2].AnimationNodeOutGet(), 'X')
dest = FindAnimationNode(magicBoxRelationCons.Boxes[6].AnimationNodeInGet(), 'X')
FBDisconnect(src, dest)
findAnimationNode is a function i grabbed from a sample that ships with mobu 2010 that takes a box and returns the handle of the desired parameter (2nd parameter)
def FindAnimationNode( pParent, pName ):
lResult = None
for lNode in pParent.Nodes:
if lNode.Name == pName:
lResult = lNode
break
return lResult
you guys from imagination studios: do you distribute python scripts for animators? if so, i’d love to ask a couple of questions about how you efficiently do it (like do you keep them on perforce or some sort of source control? do animators have to add python scripts to every scene / how do you verify that the scripts that are added to scenes are latest versions? does putting python libraries in the startup folder guarentee all of your scripts will be able to call the functions in the libraries?). aside from jason park’s master class and the area, there seems to be a real lack of motionbuilder information out there when it comes to production…