Skip to content

Commit de5c2a8

Browse files
committed
Uni-24798-maya-menuitem-icons
1 parent 635c8b4 commit de5c2a8

File tree

5 files changed

+34
-4
lines changed

5 files changed

+34
-4
lines changed
777 Bytes
Loading
777 Bytes
Loading
1.42 KB
Loading

Assets/Integrations/Autodesk/maya/scripts/unityOneClick/commands.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ class BaseCommand(OpenMayaMPx.MPxCommand, LoggerMixin):
3838
"""
3939
Base class for UnityOneClick Plugin Commands.
4040
"""
41+
kDefaultIcon = 'unity_100.png'
42+
4143
def __init__(self):
4244
OpenMayaMPx.MPxCommand.__init__(self)
4345
LoggerMixin.__init__(self)
@@ -86,6 +88,14 @@ def loadUnityFbxExportSettings(self):
8688

8789
maya.mel.eval(contents)
8890
return True
91+
92+
@classmethod
93+
def iconPath(cls):
94+
return ""
95+
96+
@classmethod
97+
def familyIconPath(cls):
98+
return maya.mel.eval('$tempPath = languageResourcePath("{0}");'.format(cls.kDefaultIcon))
8999

90100
def storeAttribute(self, node, attr, attrValue, attrType="string"):
91101
if not maya.mel.eval('attributeExists "{0}" "{1}"'.format(attr, node)):

Assets/Integrations/Autodesk/maya/scripts/unityOneClick/ui.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,30 @@ def installMenu():
5656
install menu into main window
5757
@ingroup UnityUI
5858
"""
59-
maya.cmds.menu (kMainWndMenuName, parent='MayaWindow', label=kMainWndMenuLabel, tearOff=True, version=kMayaVersionAdded) # @UndefinedVariable
60-
maya.cmds.menuItem(parent=kMainWndMenuName, label=commands.importCmd.kShortLabel, command=commands.importCmd.kScriptCommand, version=kMayaVersionAdded) # @UndefinedVariable
61-
maya.cmds.menuItem(parent=kMainWndMenuName, label=commands.reviewCmd.kShortLabel, command=commands.reviewCmd.kScriptCommand, version=kMayaVersionAdded) # @UndefinedVariable
62-
maya.cmds.menuItem(parent=kMainWndMenuName, label=commands.publishCmd.kShortLabel, command=commands.publishCmd.kScriptCommand, version=kMayaVersionAdded) # @UndefinedVariable
59+
maya.cmds.menu(kMainWndMenuName,
60+
parent='MayaWindow',
61+
label=kMainWndMenuLabel, tearOff=True,
62+
version=kMayaVersionAdded,
63+
familyImage=commands.importCmd.familyIconPath)
64+
65+
maya.cmds.menuItem(parent=kMainWndMenuName,
66+
label=commands.importCmd.kShortLabel,
67+
annotation=commands.importCmd.kLabel,
68+
command=commands.importCmd.kScriptCommand,
69+
image=commands.importCmd.iconPath,
70+
version=kMayaVersionAdded)
71+
maya.cmds.menuItem(parent=kMainWndMenuName,
72+
label=commands.reviewCmd.kShortLabel,
73+
annotation=commands.reviewCmd.kLabel,
74+
command=commands.reviewCmd.kScriptCommand,
75+
image=commands.importCmd.iconPath,
76+
version=kMayaVersionAdded)
77+
maya.cmds.menuItem(parent=kMainWndMenuName,
78+
label=commands.publishCmd.kShortLabel,
79+
annotation=commands.publishCmd.kLabel,
80+
command=commands.publishCmd.kScriptCommand,
81+
image=commands.importCmd.iconPath,
82+
version=kMayaVersionAdded)
6383

6484
def uninstallMenu():
6585
"""

0 commit comments

Comments
 (0)