Skip to content

Instantly share code, notes, and snippets.

@Onefabis
Created October 9, 2015 13:36
Show Gist options
  • Save Onefabis/0c061f1ed3e0cfa57c0a to your computer and use it in GitHub Desktop.
Save Onefabis/0c061f1ed3e0cfa57c0a to your computer and use it in GitHub Desktop.
Frames all objects in active window inside maya
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)
pc.selectKey(clear=1)
pc.selectKey(graphEditorSelection,add=1,k=1,t=(str(fsfr) + ":" + str(lsfr)))
elif(pann == 'hyperGraphPanel1' or pann == 'hyperGraphPanel2'):
pc.hyperGraph(pann+'HyperGraphEd',e=1,fg=1)
elif(pann == 'hyperShadePanel1'):
mel.eval('hyperShadePanelMenuCommand("hyperShadePanel1", "frameAll");')
else:
pc.viewFit(all=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment