Skip to content

Commit d890833

Browse files
authored
Merge branch '0.0.14a-austin-unite-release' into Uni-26629-remove-preview
2 parents 4794830 + 2ce4c1d commit d890833

File tree

8 files changed

+510
-65
lines changed

8 files changed

+510
-65
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 57 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,17 @@ public override void OnInspectorGUI() {
114114
int oldValue = exportSettings.selectedMayaApp;
115115
exportSettings.selectedMayaApp = EditorGUILayout.Popup(exportSettings.selectedMayaApp, options);
116116
if (exportSettings.selectedMayaApp == options.Length - 1) {
117-
var ext = "exe";
118-
#if UNITY_EDITOR_OSX
119-
ext = "app";
120-
#endif
117+
var ext = "";
118+
switch(Application.platform){
119+
case RuntimePlatform.WindowsEditor:
120+
ext = "exe";
121+
break;
122+
case RuntimePlatform.OSXEditor:
123+
ext = "app";
124+
break;
125+
default:
126+
throw new NotImplementedException ();
127+
}
121128
string mayaPath = EditorUtility.OpenFilePanel ("Select Maya Application", ExportSettings.kDefaultAdskRoot, ext);
122129

123130
// check that the path is valid and references the maya executable
@@ -126,11 +133,20 @@ public override void OnInspectorGUI() {
126133
// clicked on the wrong application, try to see if we can still find
127134
// maya in this directory.
128135
var mayaDir = new DirectoryInfo(Path.GetDirectoryName(mayaPath));
129-
#if UNITY_EDITOR_OSX
130-
var files = mayaDir.GetDirectories("*." + ext);
131-
#else
132-
var files = mayaDir.GetFiles ("*." + ext);
133-
#endif
136+
137+
FileSystemInfo[] files = null;
138+
139+
switch(Application.platform){
140+
case RuntimePlatform.WindowsEditor:
141+
files = mayaDir.GetFiles ("*." + ext);
142+
break;
143+
case RuntimePlatform.OSXEditor:
144+
files = mayaDir.GetDirectories ("*." + ext);
145+
break;
146+
default:
147+
throw new NotImplementedException ();
148+
}
149+
134150
bool foundMaya = false;
135151
foreach (var file in files) {
136152
var filename = Path.GetFileNameWithoutExtension (file.Name).ToLower ();
@@ -181,15 +197,18 @@ public class ExportSettings : ScriptableSingleton<ExportSettings>
181197
/// The path where all the different versions of Maya are installed
182198
/// by default. Depends on the platform.
183199
/// </summary>
184-
public const string kDefaultAdskRoot =
185-
#if UNITY_EDITOR_OSX
186-
"/Applications/Autodesk"
187-
#elif UNITY_EDITOR_LINUX
188-
"/usr/autodesk"
189-
#else // WINDOWS
190-
"C:/Program Files/Autodesk"
191-
#endif
192-
;
200+
public static string kDefaultAdskRoot {
201+
get{
202+
switch (Application.platform) {
203+
case RuntimePlatform.WindowsEditor:
204+
return "C:/Program Files/Autodesk";
205+
case RuntimePlatform.OSXEditor:
206+
return "/Applications/Autodesk";
207+
default:
208+
throw new NotImplementedException ();
209+
}
210+
}
211+
}
193212

194213
// Note: default values are set in LoadDefaults().
195214
public bool mayaCompatibleNames;
@@ -317,23 +336,24 @@ private static void FindMayaInstalls() {
317336
/// <param name="location">Location of Maya install.</param>
318337
private static string GetMayaExePath(string location)
319338
{
320-
#if UNITY_EDITOR_OSX
321-
// MAYA_LOCATION on mac is set by Autodesk to be the
322-
// Contents directory. But let's make it easier on people
323-
// and allow just having it be the app bundle or a
324-
// directory that holds the app bundle.
325-
if (location.EndsWith(".app/Contents")) {
326-
return location + "/MacOS/Maya";
327-
} else if (location.EndsWith(".app")) {
328-
return location + "/Contents/MacOS/Maya";
329-
} else {
330-
return location + "/Maya.app/Contents/MacOS/Maya";
339+
switch (Application.platform) {
340+
case RuntimePlatform.WindowsEditor:
341+
return location + "/bin/maya.exe";
342+
case RuntimePlatform.OSXEditor:
343+
// MAYA_LOCATION on mac is set by Autodesk to be the
344+
// Contents directory. But let's make it easier on people
345+
// and allow just having it be the app bundle or a
346+
// directory that holds the app bundle.
347+
if (location.EndsWith(".app/Contents")) {
348+
return location + "/MacOS/Maya";
349+
} else if (location.EndsWith(".app")) {
350+
return location + "/Contents/MacOS/Maya";
351+
} else {
352+
return location + "/Maya.app/Contents/MacOS/Maya";
353+
}
354+
default:
355+
throw new NotImplementedException ();
331356
}
332-
#elif UNITY_EDITOR_LINUX
333-
return location + "/bin/maya";
334-
#else // WINDOWS
335-
return location + "/bin/maya.exe";
336-
#endif
337357
}
338358

339359
public static GUIContent[] GetMayaOptions(){
@@ -373,9 +393,9 @@ public static GUIContent[] GetMayaOptions(){
373393

374394
public static void AddMayaOption(string newOption){
375395
// on OSX we get a path ending in .app, which is not quite the exe
376-
#if UNITY_EDITOR_OSX
377-
newOption = GetMayaExePath(newOption);
378-
#endif
396+
if (Application.platform == RuntimePlatform.OSXEditor) {
397+
newOption = GetMayaExePath (newOption);
398+
}
379399

380400
var mayaOptionPaths = instance.mayaOptionPaths;
381401
if (mayaOptionPaths.Contains(newOption)) {

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public static string GetVersionFromReadme()
124124
}
125125

126126
try{
127-
var versionHeader = "**Version**:";
127+
var versionHeader = "VERSION:";
128128
var lines = File.ReadAllLines (absPath);
129129
foreach (var line in lines) {
130130
if (line.StartsWith(versionHeader)) {

Assets/FbxExporters/Editor/InstallIntegration.cs

Lines changed: 49 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55

66
namespace FbxExporters.Editor
77
{
8-
class Integrations
8+
public class Integrations
99
{
1010
private const string MODULE_FILENAME = "unityoneclick";
1111
private const string PACKAGE_NAME = "FbxExporters";
1212
private const string VERSION_FILENAME = "README.txt";
13-
private const string VERSION_FIELD = "**Version**";
13+
private const string VERSION_FIELD = "VERSION";
1414
private const string VERSION_TAG = "{Version}";
1515
private const string PROJECT_TAG = "{UnityProject}";
1616

@@ -20,13 +20,21 @@ class Integrations
2020

2121
private const string MODULE_TEMPLATE_PATH = "FbxExporters/Integrations/Autodesk/maya/" + MODULE_FILENAME + ".txt";
2222

23-
#if UNITY_EDITOR_OSX
24-
private const string MAYA_MODULES_PATH = "Library/Preferences/Autodesk/Maya/modules";
25-
#elif UNITY_EDITOR_LINUX
26-
private const string MAYA_MODULES_PATH = "Maya/modules";
27-
#else
28-
private const string MAYA_MODULES_PATH = "maya/modules";
29-
#endif
23+
public const string TEMP_SAVE_PATH = "_safe_to_delete";
24+
25+
26+
private static string MAYA_MODULES_PATH {
27+
get {
28+
switch (Application.platform) {
29+
case RuntimePlatform.WindowsEditor:
30+
return "maya/modules";
31+
case RuntimePlatform.OSXEditor:
32+
return "Library/Preferences/Autodesk/Maya/modules";
33+
default:
34+
throw new NotImplementedException ();
35+
}
36+
}
37+
}
3038

3139
public class MayaException : System.Exception {
3240
public MayaException() { }
@@ -36,11 +44,18 @@ public MayaException(string message, System.Exception inner) : base(message, inn
3644

3745
// Use string to define escaped quote
3846
// Windows needs the backslash
39-
#if UNITY_EDITOR_OSX || UNITY_EDITOR_LINUX
40-
private const string ESCAPED_QUOTE = "\"";
41-
#else
42-
private const string ESCAPED_QUOTE = "\\\"";
43-
#endif
47+
private static string ESCAPED_QUOTE {
48+
get {
49+
switch (Application.platform) {
50+
case RuntimePlatform.WindowsEditor:
51+
return "\\\"";
52+
case RuntimePlatform.OSXEditor:
53+
return "\"";
54+
default:
55+
throw new NotImplementedException ();
56+
}
57+
}
58+
}
4459

4560
private static string MAYA_COMMANDS { get {
4661
return string.Format("configureUnityOneClick {0}{1}{0} {0}{2}{0} {0}{3}{0} {0}{4}{0} {0}{5}{0} {6}; scriptJob -idleEvent quit;",
@@ -51,11 +66,14 @@ private static string MAYA_COMMANDS { get {
5166

5267
private static string GetUserFolder()
5368
{
54-
#if UNITY_EDITOR_OSX || UNITY_EDITOR_LINUX
55-
return System.Environment.GetEnvironmentVariable("HOME");
56-
#else
57-
return System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
58-
#endif
69+
switch (Application.platform) {
70+
case RuntimePlatform.WindowsEditor:
71+
return System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
72+
case RuntimePlatform.OSXEditor:
73+
return System.Environment.GetEnvironmentVariable("HOME");
74+
default:
75+
throw new NotImplementedException ();
76+
}
5977
}
6078

6179
public static bool IsHeadlessInstall ()
@@ -90,7 +108,7 @@ public static string GetPackagePath()
90108

91109
public static string GetTempSavePath()
92110
{
93-
return FbxExporters.Review.TurnTable.TempSavePath.Replace("\\", "/");
111+
return TEMP_SAVE_PATH.Replace("\\", "/");
94112
}
95113

96114
/// <summary>
@@ -234,13 +252,17 @@ public static int ConfigureMaya(string mayaPath)
234252
myProcess.StartInfo.CreateNoWindow = true;
235253
myProcess.StartInfo.UseShellExecute = false;
236254

237-
#if UNITY_EDITOR_OSX
238-
myProcess.StartInfo.Arguments = string.Format(@"-command '{0}'", MAYA_COMMANDS);
239-
#elif UNITY_EDITOR_LINUX
240-
throw new NotImplementedException();
241-
#else // UNITY_EDITOR_WINDOWS
242-
myProcess.StartInfo.Arguments = string.Format("-command \"{0}\"", MAYA_COMMANDS);
243-
#endif
255+
switch (Application.platform) {
256+
case RuntimePlatform.WindowsEditor:
257+
myProcess.StartInfo.Arguments = string.Format("-command \"{0}\"", MAYA_COMMANDS);
258+
break;
259+
case RuntimePlatform.OSXEditor:
260+
myProcess.StartInfo.Arguments = string.Format(@"-command '{0}'", MAYA_COMMANDS);
261+
break;
262+
default:
263+
throw new NotImplementedException ();
264+
}
265+
244266
myProcess.EnableRaisingEvents = true;
245267
myProcess.Start();
246268
myProcess.WaitForExit();

0 commit comments

Comments
 (0)