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
More than 1 year has passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme