Skip to content

Commit 33db5c5

Browse files
author
AJubrey
committed
[ADDED] check to make sure we can check maya location even if we have a vendor location
[FIXED] we were comparing mayalocation to the default locations even if we werent using the default locations
1 parent 531e8b8 commit 33db5c5

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ public static string[] DCCVendorLocations {
261261
List<string> locationsList = new List<string>();
262262
List<string> WindowsDefaultLocations = new List<string>() { "C:/Program Files/Autodesk", "D:/Program Files/Autodesk" };
263263
List<string> OSXDefaultLocations = new List<string>() { "/Applications/Autodesk" };
264+
bool foundVendorLocation = false;
264265

265266
if (environmentVariable != null)
266267
{
@@ -275,7 +276,7 @@ public static string[] DCCVendorLocations {
275276
//If we found anything, just return the list
276277
if (locationsList.Count > 0)
277278
{
278-
return locationsList.ToArray();
279+
foundVendorLocation = true;
279280
}
280281
}
281282

@@ -291,16 +292,21 @@ public static string[] DCCVendorLocations {
291292
//'Directory.GetParent()' will take care of any double backslashes the user may have added
292293
possibleLocation = Directory.GetParent(location).ToString();
293294

294-
//Make sure the user defined path is not included in the default paths
295-
for (int i = 0; i < WindowsDefaultLocations.Count; i++)
295+
//We only need to remove duplicates of default locations if we are using the default locations-
296+
//We only use default locations if we do not use the user specified vendor locations
297+
if (!foundVendorLocation)
296298
{
297-
//we don't want a minute difference in slashes or capitalization to throw off our check
298-
if (WindowsDefaultLocations[i] != null &&
299-
possibleLocation != null &&
300-
WindowsDefaultLocations[i].Replace("\\", "/").ToLower().Equals(possibleLocation.Replace("\\", "/").ToLower()))
299+
//Make sure the user defined path is not included in the default paths
300+
for (int i = 0; i < WindowsDefaultLocations.Count; i++)
301301
{
302-
possibleLocation = null;
303-
break;
302+
//we don't want a minute difference in slashes or capitalization to throw off our check
303+
if (WindowsDefaultLocations[i] != null &&
304+
possibleLocation != null &&
305+
WindowsDefaultLocations[i].Replace("\\", "/").ToLower().Equals(possibleLocation.Replace("\\", "/").ToLower()))
306+
{
307+
possibleLocation = null;
308+
break;
309+
}
304310
}
305311
}
306312
}
@@ -309,6 +315,12 @@ public static string[] DCCVendorLocations {
309315
{
310316
//We can assume our path is: /Applications/Autodesk/maya2017/Maya.app/Contents
311317
//So we need to go up three folders.
318+
319+
//Remove any extra slashes on the end
320+
//Maya would accept a single slash in either direction, so we should be able to
321+
location.TrimEnd('/');
322+
location.TrimEnd('\\');
323+
312324
var appFolder = Directory.GetParent(location);
313325
if (appFolder != null)
314326
{
@@ -345,6 +357,11 @@ public static string[] DCCVendorLocations {
345357
}
346358
}
347359

360+
if (foundVendorLocation)
361+
{
362+
return locationsList.ToArray();
363+
}
364+
348365
switch (Application.platform)
349366
{
350367
case RuntimePlatform.WindowsEditor:

0 commit comments

Comments
 (0)