Created
October 9, 2015 13:23
-
-
Save Onefabis/070bbbdf47489f1947a8 to your computer and use it in GitHub Desktop.
frames selected in maya in a "right" way :)
This file contains hidden or 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 pymel.core as pc | |
pann = pc.getPanel(wf=1) | |
if (pann == 'graphEditor1'): | |
fsfr = pc.findKeyframe(ts=1, w='first') | |
lsfr = pc.findKeyframe(ts=1, w='last') | |
graphEditorSelection = pc.selectionConnection('graphEditor1FromOutliner',q=1,obj=1) | |
st = pc.playbackOptions(q=1,minTime=1) | |
en = pc.playbackOptions(q=1,maxTime=1) | |
if (fsfr>st): | |
st=fsfr | |
if (lsfr<en): | |
en=lsfr | |
massran = pc.keyframe(graphEditorSelection,time=(str(st)+":"+str(en)),q=1,vc=1) | |
if(massran and max(massran)-min(massran)!=0): | |
pc.animView('graphEditor1GraphEd',st=(st - (en-st)*0.04),et=(en + (en-st)*0.04),min=(min(massran)-(0.06*(max(massran)-min(massran)))),max=(max(massran)+(0.06*(max(massran)-min(massran))))) | |
elif(massran and max(massran)-min(massran)==0): | |
pc.animView('graphEditor1GraphEd',st=(st - (en-st)*0.04),et=(en + (en-st)*0.04),min=(min(massran)-(0.06)),max=(max(massran)+(0.06))) | |
elif(pann == 'hyperGraphPanel1' or pann == 'hyperGraphPanel2'): | |
pc.hyperGraph(pann+'HyperGraphEd',e=1,fr=1) | |
elif(pann == 'hyperShadePanel1'): | |
mel.eval('hyperShadePanelMenuCommand("hyperShadePanel1", "frameSelected");') | |
else: | |
pc.viewFit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment