Skip to content

Commit 68ae78d

Browse files
authored
Merge pull request #135 from Unity-Technologies/Uni-24798-maya-menuitem-icons
Uni-24798-maya-menuitem-icons
2 parents ef2f064 + b286fb4 commit 68ae78d

File tree

5 files changed

+42
-5
lines changed

5 files changed

+42
-5
lines changed
777 Bytes
Loading
1.4 KB
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: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,39 @@ def installMenu():
6565
"""
6666
parentMenu = getParentMenu()
6767

68-
maya.cmds.menuItem(kMenuDivider, divider=True, longDivider=False, insertAfter=kMenuInsertAfter, parent=parentMenu, version=kMayaVersionAdded)
69-
maya.cmds.menuItem(kMenuName, parent=parentMenu, insertAfter=kMenuDivider, subMenu=True, label=kMenuLabel, tearOff=True, version=kMayaVersionAdded)
68+
maya.cmds.menuItem(kMenuDivider,
69+
divider=True,
70+
longDivider=False,
71+
insertAfter=kMenuInsertAfter,
72+
parent=parentMenu,
73+
version=kMayaVersionAdded)
74+
maya.cmds.menuItem(kMenuName,
75+
parent=parentMenu,
76+
insertAfter=kMenuDivider,
77+
image=commands.importCmd.familyIconPath(),
78+
subMenu=True,
79+
label=kMenuLabel,
80+
tearOff=True,
81+
version=kMayaVersionAdded)
7082

71-
maya.cmds.menuItem(parent=kMenuName, label=commands.importCmd.kShortLabel, command=commands.importCmd.kScriptCommand, version=kMayaVersionAdded)
72-
maya.cmds.menuItem(parent=kMenuName, label=commands.reviewCmd.kShortLabel, command=commands.reviewCmd.kScriptCommand, version=kMayaVersionAdded)
73-
maya.cmds.menuItem(parent=kMenuName, label=commands.publishCmd.kShortLabel, command=commands.publishCmd.kScriptCommand, version=kMayaVersionAdded)
83+
maya.cmds.menuItem(parent=kMenuName,
84+
label=commands.importCmd.kShortLabel,
85+
annotation=commands.importCmd.kLabel,
86+
command=commands.importCmd.kScriptCommand,
87+
image=commands.importCmd.iconPath(),
88+
version=kMayaVersionAdded)
89+
maya.cmds.menuItem(parent=kMenuName,
90+
label=commands.reviewCmd.kShortLabel,
91+
annotation=commands.reviewCmd.kLabel,
92+
command=commands.reviewCmd.kScriptCommand,
93+
image=commands.importCmd.iconPath(),
94+
version=kMayaVersionAdded)
95+
maya.cmds.menuItem(parent=kMenuName,
96+
label=commands.publishCmd.kShortLabel,
97+
annotation=commands.publishCmd.kLabel,
98+
command=commands.publishCmd.kScriptCommand,
99+
image=commands.importCmd.iconPath(),
100+
version=kMayaVersionAdded)
74101

75102
def uninstallMenu():
76103
"""

0 commit comments

Comments
 (0)