Skip to content

Commit 7dfd6ad

Browse files
authored
Merge pull request #200 from Unity-Technologies/Uni-26023_Pull_out_browse_button_from_the_dropdown
Uni-26023 moved the browse button out of the dropdown menu
2 parents 2b88291 + dcc7aaa commit 7dfd6ad

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public override void OnInspectorGUI() {
2727
GUILayout.Label ("Version: " + version, EditorStyles.centeredGreyMiniLabel);
2828
EditorGUILayout.Space ();
2929
}
30-
30+
GUILayout.BeginVertical();
3131
exportSettings.mayaCompatibleNames = EditorGUILayout.Toggle (
3232
new GUIContent ("Convert to Maya Compatible Naming:",
3333
"In Maya some symbols such as spaces and accents get replaced when importing an FBX " +
@@ -49,7 +49,6 @@ public override void OnInspectorGUI() {
4949
GUILayout.Label (new GUIContent (
5050
"Export Path:",
5151
"Relative path for saving Model Prefabs."));
52-
5352
var pathLabel = ExportSettings.GetRelativeSavePath();
5453
if (pathLabel == ".") { pathLabel = "(Assets root)"; }
5554
EditorGUILayout.SelectableLabel(pathLabel,
@@ -93,17 +92,12 @@ public override void OnInspectorGUI() {
9392
GUILayout.Label (new GUIContent (
9493
"3D Application:",
9594
"Select the 3D Application for which you would like to install the Unity integration."));
96-
95+
9796
// dropdown to select Maya version to use
9897
var options = ExportSettings.GetDCCOptions();
99-
// make sure we never initially have browse selected
100-
if (exportSettings.selectedDCCApp == options.Length - 1) {
101-
exportSettings.selectedDCCApp = exportSettings.GetPreferredDCCApp();
102-
}
10398

104-
int oldValue = exportSettings.selectedDCCApp;
10599
exportSettings.selectedDCCApp = EditorGUILayout.Popup(exportSettings.selectedDCCApp, options);
106-
if (exportSettings.selectedDCCApp == options.Length - 1) {
100+
if (GUILayout.Button("Browse", EditorStyles.miniButton, GUILayout.Width(BrowseButtonWidth))) {
107101
var ext = "";
108102
switch (Application.platform) {
109103
case RuntimePlatform.WindowsEditor:
@@ -129,7 +123,6 @@ public override void OnInspectorGUI() {
129123
// Therefore check both executable folder (for Mac) and its parent (for Windows)
130124
if (md.Name.ToLower().StartsWith("mayalt") || md.Parent.Name.ToLower ().StartsWith ("mayalt")) {
131125
Debug.LogError (string.Format("Unity Integration does not support Maya LT: \"{0}\"", md.FullName));
132-
exportSettings.selectedDCCApp = oldValue;
133126
return;
134127
}
135128

@@ -143,14 +136,11 @@ public override void OnInspectorGUI() {
143136
}
144137
if (foundDCCPath == null) {
145138
Debug.LogError (string.Format ("Could not find supported 3D application at: \"{0}\"", Path.GetDirectoryName (dccPath)));
146-
exportSettings.selectedDCCApp = oldValue;
147139
} else {
148140
dccPath = foundDCCPath;
149141
ExportSettings.AddDCCOption (dccPath, foundDCC);
150142
}
151143
Repaint ();
152-
} else {
153-
exportSettings.selectedDCCApp = oldValue;
154144
}
155145
}
156146
GUILayout.EndHorizontal ();
@@ -164,6 +154,7 @@ public override void OnInspectorGUI() {
164154

165155
GUILayout.FlexibleSpace ();
166156
GUILayout.EndScrollView ();
157+
GUILayout.EndVertical();
167158

168159
if (GUI.changed) {
169160
EditorUtility.SetDirty (exportSettings);
@@ -550,19 +541,17 @@ public static GUIContent[] GetDCCOptions(){
550541

551542
if (instance.dccOptionPaths.Count <= 0) {
552543
return new GUIContent[]{
553-
new GUIContent("<No 3D Application found>"),
554-
new GUIContent("Browse...")
544+
new GUIContent("<No 3D Application found>")
555545
};
556546
}
557547

558-
GUIContent[] optionArray = new GUIContent[instance.dccOptionPaths.Count+1];
548+
GUIContent[] optionArray = new GUIContent[instance.dccOptionPaths.Count];
559549
for(int i = 0; i < instance.dccOptionPaths.Count; i++){
560550
optionArray [i] = new GUIContent(
561551
instance.dccOptionNames[i],
562552
instance.dccOptionPaths[i]
563553
);
564554
}
565-
optionArray [optionArray.Length - 1] = new GUIContent("Browse...");
566555

567556
return optionArray;
568557
}

0 commit comments

Comments
 (0)