29
29
# User Interface
30
30
# ======================================================================'
31
31
32
- kMainWndMenuName = 'UnityOneClick'
33
- kMainWndMenuLabel = 'Unity'
34
32
kMayaVersionAdded = '2017'
33
+ kMenuName = 'UnityOneClick'
34
+ kMenuDivider = 'UnityOneClickDivider'
35
+ kMenuLabel = 'UNITY'
36
+ kMenuInsertAfter = 'exportActiveFileOptions'
35
37
36
38
def register (pluginFn ):
37
39
"""
@@ -51,20 +53,31 @@ def unregister(pluginFn):
51
53
52
54
return
53
55
56
+ def getParentMenu ():
57
+ result = maya .mel .eval ('$tempVar = $gMainFileMenu;' )
58
+ maya .mel .eval ("buildFileMenu" )
59
+ return result
60
+
54
61
def installMenu ():
55
62
"""
56
63
install menu into main window
57
64
@ingroup UnityUI
58
65
"""
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
66
+ parentMenu = getParentMenu ()
67
+
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 )
70
+
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 )
63
74
64
75
def uninstallMenu ():
65
76
"""
66
77
uninstall the unityOneClick menu from main window
67
78
@ingroup UnityUI
68
79
"""
69
- if maya .cmds .menu (kMainWndMenuName , exists = True ): # @UndefinedVariable
70
- maya .cmds .deleteUI (kMainWndMenuName , menu = True ) # @UndefinedVariable
80
+ if maya .cmds .menu (kMenuName , exists = True ): # @UndefinedVariable
81
+ maya .cmds .deleteUI (kMenuDivider , menuItem = True )
82
+ maya .cmds .deleteUI (kMenuName , menuItem = True )
83
+ maya .cmds .deleteUI (kMenuName , menu = True ) # @UndefinedVariable
0 commit comments