29
29
# User Interface
30
30
# ======================================================================'
31
31
32
- kMainWndMenuName = 'UnityOneClick'
33
- kMainWndMenuLabel = 'Unity'
32
+ kMenuName = 'UnityOneClick'
33
+ kMenuDivider = 'UnityOneClickDivider'
34
+ kMenuLabel = 'UNITY'
35
+ kMenuInsertAfter = 'exportActiveFileOptions'
34
36
35
37
def register (pluginFn ):
36
38
"""
@@ -50,20 +52,31 @@ def unregister(pluginFn):
50
52
51
53
return
52
54
55
+ def getParentMenu ():
56
+ result = maya .mel .eval ('$tempVar = $gMainFileMenu;' )
57
+ maya .mel .eval ("buildFileMenu" )
58
+ return result
59
+
53
60
def installMenu ():
54
61
"""
55
62
install menu into main window
56
63
@ingroup UnityUI
57
64
"""
58
- maya .cmds .menu (kMainWndMenuName , parent = 'MayaWindow' , label = kMainWndMenuLabel , tearOff = True ) # @UndefinedVariable
59
- maya .cmds .menuItem (parent = kMainWndMenuName , label = commands .importCmd .kShortLabel , command = commands .importCmd .kScriptCommand ) # @UndefinedVariable
60
- maya .cmds .menuItem (parent = kMainWndMenuName , label = commands .reviewCmd .kShortLabel , command = commands .reviewCmd .kScriptCommand ) # @UndefinedVariable
61
- maya .cmds .menuItem (parent = kMainWndMenuName , label = commands .publishCmd .kShortLabel , command = commands .publishCmd .kScriptCommand ) # @UndefinedVariable
65
+ parentMenu = getParentMenu ()
66
+
67
+ maya .cmds .menuItem (kMenuDivider , divider = True , longDivider = False , insertAfter = kMenuInsertAfter , parent = parentMenu )
68
+ maya .cmds .menuItem (kMenuName , parent = parentMenu , insertAfter = kMenuDivider , subMenu = True , label = kMenuLabel , tearOff = True )
69
+
70
+ maya .cmds .menuItem (parent = kMenuName , label = commands .importCmd .kShortLabel , command = commands .importCmd .kScriptCommand ) # @UndefinedVariable
71
+ maya .cmds .menuItem (parent = kMenuName , label = commands .reviewCmd .kShortLabel , command = commands .reviewCmd .kScriptCommand ) # @UndefinedVariable
72
+ maya .cmds .menuItem (parent = kMenuName , label = commands .publishCmd .kShortLabel , command = commands .publishCmd .kScriptCommand ) # @UndefinedVariable
62
73
63
74
def uninstallMenu ():
64
75
"""
65
76
uninstall the unityOneClick menu from main window
66
77
@ingroup UnityUI
67
78
"""
68
- if maya .cmds .menu (kMainWndMenuName , exists = True ): # @UndefinedVariable
69
- maya .cmds .deleteUI (kMainWndMenuName , menu = True ) # @UndefinedVariable
79
+ if maya .cmds .menu (kMenuName , exists = True ): # @UndefinedVariable
80
+ maya .cmds .deleteUI (kMenuDivider , menuItem = True )
81
+ maya .cmds .deleteUI (kMenuName , menuItem = True )
82
+ maya .cmds .deleteUI (kMenuName , menu = True ) # @UndefinedVariable
0 commit comments