View Full Version : resetting my locator to default values with a button click?
12-05-2003, 03:04 PM
right I need a quick bit of help here. Its a simple result I need but I just haven't any idea how to do it and the programmers are up to their knees haha!
I have a locator that I'm using to control the hips and upper spine on my character. this locator is snapped to the root joint and I'm not allowed to freeze the locator so its translate values are 0, 0, 0.
So currently the default pose values are:
rotateXYZ and scaleXYZ are set at 0 and 1 respectively
Is there any way I can add an attribute that is like some kind of checkbutton. ie: I simply hit the button and it resets the values to the numbers above? I want to mel script it if possible but will settle for an alternative solution :hmm:
any help greatly appreciated
12-05-2003, 03:36 PM
I guess one solution is to store the values you want in global variables. Then create a little script that you make into a shelf button, which will plug those globals back into where ever you like...
as globals remain throughout the life of the current running instance of Maya it should work. Not an elegant solution, but a solution none the less...
the programmers are up to their knees haha!
And their knees are above their heads....
12-05-2003, 03:56 PM
cheers man but the shelf button aint really gonna help as I wanted the value to be stored in the scene. I was wondering whether a simple radio button or something could be created then I could simply hit it and it runs the expression in the scene.
at present I've simply used an empty group, snapped it to the same space, frozen it off & displayed the local axis. both my locator and this empty group are under the topgroup node so I can simply grab my locator and snap it to that local axis.
it works but it aint really what I wanna do so hey ho :bounce:
12-05-2003, 04:01 PM
in that case, how about this:
Store the original values as extra attributes in your shape (for eg orig_rotate etc).
then create a script that will copy those to the actual attributes
Is that something more to your liking?
12-05-2003, 04:17 PM
yep, thats more the kind of thing. just gotta figure out now how the hell to do it :surprised
12-05-2003, 04:42 PM
Just figured it out
I assume you have set your attribute already?
To query it simply use
that will spit out the value of the attribute
to set another use
setAttr "objectName.attributeName" value
So, technically you could get the selection (if you wanted to) with ls- sl and store that in a string array and then iterate through it to get the values and set them
for ($object in $selection)
$attribute1 = getAttr ($object + ".attribute1");
setAttribute ($object +".otherattribute") $attribute1;
<other attributes here>
 I'm unable to test this atm... sorry i can't give you more info...
does that help you?
12-05-2003, 04:53 PM
yeah I think I get it. never thought of using the getAttr and SetAttr commands so I'll have a mull over it now!
thanks for your help :bowdown:
01-16-2006, 09:00 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.