Go to: Synopsis. Return value. Keywords. Related. Flags. Python examples.
lockNode([ignoreComponents=boolean], [lock=boolean], [lockUnpublished=boolean])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
lockNode is undoable, queryable, and NOT editable.
Locks or unlocks one or more dependency nodes. A locked node is restricted in the following ways:
Note that an unlocked attribute of a locked node may still have its value set, or connections to it made or broken. For more information on attribute locking, see the setAttr command.
If no node names are specified then the current selection list is used.
There are a few special behaviors when locking containers. Containers are automatically expanded to their constituent objects. When a container is locked, members of the container may not be unlocked and the container membership may not be modified. Containers may also be set to lock unpublished attributes. When in this state, unpublished member attributes may not have existing connections broken, new connections cannot be made, and values on unconnected attributes may not be modified. Parenting is allowed to change on members of locked containers that have been published as parent or child anchors.
boolean[] | For query execution. |
In query mode, return type is based on queried flag.
Long name (short name) | Argument types | Properties | ||
---|---|---|---|---|
lock(l)
|
boolean
|
![]() ![]() |
||
|
||||
ignoreComponents(ic)
|
boolean
|
![]() ![]() |
||
|
||||
lockUnpublished(lu)
|
boolean
|
![]() ![]() |
||
|
![]() |
![]() |
![]() |
![]() |
import maya.cmds as cmds # create a sphere, lock it, then try to delete it. cmds.sphere( n='sphere1' ) cmds.lockNode( 'sphere1' ) cmds.delete( 'sphere1' ) # Error: Cannot delete locked nodes. # Unlock the sphere, then it can be deleted. cmds.lockNode( 'sphere1', lock=False ) cmds.delete( 'sphere1' )