|
1 | 1 | -- MacroScripts that will perform actions
|
2 |
| -macroScript Import category:"Unity" |
| 2 | +macroScript UnityImport category:"File-Import" |
3 | 3 | (
|
4 | 4 | origObjects = #()
|
5 | 5 |
|
@@ -45,11 +45,7 @@ macroScript Import category:"Unity"
|
45 | 45 | callbacks.removeScripts #postImport id:#unityPlugin
|
46 | 46 | )
|
47 | 47 | )
|
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" |
53 | 49 | (
|
54 | 50 | fn loadUnityFbxExportSettings = (
|
55 | 51 | fbxExportSettings = getINISetting (GetMAXIniFile()) "Unity" "UnityFbxExportSettings"
|
@@ -88,35 +84,36 @@ macroScript Export category:"Unity"
|
88 | 84 | )
|
89 | 85 |
|
90 | 86 | -- 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 |
94 | 92 | (
|
95 | 93 | id = genClassID returnValue:true
|
96 | 94 | if menuMan.registerMenuContext id[1] then
|
97 | 95 | (
|
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 |
110 | 99 |
|
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 |
114 | 103 |
|
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 |
118 | 106 | menuMan.updateMenuBar() --update the menu bar
|
119 | 107 | )
|
120 | 108 | )
|
121 | 109 | -- 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