Skip to content

Instantly share code, notes, and snippets.

@splinecraft
Created January 9, 2019 01:35
Show Gist options
  • Save splinecraft/ceb752a449f70704066e6d52771d4ba4 to your computer and use it in GitHub Desktop.
Save splinecraft/ceb752a449f70704066e6d52771d4ba4 to your computer and use it in GitHub Desktop.
inverts selected keyframe values (* -1)
import maya.cmds as cmds
curves = cmds.keyframe(q=True, sl=True, n=True)
if curves:
for curve in curves:
key_times = cmds.keyframe(curve, q=True, sl=True, tc=True)
key_vals = cmds.keyframe(curve, q=True, sl=True, vc=True)
for i, frame in enumerate(key_times):
cmds.keyframe(curve, e=True, time=(frame,frame), absolute=True, vc=(key_vals[i]*-1))
else:
cmds.warning('No keys selected')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment