Skip to content

Commit 51bbc45

Browse files
authored
Merge pull request #229 from Unity-Technologies/UNI-31660-app-dropdown-blank-value
UNI-31660 avoid changing dcc app selection before list is modified
2 parents c37339f + d207a19 commit 51bbc45

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -625,15 +625,15 @@ public static GUIContent[] GetDCCOptions(){
625625
FindDCCInstalls ();
626626
}
627627

628+
// store the selected app
629+
var prevSelection = instance.dccOptionPaths[instance.selectedDCCApp];
630+
628631
// remove options that no longer exist
629632
List<string> pathsToDelete = new List<string>();
630633
List<string> namesToDelete = new List<string>();
631634
for(int i = 0; i < instance.dccOptionPaths.Count; i++) {
632635
var dccPath = instance.dccOptionPaths [i];
633636
if (!File.Exists (dccPath)) {
634-
if (i == instance.selectedDCCApp) {
635-
instance.selectedDCCApp = instance.GetPreferredDCCApp();
636-
}
637637
namesToDelete.Add (instance.dccOptionNames [i]);
638638
pathsToDelete.Add (dccPath);
639639
}
@@ -645,6 +645,13 @@ public static GUIContent[] GetDCCOptions(){
645645
instance.dccOptionNames.Remove (str);
646646
}
647647

648+
// set the selected DCC app to the previous selection
649+
instance.selectedDCCApp = instance.dccOptionPaths.IndexOf (prevSelection);
650+
if (instance.selectedDCCApp < 0) {
651+
// find preferred app if previous selection no longer exists
652+
instance.selectedDCCApp = instance.GetPreferredDCCApp ();
653+
}
654+
648655
if (instance.dccOptionPaths.Count <= 0) {
649656
instance.selectedDCCApp = 0;
650657
return new GUIContent[]{
@@ -659,7 +666,6 @@ public static GUIContent[] GetDCCOptions(){
659666
instance.dccOptionPaths[i]
660667
);
661668
}
662-
663669
return optionArray;
664670
}
665671

0 commit comments

Comments
 (0)