@@ -279,18 +279,32 @@ public static string[] DCCVendorLocations {
279
279
}
280
280
281
281
//Check the surrounding area around MAYA_LOCATION for any other Applications we may want.
282
- System . Environment . SetEnvironmentVariable ( "MAYA_LOCATION" , "C:/Program Files/Autodesk/pickles/bin" ) ;
283
282
var location = System . Environment . GetEnvironmentVariable ( "MAYA_LOCATION" ) ;
284
283
if ( ! string . IsNullOrEmpty ( location ) )
285
284
{
286
- var possibleLocation = Directory . GetParent ( Directory . GetParent ( location ) . ToString ( ) ) ;
287
- if ( possibleLocation . Exists )
285
+ //If we are on Windows, we need only go up one location to get to the "Autodesk" folder.
286
+ var possibleLocation = Directory . GetParent ( location ) . ToString ( ) ;
287
+
288
+ if ( Application . platform == RuntimePlatform . OSXEditor )
289
+ {
290
+ int appIndex = location . IndexOf ( "Maya.app" ) ;
291
+
292
+ //If we found 'Maya.app' in the location string, we're going to trim it and everything after it out
293
+ //This way our possibleLocation will be more uniform between windows and mac
294
+ if ( appIndex != - 1 )
295
+ {
296
+ possibleLocation = location . Substring ( 0 , ( appIndex - 1 ) ) ;
297
+ possibleLocation = Directory . GetParent ( Directory . GetParent ( location ) . ToString ( ) ) . ToString ( ) ;
298
+ }
299
+ }
300
+
301
+ if ( Directory . Exists ( possibleLocation ) )
288
302
{
289
303
locationsList . Add ( possibleLocation . ToString ( ) ) ;
290
304
}
291
305
}
292
306
293
- if ( locationsList . Count > 0 )
307
+ if ( locationsList . Count > 0 )
294
308
{
295
309
return locationsList . ToArray ( ) ;
296
310
}
@@ -561,7 +575,7 @@ private static void FindDCCInstalls() {
561
575
location = location . TrimEnd ( '/' ) ;
562
576
string pathToAdd = GetMayaExePath ( location . Replace ( "\\ " , "/" ) ) ;
563
577
//If this path is already a part of our list, don't add it
564
- if ( ! dccOptionPath . Contains ( pathToAdd ) )
578
+ if ( ! dccOptionPath . Contains ( pathToAdd ) && Directory . Exists ( pathToAdd ) )
565
579
{
566
580
dccOptionPath . Add ( pathToAdd ) ;
567
581
dccOptionName . Add ( "MAYA_LOCATION" ) ;
@@ -688,14 +702,14 @@ public static void AddDCCOption(string newOption, DCCType dcc){
688
702
switch ( dcc ) {
689
703
case DCCType . Maya :
690
704
var version = AskMayaVersion ( newOption ) ;
691
- if ( version == null )
692
- {
693
- Debug . LogError ( "This version of Maya could not be launched properly" ) ;
694
- UnityEditor . EditorUtility . DisplayDialog ( "Error Loading 3D Application" ,
695
- "There was a problem loading this version of Maya ",
696
- "Ok" ) ;
697
- return ;
698
- }
705
+ if ( version == null )
706
+ {
707
+ Debug . LogError ( "This version of Maya could not be launched properly" ) ;
708
+ UnityEditor . EditorUtility . DisplayDialog ( "Error Loading 3D Application" ,
709
+ "Failed to add Maya option, could not get version number from maya.exe ",
710
+ "Ok" ) ;
711
+ return ;
712
+ }
699
713
optionName = GetUniqueDCCOptionName ( "Maya " + version ) ;
700
714
break ;
701
715
case DCCType . Max :
@@ -745,7 +759,7 @@ static string AskMayaVersion(string exePath) {
745
759
}
746
760
else
747
761
{
748
- //This probably means we tried to launch Maya to check the version but it was some sort of fake maya.
762
+ //This probably means we tried to launch Maya to check the version but it was some sort of broken maya.
749
763
//We'll just return null and throw an error for it.
750
764
return null ;
751
765
}
0 commit comments