View Full Version : Asking a constraint who it's operating on?
06-22-2006, 06:21 PM
I've got a ball sitting on a bumpy plane. The ball is using both Normal and Geometry constraints so that it moves and tilts over the bumpy terrain. I'm trying to write a Mel Script that asks each of the constraints who they're operating on (in this case, the ball.) so I can select that Item. (This is just a little programming exercise for me.) I've tried:
$x =`getAttr BallConstraint.constraintGeometry` ;
Error: line 1: The data is not a numeric or string value, and cannot be displayed.
Been scratching my head over this one. Thanks, all. :)
06-22-2006, 07:26 PM
take a look at the Maya docs, the answer is in there if you look
all you have to do is list the relative of your constraint, in this case its the parent of the constraint.
listRelatives -p $nameOfConstraint;
where $nameOfConstraint is the name of the constraint node
06-22-2006, 07:36 PM
I apologize, I should have described what I'm trying to do.
I'm trying to write a script that duplicates objects that are both geometry and normal constrained to a plane. Unfortunately, my experiments with making this work haven't been all that successful. I've had to unparent the constraints from the item in order to get them to behave properly after the dupe process. But now I want to re-parent them in order to keep the scene tidy, hence why I need to know who the parent is. (And since the duplication process renames them....)
Again, sorry, I should have described this before. If you've got a solution to either the duplication-while-maintaining-constraints problem or the "who owns this constraint?" problem, I'm all ears. :)
06-22-2006, 09:55 PM
Well if you want to find the original parent. Then list the connections of the constraint as it will be connected to the objects it controls.
It will probably be best to query one of the constrained attributes with the listConnections command so you get a smaller list. The first one in the list should be the one to parent too tho.
06-22-2006, 09:55 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.