def DagPathFromJoint(name, needsRest=True):
# Check for it
if not cmds.objExists(name):
# Not found in scene
return False
# Check to add
if needsRest:
# Check for the attr (to set rest pos)
if not cmds.objExists(name + ".seanimUndoT"):
# We need to setup the undo data
ResetTranslation = cmds.getAttr(name + ".t")[0]
ResetScale = cmds.getAttr(name + ".scale")[0]
ResetRotation = cmds.getAttr(name + ".jo")[0]
# Make the attributes
cmds.addAttr(name, longName="seanimUndoT", dataType="double3", storable=True)
cmds.addAttr(name, longName="seanimUndoS", dataType="double3", storable=True)
cmds.addAttr(name, longName="seanimUndoR", dataType="double3", storable=True)
# Set them
cmds.setAttr(name + ".seanimUndoT", ResetTranslation[0], ResetTranslation[1], ResetTranslation[2], type="double3")
cmds.setAttr(name + ".seanimUndoS", ResetScale[0], ResetScale[1], ResetScale[2], type="double3")
cmds.setAttr(name + ".seanimUndoR", ResetRotation[0], ResetRotation[1], ResetRotation[2], type="double3")
# Make selector
sList = OpenMaya.MSelectionList()
# Add it
sList.add(name)
# New Path
dResult = OpenMaya.MDagPath()
# Set it
sList.getDagPath(0, dResult)
# Return
return dResult
# Disconnects a MDagPath from it's input keyframes
评论列表
文章目录