PDA

View Full Version : unlock Attributes


Phlok
12-02-2010, 01:10 PM
Greetings!

I just got a scene with some locked attributes I cannot unlock via the GUI. There is some MEL command for it but I cannot remember it, anymore.

In the docs, I didn't find anything useful, yet. Would anybody please be so kind to tell me that command?

Thanks in advance!

NaughtyNathan
12-02-2010, 03:30 PM
attributes:

setAttr -lock 0 node.attribute;

nodes:

lockNode -lock 0 node;

:nathaN

Geuse
12-02-2010, 03:35 PM
hm...you should be able to do it from the gui. if they are hidden you have to show them first though.
anyway this script unlocks and shows all your standard attributes aswell as any user defined

string $sel[] = `ls -long -sl`;

for($eachObj in $sel)
{

string $ud[] = `listAttr -ud $eachObj`;


setAttr -k on ($eachObj + ".tx");
setAttr -k on ($eachObj + ".ty");
setAttr -k on ($eachObj + ".tz");

setAttr -k on ($eachObj + ".rx");
setAttr -k on ($eachObj + ".ry");
setAttr -k on ($eachObj + ".rz");

setAttr -k on ($eachObj + ".sx");
setAttr -k on ($eachObj + ".sy");
setAttr -k on ($eachObj + ".sz");

setAttr -k on ($eachObj + ".v");



setAttr -l off ($eachObj + ".tx");
setAttr -l off ($eachObj + ".ty");
setAttr -l off ($eachObj + ".tz");

setAttr -l off ($eachObj + ".rx");
setAttr -l off ($eachObj + ".ry");
setAttr -l off ($eachObj + ".rz");

setAttr -l off ($eachObj + ".sx");
setAttr -l off ($eachObj + ".sy");
setAttr -l off ($eachObj + ".sz");

setAttr -l off ($eachObj + ".v");



for($each in $ud)
{
setAttr -k on ($eachObj + "." + $each);
setAttr -l off ($eachObj + "." + $each);
}

}

Phlok
12-03-2010, 11:09 AM
Thank you very much!

There's also a third alternative of doing so:

CBunlockAttr

NaughtyNathan
12-04-2010, 09:55 AM
CBunlockAttr is not a viable alternative as it is a sub-function of the ChannelBox. It is only available after you have already chosen certain commands from the Channel Box RMB pop-up menu, or unless you manually source channelBoxCommand.mel. For example, most people who try to use CBunlockAttr (or if you restart Maya and try it) will get a "Unknown function" error.

When MEL scripting you should always be very cautious of using any functions that begin with TWO (or more) capital letters as they are usually internal sub-functions that rely on other ui scripts to already be sourced. (CB___, AE___, etc...)

:nathaN

CGTalk Moderation
12-04-2010, 09:55 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.