Skip to content

Commit cb526ef

Browse files
committed
move menu items into File Import/Export
also remove preview button
1 parent 3f87f49 commit cb526ef

File tree

1 file changed

+25
-28
lines changed

1 file changed

+25
-28
lines changed

Assets/Integrations/Autodesk/max/scripts/UnityFbxForMaxPlugin.ms

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- MacroScripts that will perform actions
2-
macroScript Import category:"Unity"
2+
macroScript UnityImport category:"File-Import"
33
(
44
origObjects = #()
55

@@ -45,11 +45,7 @@ macroScript Import category:"Unity"
4545
callbacks.removeScripts #postImport id:#unityPlugin
4646
)
4747
)
48-
macroScript Preview category:"Unity"
49-
(
50-
print "I do nothing, but I should Preview!"
51-
)
52-
macroScript Export category:"Unity"
48+
macroScript UnityExport category:"File-Export"
5349
(
5450
fn loadUnityFbxExportSettings = (
5551
fbxExportSettings = getINISetting (GetMAXIniFile()) "Unity" "UnityFbxExportSettings"
@@ -88,35 +84,36 @@ macroScript Export category:"Unity"
8884
)
8985

9086
-- Setup UI
91-
unityMenuName = "Unity"
92-
unityMenu = menuMan.findMenu unityMenuName
93-
if unityMenu == undefined do
87+
importMenuName = "File-Import"
88+
exportMenuName = "File-Export"
89+
importMenu = menuMan.findMenu importMenuName
90+
exportMenu = menuMan.findMenu exportMenuName
91+
if importMenu != undefined and exportMenu != undefined do
9492
(
9593
id = genClassID returnValue:true
9694
if menuMan.registerMenuContext id[1] then
9795
(
98-
mainMenu = menuMan.getMainMenuBar() --get the main menu bar
99-
newUnityMenu = menuMan.createMenu unityMenuName
100-
newUnitySubMenu = menuMan.createSubMenuItem unityMenuName newUnityMenu --create a SubMenuItem
101-
mainMenu.addItem newUnitySubMenu -1 --add the SubMenu to the end of the Main Menu
102-
103-
importAction = menuMan.createActionItem "Import" unityMenuName --create an ActionItem from the MacroScript
104-
importAction.setTitle "Import"
105-
importAction.setUseCustomTitle true
106-
107-
previewAction = menuMan.createActionItem "Preview" unityMenuName
108-
previewAction.setTitle "Preview"
109-
previewAction.setUseCustomTitle true
96+
global unityImportAction = menuMan.createActionItem "UnityImport" importMenuName --create an ActionItem from the MacroScript
97+
unityImportAction.setTitle "Import from Unity"
98+
unityImportAction.setUseCustomTitle true
11099

111-
exportAction = menuMan.createActionItem "Export" unityMenuName
112-
exportAction.setTitle "Export"
113-
exportAction.setUseCustomTitle true
100+
global unityExportAction = menuMan.createActionItem "UnityExport" exportMenuName
101+
unityExportAction.setTitle "Export to Unity"
102+
unityExportAction.setUseCustomTitle true
114103

115-
newUnityMenu.addItem importAction -1 --add the ActionItem to the menu
116-
newUnityMenu.addItem previewAction -1
117-
newUnityMenu.addItem exportAction -1
104+
importMenu.addItem unityImportAction -1 --add the ActionItem to the menu
105+
exportMenu.addItem unityExportAction -1
118106
menuMan.updateMenuBar() --update the menu bar
119107
)
120108
)
121109
-- Make sure that Menu gets removed at shutdown, force menu to reload each time Max is opened
122-
callbacks.addScript #preSavingMenus ("menu = menuMan.findMenu \"Unity\" if menu != undefined then menuMan.unregisterMenu menu")
110+
callbacks.addScript #preSavingMenus (
111+
"importMenu = menuMan.findMenu \"File-Import\"; \
112+
exportMenu = menuMan.findMenu \"File-Export\"; \
113+
if importMenu != undefined and unityImportAction != undefined then( \
114+
importMenu.removeItem unityImportAction; \
115+
) \
116+
if exportMenu != undefined and unityExportAction != undefined then( \
117+
exportMenu.removeItem unityExportAction; \
118+
)"
119+
)

0 commit comments

Comments
 (0)