Skip to content

Instantly share code, notes, and snippets.

@splinecraft
Created September 7, 2016 18:36
Show Gist options
  • Save splinecraft/3b2f693343d37054d18a49694e8591fa to your computer and use it in GitHub Desktop.
Save splinecraft/3b2f693343d37054d18a49694e8591fa to your computer and use it in GitHub Desktop.
Maya animation hotkeys
#--------------------------------------------------------------------------------------#
# sharpen in tangent
import pymel.core as pm
pm.keyTangent(edit=True, weightLock=False, lock=False, inWeight=.01)
# sharpen out tangent
import pymel.core as pm
pm.keyTangent(edit=True, weightLock=False, lock=False, outWeight=.01)
#--------------------------------------------------------------------------------------#
# toggle graph editor inifinity display on/off
import pymel.core as pm
if pm.animCurveEditor('graphEditor1GraphEd', exists=True):
ge = 'graphEditor1GraphEd'
if pm.animCurveEditor(ge, q=True, displayInfinities=True):
pm.animCurveEditor(ge, edit=True, displayInfinities='off')
else:
pm.animCurveEditor(ge, edit=True, displayInfinities='on')
#--------------------------------------------------------------------------------------#
# Various paste options
# paste keys insert at current frame
import pymel.core as pm
current_frame = pm.getCurrentTime()
pm.pasteKey(option='insert', connect=True, time=(current_frame,))
# paste keys replace completely
import pymel.core as pm
pm.pasteKey(option='replaceCompletely')
# paste keys replace connect (replace but at the starting value of the pasted over curve
import pymel.core as pm
pm.pasteKey(option='replace', connect=True)
# paste keys merge at current frame
import pymel.core as pm
current_frame = pm.getCurrentTime()
pm.pasteKey(option='merge', time=(current_frame,))
#--------------------------------------------------------------------------------------#
# Show only polygons
import pymel.core as pm
activeView = pm.getPanel(withFocus=True)
pm.modelEditor(activeView, edit=True, allObjects=False)
pm.modelEditor(activeView, edit=True, polymeshes=True)
# *** saved above to file so for use:
import show_only_polys
reload(show_only_polys)
#--------------------------------------------------------------------------------------#
# check scene framerate
import pymel.core as pm
current_framerate = pm.currentUnit(q=True, time=True)
if current_framerate != 'ntsc':
pm.confirmDialog( title='Framerate Warning', icon='warning', message='Framerate not set to 30fps!', button=['Ok'])
#--------------------------------------------------------------------------------------#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment