29
29
# User Interface
30
30
# ======================================================================'
31
31
32
- kMayaVersionAdded = '2017'
33
32
kMenuName = 'UnityOneClick'
34
33
kMenuDivider = 'UnityOneClickDivider'
35
34
kMenuLabel = 'UNITY'
@@ -54,10 +53,19 @@ def unregister(pluginFn):
54
53
return
55
54
56
55
def getParentMenu ():
56
+ """
57
+ Return the name of the parent menu for the Unity menu
58
+ """
57
59
result = maya .mel .eval ('$tempVar = $gMainFileMenu;' )
58
60
maya .mel .eval ("buildFileMenu" )
59
61
return result
60
62
63
+ def whatsNewVersion ():
64
+ """
65
+ Return the name of Maya version to be considered 'new' e.g. "2018"
66
+ """
67
+ return maya .cmds .about (q = True , version = True )
68
+
61
69
def installMenu ():
62
70
"""
63
71
install menu into main window
@@ -70,34 +78,34 @@ def installMenu():
70
78
longDivider = False ,
71
79
insertAfter = kMenuInsertAfter ,
72
80
parent = parentMenu ,
73
- version = kMayaVersionAdded )
81
+ version = whatsNewVersion () )
74
82
maya .cmds .menuItem (kMenuName ,
75
83
parent = parentMenu ,
76
84
insertAfter = kMenuDivider ,
77
85
image = commands .importCmd .familyIconPath (),
78
86
subMenu = True ,
79
87
label = kMenuLabel ,
80
88
tearOff = True ,
81
- version = kMayaVersionAdded )
89
+ version = whatsNewVersion () )
82
90
83
91
maya .cmds .menuItem (parent = kMenuName ,
84
92
label = commands .importCmd .kShortLabel ,
85
93
annotation = commands .importCmd .kLabel ,
86
94
command = commands .importCmd .kScriptCommand ,
87
95
image = commands .importCmd .iconPath (),
88
- version = kMayaVersionAdded )
96
+ version = whatsNewVersion () )
89
97
maya .cmds .menuItem (parent = kMenuName ,
90
98
label = commands .reviewCmd .kShortLabel ,
91
99
annotation = commands .reviewCmd .kLabel ,
92
100
command = commands .reviewCmd .kScriptCommand ,
93
101
image = commands .importCmd .iconPath (),
94
- version = kMayaVersionAdded )
102
+ version = whatsNewVersion () )
95
103
maya .cmds .menuItem (parent = kMenuName ,
96
104
label = commands .publishCmd .kShortLabel ,
97
105
annotation = commands .publishCmd .kLabel ,
98
106
command = commands .publishCmd .kScriptCommand ,
99
107
image = commands .importCmd .iconPath (),
100
- version = kMayaVersionAdded )
108
+ version = whatsNewVersion () )
101
109
102
110
def uninstallMenu ():
103
111
"""
0 commit comments