Skip to content

Commit 0105eee

Browse files
committed
remove batchmode only code
don't actually use MAYA_LOCATION in Unity batch commands, so remove it
1 parent 6e4fe01 commit 0105eee

File tree

1 file changed

+2
-71
lines changed

1 file changed

+2
-71
lines changed

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 2 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -348,80 +348,11 @@ class IntegrationsUI
348348
#endif
349349
;
350350

351-
/// <summary>
352-
/// Find the Maya installation that has your desired version, or
353-
/// the newest version if the 'desired' is an empty string.
354-
///
355-
/// If MAYA_LOCATION is set, the desired version is ignored.
356-
/// </summary>
357-
public static string GetMayaLocation(string desiredVersion = "") {
358-
359-
// if there is UI (i.e. we aren't in batchmode), then pop up a dialog
360-
// for the Maya location
361-
if(UnityEditorInternal.InternalEditorUtility.isHumanControllingUs
362-
&& !UnityEditorInternal.InternalEditorUtility.inBatchMode){
363-
364-
return EditorUtility.OpenFolderPanel ("Select Maya Root Folder", DefaultAdskRoot, "");
365-
}
366-
367-
// If the location is given by the environment, use it.
368-
var location = System.Environment.GetEnvironmentVariable ("MAYA_LOCATION");
369-
if (!string.IsNullOrEmpty(location)) {
370-
location = location.TrimEnd('/');
371-
Debug.Log("Using maya set by MAYA_LOCATION: " + location);
372-
return location;
373-
}
374-
375-
// List that directory and find the right version:
376-
// either the newest version, or the exact version we wanted.
377-
string mayaRoot = "";
378-
string bestVersion = "";
379-
var adskRoot = new System.IO.DirectoryInfo(DefaultAdskRoot);
380-
foreach(var productDir in adskRoot.GetDirectories()) {
381-
var product = productDir.Name;
382-
383-
// Only accept those that start with 'maya' in either case.
384-
if (!product.StartsWith("maya", StringComparison.InvariantCultureIgnoreCase)) {
385-
continue;
386-
}
387-
// Reject MayaLT -- it doesn't have plugins.
388-
if (product.StartsWith("mayalt", StringComparison.InvariantCultureIgnoreCase)) {
389-
continue;
390-
}
391-
// Parse the version number at the end. Check if it matches,
392-
// or if it's newer than the best so far.
393-
string thisNumber = product.Substring("maya".Length);
394-
if (thisNumber == desiredVersion) {
395-
mayaRoot = product;
396-
bestVersion = thisNumber;
397-
break;
398-
} else if (thisNumber.CompareTo(bestVersion) > 0) {
399-
mayaRoot = product;
400-
bestVersion = thisNumber;
401-
}
402-
}
403-
if (!string.IsNullOrEmpty(desiredVersion) && bestVersion != desiredVersion) {
404-
throw new Integrations.MayaException(string.Format(
405-
"Unable to find maya {0} in its default installation path. Set MAYA_LOCATION.", desiredVersion));
406-
} else if (string.IsNullOrEmpty(bestVersion)) {
407-
throw new Integrations.MayaException(string.Format(
408-
"Unable to find any version of maya. Set MAYA_LOCATION."));
409-
}
410-
411-
location = DefaultAdskRoot + "/" + mayaRoot;
412-
if (string.IsNullOrEmpty(desiredVersion)) {
413-
Debug.Log("Using latest version of maya found in: " + location);
414-
} else {
415-
Debug.Log(string.Format("Using maya {0} found in: {1}", desiredVersion, location));
416-
}
417-
return location;
418-
}
419-
420351
/// <summary>
421352
/// The path of the Maya executable.
422353
/// </summary>
423-
public static string GetMayaExe (string desiredVersion = "") {
424-
var location = GetMayaLocation (desiredVersion);
354+
public static string GetMayaExe () {
355+
var location = EditorUtility.OpenFolderPanel ("Select Maya Root Folder", DefaultAdskRoot, "");
425356
if (string.IsNullOrEmpty(location)) {
426357
return null;
427358
}

0 commit comments

Comments
 (0)