Skip to content

Commit 0795da4

Browse files
committed
code review fixes
-add warning for max earlier than 2017 -add warning for ignoring exit code -remove iconName from macroscripts -remove if statement that could prevent menu items being added
1 parent 5ef5143 commit 0795da4

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,12 @@ public override void OnInspectorGUI() {
135135
ExportSettings.DCCType foundDCC = ExportSettings.DCCType.Maya;
136136
var foundDCCPath = TryFindDCC (dccPath, ext, ExportSettings.DCCType.Maya);
137137
if (foundDCCPath == null && Application.platform == RuntimePlatform.WindowsEditor) {
138-
foundDCCPath = TryFindDCC (dccPath, ext, ExportSettings.DCCType.Max);
139-
foundDCC = ExportSettings.DCCType.Max;
138+
if (!ExportSettings.IsEarlierThanMax2017 (dccPath)) {
139+
Debug.LogWarning ("Earlier than 3ds Max 2017 is not supported");
140+
} else {
141+
foundDCCPath = TryFindDCC (dccPath, ext, ExportSettings.DCCType.Max);
142+
foundDCC = ExportSettings.DCCType.Max;
143+
}
140144
}
141145
if (foundDCCPath == null) {
142146
Debug.LogError (string.Format ("Could not find supported DCC application at: \"{0}\"", Path.GetDirectoryName (dccPath)));
@@ -344,6 +348,10 @@ private static void FindDCCInstalls() {
344348

345349
if (product.StartsWith ("3ds max", StringComparison.InvariantCultureIgnoreCase)) {
346350
var exePath = string.Format ("{0}/{1}", productDir.FullName.Replace ("\\", "/"), "3dsmax.exe");
351+
if (!IsEarlierThanMax2017 (exePath)) {
352+
Debug.LogWarning ("Earlier than 3ds Max 2017 is not supported");
353+
continue;
354+
}
347355
string version = product.Substring ("3ds max ".Length);
348356
dccOptionPath.Add (exePath);
349357
dccOptionName.Add (GetUniqueName ("3ds Max " + version));
@@ -498,11 +506,11 @@ public static string GetMaxOptionName(string exePath){
498506
return GetUniqueName (Path.GetFileName(Path.GetDirectoryName (exePath)));
499507
}
500508

501-
public static bool IsMax2018OrLater(string exePath){
509+
public static bool IsEarlierThanMax2017(string exePath){
502510
var name = Path.GetFileName (Path.GetDirectoryName (exePath)).ToLower();
503511
name = name.Replace ("3ds max", "").Trim();
504512
int version;
505-
return int.TryParse (name, out version) && version >= 2018;
513+
return int.TryParse (name, out version) && version < 2017;
506514
}
507515

508516
public static string GetSelectedDCCPath()

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@ public static int InstallMaxPlugin(string maxExe){
534534

535535
// TODO (UNI-29910): figure out what exactly causes this exit code + how to resolve
536536
if(ExitCode == -1073740791){
537+
Debug.LogWarning(string.Format("3ds Max exited with code: {0}, ignoring as this does not affect plugin installation", ExitCode));
537538
ExitCode = 0;
538539
}
539540

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
-- MacroScripts that will perform actions
2-
macroScript UnityImport category:"Unity" iconName:"UnityIcons/import"
2+
macroScript UnityImport category:"Unity"
33
(
44
origObjects = #()
55

@@ -45,7 +45,7 @@ macroScript UnityImport category:"Unity" iconName:"UnityIcons/import"
4545
callbacks.removeScripts #postImport id:#unityPlugin
4646
)
4747
)
48-
macroScript UnityExport category:"Unity" iconName:"UnityIcons/export"
48+
macroScript UnityExport category:"Unity"
4949
(
5050
fn loadUnityFbxExportSettings = (
5151
fbxExportSettings = getINISetting (GetMAXIniFile()) "Unity" "UnityFbxExportSettings"
@@ -143,16 +143,14 @@ if (maxVersion())[1] >= 20000 then(
143143
)
144144
)
145145

146-
if foundUnityImport == false or foundUnityExport == false then(
147-
id = genClassID returnValue:true
148-
if menuMan.registerMenuContext id[1] then
149-
(
150-
global unityImportAction = createUnityImportAction unityImportTitle importMenu
151-
global unityExportAction = createUnityExportAction unityExportTitle exportMenu
152-
153-
menuMan.updateMenuBar() --update the menu bar
154-
)
155-
)
146+
id = genClassID returnValue:true
147+
if menuMan.registerMenuContext id[1] then
148+
(
149+
global unityImportAction = createUnityImportAction unityImportTitle importMenu
150+
global unityExportAction = createUnityExportAction unityExportTitle exportMenu
151+
152+
menuMan.updateMenuBar() --update the menu bar
153+
)
156154
)
157155
);
158156
setupUnityPluginUI()
@@ -169,7 +167,7 @@ if (maxVersion())[1] >= 20000 then(
169167
)"
170168
)
171169
)
172-
else(
170+
else if (maxVersion())[1] == 19000 then (
173171
-- for 3ds Max 2017
174172

175173
global unityMenuName = "Unity"
@@ -213,4 +211,7 @@ else(
213211
menuMan.unRegisterMenu unityMenu; \
214212
)"
215213
)
214+
)
215+
else(
216+
print "Warning: Unity Integration not supported for 3ds Max versions earlier than 3ds Max 2017"
216217
)

0 commit comments

Comments
 (0)