Skip to content

Instantly share code, notes, and snippets.

@splinecraft
Created October 24, 2019 22:27
Show Gist options
  • Save splinecraft/c5fbd8453079304be1bbd75936a326f5 to your computer and use it in GitHub Desktop.
Save splinecraft/c5fbd8453079304be1bbd75936a326f5 to your computer and use it in GitHub Desktop.
from animstate discord
import maya.cmds as mc
import maya.mel as mm
def toggleMayaWindows(key):
# use toggleMayaWindows("GraphEditor"), toggleMayaWindows("DopeSheet"), etc
windDict = {"DopeSheet": ["dopeSheetPanel1Window", "DopeSheetEditor"],
"GraphEditor": ["graphEditor1Window", "GraphEditor"],
"TraxEditor": ["clipEditorPanel1Window", "CharacterAnimationEditor"],
"HyperShade": ["hyperShadePanel1Window", "HypershadeWindow"],
"Outliner": ["outlinerPanel1Window", "OutlinerWindow"],
"ScriptEditor": ["scriptEditorPanel1Window", "ScriptEditor"],
"ReferenceEditor": ["referenceEditorPanel1Window", "ReferenceEditor"],
"NodeEditor": ["nodeEditorPanel1Window", "NodeEditorWindow"],
"TimeEditor": ["timeEditorPanel1Window", "TimeEditorWindow"]}
if key in windDict:
v = windDict[key]
if mc.window(v[0], exists=True):
mc.deleteUI(v[0])
else:
mm.eval(v[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment