-
Notifications
You must be signed in to change notification settings - Fork 1
/
install_maya.py
53 lines (42 loc) · 1.31 KB
/
install_maya.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"""
-----------------------------------------------------------------------------
This file has been developed within the scope of the
Technical Director course at Filmakademie Baden-Wuerttemberg.
http://technicaldirector.de
Written by Lukas Kapp
Copyright (c) 2023 Animationsinstitut of Filmakademie Baden-Wuerttemberg
-----------------------------------------------------------------------------
"""
import maya.cmds as cmds
import maya.mel as mel
import os
def create_shelf_button():
irm_path = os.environ.get('IRM_PATH')
if irm_path is None:
print("Environment variable not found.")
else:
print(irm_path)
button_command = f'''
import sys
from imp import reload
path = "{irm_path}
if not path in sys.path:
sys.path.append(path)
import system.irm_ui as ui
reload(ui)
'''
# Find the currently active shelf
top_shelf = mel.eval("$tempVar = $gShelfTopLevel")
active_shelf = cmds.tabLayout(top_shelf, query=True, selectTab=True)
# Create a new button in the current shelf
cmds.shelfButton(
parent=active_shelf,
command=button_command,
annotation='IRM Tool',
image1='commandButton.png', # Replace with your icon
width=10,
height=10,
label='IRM_button',
imageOverlayLabel='IRM'
)
create_shelf_button()