Created
March 6, 2017 17:14
-
-
Save benmorgantd/5cfed8faa89023e24043fbdf79a7a68a to your computer and use it in GitHub Desktop.
Useful for when you want to set Maya SDK values to work beyond their keyed amount.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import maya.cmds as cmds | |
def setInfinite(): | |
# get active attr in graph editor | |
activeAttr = cmds.animCurveEditor("graphEditor1GraphEd",q=1,cs=1) | |
if activeAttr: | |
for spline in activeAttr: | |
objName = spline[0:spline.index("_")] | |
attr = spline[spline.index("_")+1:] | |
keyAmt = cmds.keyframe(objName + "." + attr, q=1, keyframeCount = 1) | |
# set first and last key to Clamped in and out tangents | |
cmds.selectKey(spline,f=(0,0)) | |
cmds.keyTangent(itt="clamped",ott="clamped") | |
cmds.selectKey(spline,f=(keyAmt-1,keyAmt-1)) | |
cmds.keyTangent(itt="clamped",ott="clamped") | |
cmds.setInfinity(objName + "." + attr,pri="linear") | |
cmds.setInfinity(objName + "." + attr,poi="linear") | |
setInfinite() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment