@@ -281,7 +281,7 @@ public class ExportSettings : ScriptableSingleton<ExportSettings>
281
281
//Any additional names require a space after the name
282
282
public const string kMaxOptionName = "3ds Max " ;
283
283
public const string kMayaOptionName = "Maya " ;
284
- public const string kMayaLtOptionName = "MayaLT " ;
284
+ public const string kMayaLtOptionName = "Maya LT " ;
285
285
286
286
private static string DefaultIntegrationSavePath {
287
287
get {
@@ -590,13 +590,22 @@ private int ChoosePreferredDCCApp(int optionA, int optionB)
590
590
return - 1 ;
591
591
}
592
592
593
- //We assume that the option names have a
594
- int scoreA = s_PreferenceList . IndexOf ( appA . Split ( ' ' ) [ 0 ] ) ;
595
- int scoreB = s_PreferenceList . IndexOf ( appB . Split ( ' ' ) [ 0 ] ) ;
593
+ int scoreA = s_PreferenceList . FindIndex ( app => RemoveSpacesAndNumbers ( app ) . Equals ( RemoveSpacesAndNumbers ( appA ) ) ) ;
594
+
595
+ int scoreB = s_PreferenceList . FindIndex ( app => RemoveSpacesAndNumbers ( app ) . Equals ( RemoveSpacesAndNumbers ( appB ) ) ) ;
596
596
597
597
return scoreA < scoreB ? optionA : optionB ;
598
598
}
599
599
600
+ /// <summary>
601
+ /// Takes a given string and removes any spaces or numbers from it
602
+ /// </summary>
603
+ /// <param name="s"></param>
604
+ public static string RemoveSpacesAndNumbers ( string s )
605
+ {
606
+ return System . Text . RegularExpressions . Regex . Replace ( s , @"[\s^0-9]" , "" ) ;
607
+ }
608
+
600
609
/// <summary>
601
610
/// Finds the version based off of the title of the application
602
611
/// </summary>
@@ -627,11 +636,20 @@ private static int FindDCCVersion(string AppName)
627
636
}
628
637
else
629
638
{
639
+ //remove any letters in the string in a final attempt to extract an int from it (this will happen with MayaLT, for example)
640
+ string AppNameCopy = AppName ;
641
+ string stringWithoutLetters = System . Text . RegularExpressions . Regex . Replace ( AppNameCopy , "[^0-9]" , "" ) ;
642
+
643
+ if ( int . TryParse ( stringWithoutLetters , out version ) )
644
+ {
645
+ return version ;
646
+ }
647
+
630
648
float fVersion ;
631
649
//In case we are looking at something with a decimal based version- the int parse will fail so we'll need to parse it as a float.
632
650
if ( float . TryParse ( number , out fVersion ) )
633
651
{
634
- return ( int ) fVersion ;
652
+ return ( int ) fVersion ;
635
653
}
636
654
return - 1 ;
637
655
}
0 commit comments