I’m making a custom transform plugin that when a parentConstraint is applied to it: When any of the targetWeight attributes change the command “parentConstraint -e -maintainOffset” is executed for that transform. What’s the proper way in Python to get that parentConstraint’s name and weight attributes?
Note: *the original title was originally meant to address a problem I was having with pyDev’s autocompleation feature. I figured that out already, so I changed the topic to the problem I’m dealing with now…
[QUOTE=mtuttle;10509]
Note: *the original title was originally meant to address a problem I was having with pyDev’s autocompleation feature. I figured that out already, so I changed the topic to the problem I’m dealing with now…[/QUOTE]
Thats great, except the title in the listing is still the old one.
Fixed the title- users can only change their post title, not the thread title
Here’s how I would do it in python/mel. It could get a bit trickier if you want to do it solely via python API though. You may want/need to swap “rotateOrder” for something else though, depending on your parent constraint attributes
transform = 'pCube1'
constraintNode = maya.cmds.listConnections('%s.rotateOrder' % transform, source=True)[0]
if not maya.cmds.nodeType(constraintNode) == 'parentConstraint':
raise RuntimeError('Node %s is not of type constraint' % constraintNode)
targetList = maya.cmds.parentConstraint(constraintNode, query=True, targetList=True)
weightList = maya.cmds.parentConstraint(constraintNode, query=True, weightAliasList=True)
for z, target in enumerate(targetList):
weight = maya.cmds.getAttr('%s.%s' % (constraintNode, weightList[z]))
print "%s has weight of %s" % (targetList[z], weight)
Thanks, Damon. I found a way to do this with c++ already, and when I get the time I’ll make a python version of it as well…