Community
import maya.cmds as cmds
# Non-Weighted Tangents. This is depends on preferences.
cmds.keyTangent(e = True, wt = False)
# set to Weighted Tangents.
cmds.keyTangent(e = True, wt = True)
# set to Non-Weighted Tangents, False.
if cmds.keyTangent(q = True, wt = True):
cmds.keyTangent(e = True, wt = False)
# toggle Weighted Tangents.
else:
cmds.keyTangent(e = True, wt = True)
Solved! Go to Solution.
Solved by Kahylan. Go to Solution.
import maya.cmds as cmds
# Toggle Weighted Tangent, Non-Weighted Tangents.
cmds.keyTangent(e = True, wt = not(cmds.keyTangent(q = True, wt = True)[0]))
"""
There are other suggested codes.
"""
import maya.cmds as cmds
selectedCurves = cmds.keyframe(q=True,name = True,selected = True) or []
for selectedCurve in selectedCurves:
cmds.keyTangent(selectedCurve,e = True,wt = not(cmds.keyTangent(selectedCurve,q = True, wt = True)[0]))
Hi!
Your code works for me. Could it be that you left lines 2-8 in so you automatically set it to weighted before the if statement every time?
import maya.cmds as cmds
# set to Non-Weighted Tangents, False.
if cmds.keyTangent(q = True, wt = True) == [True]:
cmds.keyTangent(e = True, wt = False)
# toggle Weighted Tangents.
else:
cmds.keyTangent(e = True, wt = True)
Can't find what you're looking for? Ask the community or share your knowledge.