Skip to content

Commit 4f9208d

Browse files
committed
code review fixes
* rename IsDCCDropdownEmpty to CanInstall * call GetSelectedDCCPath() instead of directly accessing array * make GetelectedDCCPath and GetSelectedDCCName more robust
1 parent 9ef0203 commit 4f9208d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public override void OnInspectorGUI() {
179179
EditorGUILayout.Space();
180180

181181
// disable button if no 3D application is available
182-
EditorGUI.BeginDisabledGroup (ExportSettings.IsDCCDropdownEmpty()? true : false);
182+
EditorGUI.BeginDisabledGroup (ExportSettings.CanInstall()? true : false);
183183
var installIntegrationContent = new GUIContent(
184184
"Install Unity Integration",
185185
"Install and configure the Unity integration for the selected 3D application so that you can import and export directly with this project.");
@@ -602,8 +602,7 @@ public static GUIContent[] GetDCCOptions(){
602602
FindDCCInstalls ();
603603
}
604604
// store the selected app if any
605-
string prevSelection = instance.dccOptionPaths.Count > 0 && instance.selectedDCCApp >=0 ?
606-
instance.dccOptionPaths[instance.selectedDCCApp] : null;
605+
string prevSelection = GetSelectedDCCPath();
607606

608607
// remove options that no longer exist
609608
List<string> pathsToDelete = new List<string>();
@@ -726,15 +725,19 @@ public static bool IsEarlierThanMax2017(string AppName){
726725

727726
public static string GetSelectedDCCPath()
728727
{
729-
return (instance.dccOptionPaths.Count>0) ? instance.dccOptionPaths [instance.selectedDCCApp] : "";
728+
return (instance.dccOptionPaths.Count>0 &&
729+
instance.selectedDCCApp >= 0 &&
730+
instance.selectedDCCApp < instance.dccOptionPaths.Count) ? instance.dccOptionPaths [instance.selectedDCCApp] : "";
730731
}
731732

732733
public static string GetSelectedDCCName()
733734
{
734-
return (instance.dccOptionNames.Count>0) ? instance.dccOptionNames [instance.selectedDCCApp] : "";
735+
return (instance.dccOptionNames.Count>0 &&
736+
instance.selectedDCCApp >= 0 &&
737+
instance.selectedDCCApp < instance.dccOptionNames.Count) ? instance.dccOptionNames [instance.selectedDCCApp] : "";
735738
}
736739

737-
public static bool IsDCCDropdownEmpty()
740+
public static bool CanInstall()
738741
{
739742
return instance.dccOptionPaths.Count <= 0;
740743
}

0 commit comments

Comments
 (0)