def copyPose(fromNode, toNode, flip=False):
attrs = mc.listAttr(fromNode, keyable=True)
if not attrs:
return
#if attributes are aliased, get the real names for mirroring axis
aliases = mc.aliasAttr(fromNode, query=True)
if aliases:
for alias,real in zip(aliases[::2],aliases[1::2]):
if alias in attrs:
attrs.remove(alias)
attrs.append(real)
axis = getMirrorAxis(toNode)
for attr in attrs:
if attr == 'mirrorAxis':
continue
if not mc.attributeQuery(attr, node=toNode, exists=True):
continue
fromPlug = '{}.{}'.format(fromNode, attr)
toPlug = '{}.{}'.format(toNode, attr)
fromValue = mc.getAttr(fromPlug)
toValue = mc.getAttr(toPlug)
if attr in axis:
fromValue *= -1.0
toValue *= -1.0
try:
utl.setAnimValue(toPlug, fromValue)
except:pass
if flip:
try:
utl.setAnimValue(fromPlug, toValue)
except:pass
评论列表
文章目录