@@ -111,7 +111,7 @@ public override void OnInspectorGUI() {
111
111
throw new System . NotImplementedException ( ) ;
112
112
}
113
113
114
- string dccPath = EditorUtility . OpenFilePanel ( "Select Digital Content Creation Application" , ExportSettings . kDefaultAdskRoot , ext ) ;
114
+ string dccPath = EditorUtility . OpenFilePanel ( "Select Digital Content Creation Application" , ExportSettings . DCCVendorLocations ( ) [ 0 ] , ext ) ;
115
115
116
116
// check that the path is valid and references the maya executable
117
117
if ( ! string . IsNullOrEmpty ( dccPath ) ) {
@@ -226,20 +226,31 @@ public class ExportSettings : ScriptableSingleton<ExportSettings>
226
226
public const string kBlenderOptionName = "Blender " ;
227
227
228
228
/// <summary>
229
- /// The path where all the different versions of Maya are installed
229
+ /// The paths where all the different versions of Maya are installed
230
230
/// by default. Depends on the platform.
231
231
/// </summary>
232
- public static string kDefaultAdskRoot {
233
- get {
234
- switch ( Application . platform ) {
235
- case RuntimePlatform . WindowsEditor :
236
- return "C:/Program Files/Autodesk" ;
237
- case RuntimePlatform . OSXEditor :
238
- return "/Applications/Autodesk" ;
239
- default :
240
- throw new NotImplementedException ( ) ;
232
+ public static string [ ] DCCVendorLocations ( ) {
233
+
234
+ if ( Environment . GetEnvironmentVariable ( "UNITY_FBX_3DAPP_VENDOR_LOCATIONS" ) != null )
235
+ {
236
+ string [ ] locations = Environment . GetEnvironmentVariable ( "UNITY_FBX_3DAPP_VENDOR_LOCATIONS" ) . Split ( ';' ) ;
237
+ for ( int i = 0 ; i < locations . Length ; i ++ )
238
+ {
239
+ if ( Directory . Exists ( locations [ i ] ) )
240
+ {
241
+ return locations ;
242
+ }
241
243
}
242
244
}
245
+
246
+ switch ( Application . platform ) {
247
+ case RuntimePlatform . WindowsEditor :
248
+ return new string [ ] { "C:/Program Files/Autodesk" , "D:/Program Files/Autodesk" } ;
249
+ case RuntimePlatform . OSXEditor :
250
+ return new string [ ] { "/Applications/Autodesk" } ;
251
+ default :
252
+ throw new NotImplementedException ( ) ;
253
+ }
243
254
}
244
255
245
256
// Note: default values are set in LoadDefaults().
@@ -444,48 +455,49 @@ private static void FindDCCInstalls() {
444
455
var dccOptionName = instance . dccOptionNames ;
445
456
var dccOptionPath = instance . dccOptionPaths ;
446
457
447
- // If the location is given by the environment, use it.
448
- var location = System . Environment . GetEnvironmentVariable ( "MAYA_LOCATION" ) ;
449
- if ( ! string . IsNullOrEmpty ( location ) ) {
450
- location = location . TrimEnd ( '/' ) ;
451
- dccOptionPath . Add ( GetMayaExePath ( location . Replace ( "\\ " , "/" ) ) ) ;
452
- dccOptionName . Add ( "MAYA_LOCATION" ) ;
453
- }
454
-
455
- if ( ! Directory . Exists ( kDefaultAdskRoot ) ) {
456
- // no autodesk products installed
457
- return ;
458
- }
459
- // List that directory and find the right version:
460
- // either the newest version, or the exact version we wanted.
461
- var adskRoot = new System . IO . DirectoryInfo ( kDefaultAdskRoot ) ;
462
- foreach ( var productDir in adskRoot . GetDirectories ( ) ) {
463
- var product = productDir . Name ;
458
+ for ( int i = 0 ; i < DCCVendorLocations ( ) . Length ; i ++ )
459
+ {
460
+ if ( ! Directory . Exists ( DCCVendorLocations ( ) [ 0 ] ) )
461
+ {
462
+ // no autodesk products installed
463
+ continue ;
464
+ }
465
+ // List that directory and find the right version:
466
+ // either the newest version, or the exact version we wanted.
467
+ var adskRoot = new System . IO . DirectoryInfo ( DCCVendorLocations ( ) [ i ] ) ;
468
+ foreach ( var productDir in adskRoot . GetDirectories ( ) )
469
+ {
470
+ var product = productDir . Name ;
464
471
465
- // Only accept those that start with 'maya' in either case.
466
- if ( product . StartsWith ( "maya" , StringComparison . InvariantCultureIgnoreCase ) ) {
467
- // UNI-29074 TODO: add Maya LT support
468
- // Reject MayaLT -- it doesn't have plugins.
469
- if ( product . StartsWith ( "mayalt" , StringComparison . InvariantCultureIgnoreCase ) ) {
470
- continue ;
472
+ // Only accept those that start with 'maya' in either case.
473
+ if ( product . StartsWith ( "maya" , StringComparison . InvariantCultureIgnoreCase ) )
474
+ {
475
+ // UNI-29074 TODO: add Maya LT support
476
+ // Reject MayaLT -- it doesn't have plugins.
477
+ if ( product . StartsWith ( "mayalt" , StringComparison . InvariantCultureIgnoreCase ) )
478
+ {
479
+ continue ;
480
+ }
481
+ string version = product . Substring ( "maya" . Length ) ;
482
+ dccOptionPath . Add ( GetMayaExePath ( productDir . FullName . Replace ( "\\ " , "/" ) ) ) ;
483
+ dccOptionName . Add ( GetUniqueDCCOptionName ( kMayaOptionName + version ) ) ;
471
484
}
472
- string version = product . Substring ( "maya" . Length ) ;
473
- dccOptionPath . Add ( GetMayaExePath ( productDir . FullName . Replace ( "\\ " , "/" ) ) ) ;
474
- dccOptionName . Add ( GetUniqueDCCOptionName ( kMayaOptionName + version ) ) ;
475
- }
476
485
477
- if ( product . StartsWith ( "3ds max" , StringComparison . InvariantCultureIgnoreCase ) ) {
478
- var exePath = string . Format ( "{0}/{1}" , productDir . FullName . Replace ( "\\ " , "/" ) , "3dsmax.exe" ) ;
486
+ if ( product . StartsWith ( "3ds max" , StringComparison . InvariantCultureIgnoreCase ) )
487
+ {
488
+ var exePath = string . Format ( "{0}/{1}" , productDir . FullName . Replace ( "\\ " , "/" ) , "3dsmax.exe" ) ;
479
489
480
- string version = product . Substring ( "3ds max " . Length ) ;
481
- var maxOptionName = GetUniqueDCCOptionName ( kMaxOptionName + version ) ;
490
+ string version = product . Substring ( "3ds max " . Length ) ;
491
+ var maxOptionName = GetUniqueDCCOptionName ( kMaxOptionName + version ) ;
482
492
483
- if ( IsEarlierThanMax2017 ( maxOptionName ) ) {
484
- continue ;
493
+ if ( IsEarlierThanMax2017 ( maxOptionName ) )
494
+ {
495
+ continue ;
496
+ }
497
+
498
+ dccOptionPath . Add ( exePath ) ;
499
+ dccOptionName . Add ( maxOptionName ) ;
485
500
}
486
-
487
- dccOptionPath . Add ( exePath ) ;
488
- dccOptionName . Add ( maxOptionName ) ;
489
501
}
490
502
}
491
503
instance . selectedDCCApp = instance . GetPreferredDCCApp ( ) ;
0 commit comments