Skip to content

Commit 1cad2be

Browse files
committed
combine FindMaxInstalls and FindMayaInstalls functions
1 parent 7b951d1 commit 1cad2be

File tree

1 file changed

+20
-40
lines changed

1 file changed

+20
-40
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 20 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -310,45 +310,21 @@ private static string GetUniqueName(string name){
310310
}
311311

312312
/// <summary>
313-
/// Find 3DsMax installations at default install path.
314-
/// Add results to given dictionary.
315-
/// </summary>
316-
private static void FindMaxInstalls(){
317-
var maxOptionName = instance.dccOptionNames;
318-
var maxOptionPath = instance.dccOptionPaths;
319-
320-
// List that directory and find the right version:
321-
// either the newest version, or the exact version we wanted.
322-
var adskRoot = new System.IO.DirectoryInfo(kDefaultAdskRoot);
323-
foreach(var productDir in adskRoot.GetDirectories()) {
324-
var product = productDir.Name;
325-
326-
// Only accept those that start with 'maya' in either case.
327-
if (!product.StartsWith("3ds max", StringComparison.InvariantCultureIgnoreCase)) {
328-
continue;
329-
}
330-
string version = product.Substring ("3ds max ".Length);
331-
maxOptionPath.Add (string.Format("{0}/{1}", productDir.FullName.Replace ("\\", "/"), "3dsmax.exe"));
332-
maxOptionName.Add (GetUniqueName("3ds Max " + version));
333-
}
334-
}
335-
336-
/// <summary>
337-
/// Find Maya installations at default install path.
313+
/// Find Maya and 3DsMax installations at default install path.
338314
/// Add results to given dictionary.
339315
///
340316
/// If MAYA_LOCATION is set, add this to the list as well.
341317
/// </summary>
342-
private static void FindMayaInstalls() {
343-
var mayaOptionName = instance.dccOptionNames;
344-
var mayaOptionPath = instance.dccOptionPaths;
318+
private static void FindDCCInstalls() {
319+
var dccOptionName = instance.dccOptionNames;
320+
var dccOptionPath = instance.dccOptionPaths;
345321

346322
// If the location is given by the environment, use it.
347323
var location = System.Environment.GetEnvironmentVariable ("MAYA_LOCATION");
348324
if (!string.IsNullOrEmpty(location)) {
349325
location = location.TrimEnd('/');
350-
mayaOptionPath.Add (GetMayaExePath (location.Replace ("\\", "/")));
351-
mayaOptionName.Add ("MAYA_LOCATION");
326+
dccOptionPath.Add (GetMayaExePath (location.Replace ("\\", "/")));
327+
dccOptionName.Add ("MAYA_LOCATION");
352328
}
353329

354330
// List that directory and find the right version:
@@ -358,16 +334,21 @@ private static void FindMayaInstalls() {
358334
var product = productDir.Name;
359335

360336
// Only accept those that start with 'maya' in either case.
361-
if (!product.StartsWith("maya", StringComparison.InvariantCultureIgnoreCase)) {
362-
continue;
337+
if (product.StartsWith ("maya", StringComparison.InvariantCultureIgnoreCase)) {
338+
// Reject MayaLT -- it doesn't have plugins.
339+
if (product.StartsWith ("mayalt", StringComparison.InvariantCultureIgnoreCase)) {
340+
continue;
341+
}
342+
string version = product.Substring ("maya".Length);
343+
dccOptionPath.Add (GetMayaExePath (productDir.FullName.Replace ("\\", "/")));
344+
dccOptionName.Add (GetUniqueName ("Maya " + version));
363345
}
364-
// Reject MayaLT -- it doesn't have plugins.
365-
if (product.StartsWith("mayalt", StringComparison.InvariantCultureIgnoreCase)) {
366-
continue;
346+
347+
if (product.StartsWith ("3ds max", StringComparison.InvariantCultureIgnoreCase)) {
348+
string version = product.Substring ("3ds max ".Length);
349+
dccOptionPath.Add (string.Format ("{0}/{1}", productDir.FullName.Replace ("\\", "/"), "3dsmax.exe"));
350+
dccOptionName.Add (GetUniqueName ("3ds Max " + version));
367351
}
368-
string version = product.Substring ("maya".Length);
369-
mayaOptionPath.Add (GetMayaExePath (productDir.FullName.Replace ("\\", "/")));
370-
mayaOptionName.Add (GetUniqueName("Maya " + version));
371352
}
372353
}
373354

@@ -404,8 +385,7 @@ public static GUIContent[] GetDCCOptions(){
404385

405386
instance.dccOptionPaths = new List<string> ();
406387
instance.dccOptionNames = new List<string> ();
407-
FindMayaInstalls ();
408-
FindMaxInstalls ();
388+
FindDCCInstalls ();
409389
}
410390

411391
// remove options that no longer exist

0 commit comments

Comments
 (0)