PDA

View Full Version : applying a pose to a control regardless of namespace


Domo_Digital
10-20-2010, 08:15 PM
I'm using a script called pose2shelf Ive stored a pose on my "bad ass guy" (not the actual name but, I cant use the characters actual name)

it makes a line of code for each finger. here is one of the lines.

catch (`setAttr "badassguyB:l_hand_ctrl.pinky_cup" 0`);

then theres one per finger, (index_cup etc.)

NOW what I want to do is apply this pose to the current badassguy I have selected, be it B, C, D or so on.

Is there a way to apply this pose to whatever is selected, instead of limiting it to the character is was created on?
This script saves poses for single characters. Im populating a scene with many different characters all using the same rig. The names change from A to B to C etc. Id like to be able to apply the pose to whatever character I have selected I was thinking all I would do is change badassguyB to "." and it would do it, but honestly when it comes to MEL I know next to nothing....but Im learning!

What I want ideally is to apply the pose to whatever control is selected, on whichever baddassguy i have selected.

hope this makes sense...

jschieck
10-20-2010, 09:05 PM
yea you could just find the namespace on the selected controller. so something simple like...
string $sel[] = `ls -sl`;
string $temp[];
tokenize $sel[0] ":" $temp;
string $namespace = $temp[0];
catch (`setAttr ($namespace+":l_hand_ctrl.pinky_cup") 0`);

JayG
10-21-2010, 12:40 AM
You could also use:

ls -recursive 1 $yourObjectWithNoNamespace
This returns an array of all the objects in the scene with that name. So if you had

RigA:l_hand_ctrl and RigB:l_hand_ctrl it will return them both.

For each control, grab a list of all existing controls by that name and run your proc on them.

Domo_Digital
10-22-2010, 01:59 AM
Thanks guys!

its working wonders now!

CGTalk Moderation
10-22-2010, 01:59 AM
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.