def locked_attr(*args):
"""
creates a locked attr (I use as a separator). Uses the long name as the nice name (literal name in channel box)
"""
attrName = cmds.textFieldButtonGrp(widgets["lockAttrTFBG"], q=True, tx=True)
if attrName:
sel = cmds.ls(sl=True)
if sel:
for obj in sel:
try:
cmds.addAttr(obj, ln=attrName, nn=attrName, at="enum", en="-----", k=True)
cmds.setAttr("%s.%s" % (obj, attrName), l=True)
except:
cmds.warning("Failed to add %s to %s, skipping!" % (attrName, obj))
else:
cmds.warning("Please select some objects to add attr to!")
else:
cmds.warning("Please enter a name for the attr!")
评论列表
文章目录