-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuserSetup.py
62 lines (49 loc) · 2 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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# -----------------------------------------------------------------------------------
# DL_Maya_Toolkit
# Version: v01.0
# Author: Danilo de Lucio
# Website: www.danilodelucio.com
# -----------------------------------------------------------------------------------
# -----------------------------------------------------------------------------------
# [Summary]
# This tool is a collection of simple features to help 3D modellers
# in Maya speed up their workflows.
# -----------------------------------------------------------------------------------
import sys
import importlib
import maya.cmds as cmds
DLMT_NAME = "DL_Maya_Toolkit"
DLMT_TOOL = "D:\\Dropbox\\DEV\\DL_Maya_Toolkit"
DLMT_ICON = DLMT_TOOL + "\\dlmt\\img\\dl_maya_toolkit_icon_shelf.png"
DLMT_CMD = """import sys
if 'dl_maya_toolkit' not in sys.modules:
import importlib
from dlmt import dl_maya_toolkit
importlib.reload(dl_maya_toolkit)
ui = dl_maya_toolkit.DlMayaToolkit()
ui.show()
"""
DLMT_INIT = """\n// DL Maya Toolkit v01.0, built in June 2024.
// Copyright (c) 2024 Danilo de Lucio. All Rights Reserved. | www.danilodelucio.com
"""
# Add the module path to the Maya's environment
if DLMT_TOOL not in sys.path:
sys.path.append(DLMT_TOOL)
print(f"- The module path has been added: {DLMT_TOOL}")
try:
from dlmt import dl_maya_toolkit
importlib.reload(dl_maya_toolkit)
print("- Module imported and reloaded successfully!")
except ImportError as e:
print(f"Error importing module: {e}")
def create_dlmt_shelf():
# Check if the shelf exists, if not create it
if not cmds.shelfLayout(DLMT_NAME, exists=True):
cmds.shelfLayout(DLMT_NAME, parent="ShelfLayout")
cmds.shelfButton(label=DLMT_NAME, command=DLMT_CMD, image=DLMT_ICON, parent=DLMT_NAME)
print(f"- The shelf {DLMT_NAME} has been created!")
print(DLMT_INIT)
else:
print(DLMT_INIT)
cmds.evalDeferred(create_dlmt_shelf)
####################################### END OF DL_MAYA_TOOLKIT #######################################