Skip to content

Commit 868deb3

Browse files
committed
attach exe to path
1 parent e05e53e commit 868deb3

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ private static System.Collections.Generic.Dictionary<string, string> FindMayaIns
214214
var location = System.Environment.GetEnvironmentVariable ("MAYA_LOCATION");
215215
if (!string.IsNullOrEmpty(location)) {
216216
location = location.TrimEnd('/');
217-
mayaAppOptions.Add (location, "MAYA_LOCATION");
217+
mayaAppOptions.Add (GetMayaExePath(location.Replace("\\","/")), "MAYA_LOCATION");
218218
}
219219

220220
// List that directory and find the right version:
@@ -231,11 +231,37 @@ private static System.Collections.Generic.Dictionary<string, string> FindMayaIns
231231
if (product.StartsWith("mayalt", StringComparison.InvariantCultureIgnoreCase)) {
232232
continue;
233233
}
234-
mayaAppOptions.Add (productDir.FullName, product);
234+
mayaAppOptions.Add (GetMayaExePath(productDir.FullName.Replace("\\","/")), product);
235235
}
236236
return mayaAppOptions;
237237
}
238238

239+
/// <summary>
240+
/// Gets the maya exe at Maya install location.
241+
/// </summary>
242+
/// <returns>The maya exe path.</returns>
243+
/// <param name="location">Location of Maya install.</param>
244+
private static string GetMayaExePath(string location)
245+
{
246+
#if UNITY_EDITOR_OSX
247+
// MAYA_LOCATION on mac is set by Autodesk to be the
248+
// Contents directory. But let's make it easier on people
249+
// and allow just having it be the app bundle or a
250+
// directory that holds the app bundle.
251+
if (location.EndsWith(".app/Contents")) {
252+
return location + "/MacOS/Maya";
253+
} else if (location.EndsWith(".app")) {
254+
return location + "/Contents/MacOS/Maya";
255+
} else {
256+
return location + "/Maya.app/Contents/MacOS/Maya";
257+
}
258+
#elif UNITY_EDITOR_LINUX
259+
return location + "/bin/maya";
260+
#else // WINDOWS
261+
return location + "/bin/maya.exe";
262+
#endif
263+
}
264+
239265
public static GUIContent[] GetMayaOptions(){
240266
if (instance.mayaAppOptions == null) {
241267
instance.mayaAppOptions = FindMayaInstalls ();

0 commit comments

Comments
 (0)