Maya Unlocking Node and Attributes

I downloaded a Maya file which was a 3D representation of a DIY design for something I would one day like to make one day. I wanted to change the design a bit and I didn’t feel like starting from scratch so I tried to change some things but all the properties were hidden and locked. I couldn’t move, scale rotate or delete any part of the scene objects I could only move verts, edges or faces. When I tried to unlock an Attribute it would give me an error saying that the node was locked;  “is from a locked node, so it cannot be unlocked. //”. So I went to find some codes:

Select all the obects in your scene that have a node lock.

Then open the script editor and paste this cope in and press the enter key on the numberpad or the execute button in the script editor (looks like a play button):

string $selectedObj[] = `ls -sl`;
lockNode -lock 0 $selectedObj;

This will unlock the node and allow you to unlock the attributes and unhide them. The next script will unlock and unhide all attributes for all selected objects. So again select all objects you want to do this to then copy the code and press then enter button/execute:

 

global proc msAttrUnlockUnhide_all()
{
string $selectedObj[] = `ls -sl`;
for($obj in $selectedObj)
{
string $attrList[] = `listAttr -v -l`;                // Get attributes that are visibily locked
for($attribute in $attrList)
{
setAttr -k 1 -l 0 ($obj + “.” + $attribute);    // Unhide and unlock attribute
}
/*
Set Default trans, rot, and scale attribute to unhidden and unlocked
*/
setAttr -k 1 ($obj + “.tx”);
setAttr -l 0 ($obj + “.tx”);
setAttr -k 1 ($obj + “.ty”);
setAttr -l 0 ($obj + “.ty”);
setAttr -k 1 ($obj + “.tz”);
setAttr -l 0 ($obj + “.tz”);

setAttr -k 1 ($obj + “.sx”);
setAttr -l 0 ($obj + “.sx”);
setAttr -k 1 ($obj + “.sy”);
setAttr -l 0 ($obj + “.sy”);
setAttr -k 1 ($obj + “.sz”);
setAttr -l 0 ($obj + “.sz”);

setAttr -k 1 ($obj + “.rx”);
setAttr -l 0 ($obj + “.rx”);
setAttr -k 1 ($obj + “.ry”);
setAttr -l 0 ($obj + “.ry”);
setAttr -k 1 ($obj + “.rz”);
setAttr -l 0 ($obj + “.rz”);

clear $attrList;

$attrList = `listAttr -ud`;                // Get attributes that are userdefined, hidden or not
for($attribute in $attrList)
{
setAttr -k 1 -l 0 ($obj + “.” + $attribute);    // Unhide and unlock attribute
}
clear $attrList;
}

clear  $selectedObj;
}

msAttrUnlockUnhide_all;

 

Hope this helps anyone with similar problems!

 

 

Advertisement