def goToKeyframe(option='next', roundFrame=False, selected=False, selectKeys=False, searchHierarchy=False):
'''
'''
if option != 'next' and option != 'previous':
OpenMaya.MGlobal.displayWarning('Option argument should be "next" or "previous"')
return
if selected and selectKeys:
OpenMaya.MGlobal.displayWarning('Cannot use selectKeys flag in conjunction with selected flag.')
selectKeys = False
sel = mc.ls(sl=True)
currentTime = mc.currentTime(query=True)
time = currentTime
if not sel:
if option == 'next':
time+=1
elif option == 'previous':
time-=1
else:
return
#if nothing is selected, just go to the next or previous keyframe
with utl.SkipUndo():
mc.currentTime(time)
return
keySel = utl.KeySelection()
if searchHierarchy:
#if we're looking through the hierarchy,
keySel.keyedInHierarchy()
else:
#create the keySelection object.
#all the heavy lifting is done in ml_utilities.
if selected and keySel.selectedKeys():
pass
if keySel.visibleInGraphEditor():
pass
if keySel.selectedObjects():
pass
time = keySel.findKeyframe(which=option, roundFrame=roundFrame, loop=True)
if selectKeys:
mc.selectKey(keySel.curves, time=(time,))
#finally, set the time without adding to the undo queue
with utl.SkipUndo():
mc.currentTime(time, edit=True)
评论列表
文章目录