0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

maya unlock all attribute

Posted at
import maya.cmds as cmds


def GetAllCurves():
    objs = []
    curves = cmds.ls(type="nurbsCurve", ni=True, o=True, r=True, l=True)
    joints = cmds.ls(type="joint", ni=True, o=True, r=True, l=True)
    for i in curves:
        objs.append(i)
    for i in joints:
        objs.append(i)
    transforms = cmds.listRelatives(objs, p=True, type="transform")
    return transforms


def UnlockAll():
    locked = []
    objs = cmds.ls()
    for obj in objs:
        attrs = cmds.listAttr(obj)
        for attr in attrs:
            try:
                attrObj = "{0}.{1}".format(obj, attr)
                if cmds.getAttr(attrObj, lock=True) == True:
                    cmds.setAttr(attrObj, lock=0)
                    locked.append(attrObj)
            except ValueError:
                continue
    print(locked)


UnlockAll()


# get a list of all objects in the scene
obj_list = cmds.ls()

# loop over each object in the list and unlock its channels
for obj in obj_list:
    attr_list = cmds.listAttr(obj, keyable=True)
    try:
        for attr in attr_list:
            try:
                cmds.setAttr(obj+"."+attr, lock=False)
            except:
                pass
    except:
        pass
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?