/
userSetup.py
29 lines (27 loc) · 1.18 KB
/
userSetup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import maya.cmds as cmds
import maya.mel
import os
import CM_Tools
def createShelf():
iconPath = os.path.abspath(os.path.join(os.path.dirname(CM_Tools.__file__),".."))+"/Icons/"
gShelfTopLevel = maya.mel.eval('global string $gShelfTopLevel; $temp = $gShelfTopLevel;')
cmShelf = gShelfTopLevel + '|TurboSquid'
if cmds.shelfLayout(cmShelf, exists=True):
cmds.deleteUI(cmShelf)
if not cmds.shelfLayout(cmShelf, exists=True):
cmds.setParent(gShelfTopLevel)
cmds.shelfLayout('TurboSquid')
else:
cmds.setParent(cmShelf)
if not cmds.shelfButton('CheckMate', exists=True):
checkMateButton = cmds.shelfButton('CheckMate',
label='CheckMate',
parent = 'TurboSquid',
annotation='Run the CheckMate tools on the current scene',
image1 = iconPath + 'CheckMatePro.png',
command='from CM_Tools import SystemFile;reload(SystemFile);SystemFile.SystemClass()'
)
print checkMateButton
cmds.shelfTabLayout(gShelfTopLevel, e=True, st='TurboSquid')
cmds.saveAllShelves(gShelfTopLevel)
maya.utils.executeDeferred(createShelf)