def main(selectedChannels=True, transformsOnly=False, excludeChannels=None):
'''
Resets selected channels in the channel box to default, or if nothing's
selected, resets all keyable channels to default.
'''
gChannelBoxName = mm.eval('$temp=$gChannelBoxName')
sel = mc.ls(sl=True)
if not sel:
return
if excludeChannels and not isinstance(excludeChannels, (list, tuple)):
excludeChannels = [excludeChannels]
chans = None
if selectedChannels:
chans = mc.channelBox(gChannelBoxName, query=True, sma=True)
testList = ['translateX','translateY','translateZ','rotateX','rotateY','rotateZ','scaleX','scaleY','scaleZ',
'tx','ty','yz','rx','ry','rz','sx','sy','sz']
for obj in sel:
attrs = chans
if not chans:
attrs = mc.listAttr(obj, keyable=True, unlocked=True)
if excludeChannels:
attrs = [x for x in attrs if x not in excludeChannels]
if transformsOnly:
attrs = [x for x in attrs if x in testList]
if attrs:
for attr in attrs:
try:
default = mc.attributeQuery(attr, listDefault=True, node=obj)[0]
mc.setAttr(obj+'.'+attr, default)
except StandardError:
pass
utl.deselectChannels()
评论列表
文章目录