@@ -146,7 +146,7 @@ public override void OnInspectorGUI() {
146
146
return ;
147
147
}
148
148
}
149
- ExportSettings . AddDCCOption ( dccPath ) ;
149
+ ExportSettings . AddDCCOption ( dccPath , ExportSettings . DCCType . Maya ) ;
150
150
Repaint ( ) ;
151
151
} else {
152
152
exportSettings . selectedDCCApp = oldValue ;
@@ -243,7 +243,7 @@ protected override void LoadDefaults()
243
243
}
244
244
245
245
/// <summary>
246
- /// Increments the name if there is a duplicate in MayaAppOptions dictionary .
246
+ /// Increments the name if there is a duplicate in dccAppOptions .
247
247
/// </summary>
248
248
/// <returns>The unique name.</returns>
249
249
/// <param name="name">Name.</param>
@@ -294,7 +294,7 @@ private static void FindMaxInstalls(){
294
294
}
295
295
string version = product . Substring ( "3ds max " . Length ) ;
296
296
maxOptionPath . Add ( string . Format ( "{0}/{1}" , productDir . FullName . Replace ( "\\ " , "/" ) , "3dsmax.exe" ) ) ;
297
- maxOptionName . Add ( GetUniqueName ( "3Ds Max " + version ) ) ;
297
+ maxOptionName . Add ( GetUniqueName ( "3ds Max " + version ) ) ;
298
298
}
299
299
}
300
300
@@ -376,8 +376,8 @@ public static GUIContent[] GetDCCOptions(){
376
376
// remove options that no longer exist
377
377
List < int > toDelete = new List < int > ( ) ;
378
378
for ( int i = 0 ; i < instance . dccOptionPaths . Count ; i ++ ) {
379
- var mayaPath = instance . dccOptionPaths [ i ] ;
380
- if ( ! File . Exists ( mayaPath ) ) {
379
+ var dccPath = instance . dccOptionPaths [ i ] ;
380
+ if ( ! File . Exists ( dccPath ) ) {
381
381
if ( i == instance . selectedDCCApp ) {
382
382
instance . selectedDCCApp = 0 ;
383
383
}
@@ -401,22 +401,36 @@ public static GUIContent[] GetDCCOptions(){
401
401
return optionArray ;
402
402
}
403
403
404
- public static void AddDCCOption ( string newOption ) {
405
- // on OSX we get a path ending in .app, which is not quite the exe
406
- #if UNITY_EDITOR_OSX
407
- newOption = GetMayaExePath ( newOption ) ;
408
- #endif
404
+ public enum DCCType { Maya , Max } ;
405
+
406
+ public static void AddDCCOption ( string newOption , DCCType dcc ) {
407
+ if ( Application . platform == RuntimePlatform . OSXEditor && dcc == DCCType . Maya ) {
408
+ // on OSX we get a path ending in .app, which is not quite the exe
409
+ newOption = GetMayaExePath ( newOption ) ;
410
+ }
409
411
410
- var mayaOptionPaths = instance . dccOptionPaths ;
411
- if ( mayaOptionPaths . Contains ( newOption ) ) {
412
- instance . selectedDCCApp = mayaOptionPaths . IndexOf ( newOption ) ;
412
+ var dccOptionPaths = instance . dccOptionPaths ;
413
+ if ( dccOptionPaths . Contains ( newOption ) ) {
414
+ instance . selectedDCCApp = dccOptionPaths . IndexOf ( newOption ) ;
413
415
return ;
414
416
}
415
- // get the version
416
- var version = AskMayaVersion ( newOption ) ;
417
- instance . dccOptionNames . Add ( GetUniqueName ( "Maya " + version ) ) ;
418
- mayaOptionPaths . Add ( newOption ) ;
419
- instance . selectedDCCApp = mayaOptionPaths . Count - 1 ;
417
+
418
+ string optionName = "" ;
419
+ switch ( dcc ) {
420
+ case DCCType . Maya :
421
+ var version = AskMayaVersion ( newOption ) ;
422
+ optionName = GetUniqueName ( "Maya " + version ) ;
423
+ break ;
424
+ case DCCType . Max :
425
+ optionName = GetMaxOptionName ( newOption ) ;
426
+ break ;
427
+ default :
428
+ throw new System . NotImplementedException ( ) ;
429
+ }
430
+
431
+ instance . dccOptionNames . Add ( optionName ) ;
432
+ dccOptionPaths . Add ( newOption ) ;
433
+ instance . selectedDCCApp = dccOptionPaths . Count - 1 ;
420
434
}
421
435
422
436
/// <summary>
@@ -442,7 +456,16 @@ static string AskMayaVersion(string exePath) {
442
456
return resultString . Substring ( 0 , commaIndex ) . Substring ( "Maya " . Length ) ;
443
457
}
444
458
445
- public static string GetSelectedMayaPath ( )
459
+ /// <summary>
460
+ /// Gets the unique label for a new 3DsMax dropdown option.
461
+ /// </summary>
462
+ /// <returns>The 3DsMax dropdown option label.</returns>
463
+ /// <param name="exePath">Exe path.</param>
464
+ public static string GetMaxOptionName ( string exePath ) {
465
+ return GetUniqueName ( Path . GetFileName ( Path . GetDirectoryName ( exePath ) ) ) ;
466
+ }
467
+
468
+ public static string GetSelectedDCCPath ( )
446
469
{
447
470
return instance . dccOptionPaths [ instance . selectedDCCApp ] ;
448
471
}
0 commit comments