@@ -276,12 +276,25 @@ public static string[] DCCVendorLocations {
276
276
locationsList . Add ( locations [ i ] ) ;
277
277
}
278
278
}
279
- if ( locationsList . Count > 0 )
279
+ }
280
+
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
+ var location = System . Environment . GetEnvironmentVariable ( "MAYA_LOCATION" ) ;
284
+ if ( ! string . IsNullOrEmpty ( location ) )
285
+ {
286
+ var possibleLocation = Directory . GetParent ( Directory . GetParent ( location ) . ToString ( ) ) ;
287
+ if ( possibleLocation . Exists )
280
288
{
281
- return locationsList . ToArray ( ) ;
289
+ locationsList . Add ( possibleLocation . ToString ( ) ) ;
282
290
}
283
291
}
284
292
293
+ if ( locationsList . Count > 0 )
294
+ {
295
+ return locationsList . ToArray ( ) ;
296
+ }
297
+
285
298
switch ( Application . platform )
286
299
{
287
300
case RuntimePlatform . WindowsEditor :
@@ -546,8 +559,13 @@ private static void FindDCCInstalls() {
546
559
if ( ! string . IsNullOrEmpty ( location ) )
547
560
{
548
561
location = location . TrimEnd ( '/' ) ;
549
- dccOptionPath . Add ( GetMayaExePath ( location . Replace ( "\\ " , "/" ) ) ) ;
550
- dccOptionName . Add ( "MAYA_LOCATION" ) ;
562
+ string pathToAdd = GetMayaExePath ( location . Replace ( "\\ " , "/" ) ) ;
563
+ //If this path is already a part of our list, don't add it
564
+ if ( ! dccOptionPath . Contains ( pathToAdd ) )
565
+ {
566
+ dccOptionPath . Add ( pathToAdd ) ;
567
+ dccOptionName . Add ( "MAYA_LOCATION" ) ;
568
+ }
551
569
}
552
570
instance . selectedDCCApp = instance . GetPreferredDCCApp ( ) ;
553
571
}
@@ -670,6 +688,14 @@ public static void AddDCCOption(string newOption, DCCType dcc){
670
688
switch ( dcc ) {
671
689
case DCCType . Maya :
672
690
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
+ }
673
699
optionName = GetUniqueDCCOptionName ( "Maya " + version ) ;
674
700
break ;
675
701
case DCCType . Max :
@@ -719,7 +745,9 @@ static string AskMayaVersion(string exePath) {
719
745
}
720
746
else
721
747
{
722
- return "unknown" ;
748
+ //This probably means we tried to launch Maya to check the version but it was some sort of fake maya.
749
+ //We'll just return null and throw an error for it.
750
+ return null ;
723
751
}
724
752
}
725
753
0 commit comments