Skip to content

Commit 6ef9133

Browse files
author
AJubrey
committed
[CHANGED] the label width to be a little larger
[ADDED] Browse button offset because they weren't lined up correctly [REMOVED] some spaces that we didn't need [CHANGED] the browse buttons to be below the fields
1 parent b37d6b4 commit 6ef9133

File tree

1 file changed

+39
-21
lines changed

1 file changed

+39
-21
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 39 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ namespace FbxExporters.EditorTools {
1010
[CustomEditor(typeof(ExportSettings))]
1111
public class ExportSettingsEditor : UnityEditor.Editor {
1212
Vector2 scrollPos = Vector2.zero;
13-
const float LabelWidth = 130;
13+
const float LabelWidth = 144;
1414
const float SelectableLabelMinWidth = 90;
1515
const float BrowseButtonWidth = 25;
16-
const float FieldOffset = 17;
16+
const float FieldOffset = 18;
17+
const float BrowseButtonOffset = 3;
1718

1819
public override void OnInspectorGUI() {
1920
ExportSettings exportSettings = (ExportSettings)target;
@@ -48,21 +49,14 @@ public override void OnInspectorGUI() {
4849
exportSettings.centerObjects
4950
);
5051

51-
EditorGUILayout.Space();
52-
5352
GUILayout.BeginHorizontal();
5453
EditorGUILayout.LabelField(new GUIContent("Export Format:", "Export the FBX file in the standard binary format." +
5554
" Select ASCII to export the FBX file in ASCII format."), GUILayout.Width(LabelWidth - FieldOffset));
5655
exportSettings.ExportFormatSelection = EditorGUILayout.Popup(exportSettings.ExportFormatSelection, new string[]{"Binary", "ASCII"});
5756
GUILayout.EndHorizontal();
5857

59-
EditorGUILayout.Space();
60-
EditorGUI.indentLevel--;
61-
EditorGUILayout.LabelField("Integration", EditorStyles.boldLabel);
62-
EditorGUI.indentLevel++;
63-
64-
GUILayout.BeginHorizontal ();
65-
EditorGUILayout.LabelField(new GUIContent (
58+
GUILayout.BeginHorizontal();
59+
EditorGUILayout.LabelField(new GUIContent(
6660
"Export Path:",
6761
"Relative path for saving Model Prefabs."), GUILayout.Width(LabelWidth - FieldOffset));
6862

@@ -72,26 +66,36 @@ public override void OnInspectorGUI() {
7266
EditorStyles.textField,
7367
GUILayout.MinWidth(SelectableLabelMinWidth),
7468
GUILayout.Height(EditorGUIUtility.singleLineHeight));
69+
GUILayout.EndHorizontal();
70+
GUILayout.BeginHorizontal();
71+
72+
EditorGUILayout.LabelField("",GUILayout.Width(LabelWidth - BrowseButtonOffset));
7573

76-
if (GUILayout.Button (new GUIContent("...", "Browse to a new location for saving model prefabs"), EditorStyles.miniButton, GUILayout.Width (BrowseButtonWidth))) {
74+
if (GUILayout.Button(new GUIContent("...", "Browse to a new location for saving model prefabs"), EditorStyles.miniButton, GUILayout.Width(BrowseButtonWidth)))
75+
{
7776
string initialPath = ExportSettings.GetAbsoluteSavePath();
7877

7978
// if the directory doesn't exist, set it to the default save path
8079
// so we don't open somewhere unexpected
81-
if (!System.IO.Directory.Exists (initialPath)) {
80+
if (!System.IO.Directory.Exists(initialPath))
81+
{
8282
initialPath = Application.dataPath;
8383
}
8484

85-
string fullPath = EditorUtility.OpenFolderPanel (
85+
string fullPath = EditorUtility.OpenFolderPanel(
8686
"Select Model Prefabs Path", initialPath, null
8787
);
8888

8989
// Unless the user canceled, make sure they chose something in the Assets folder.
90-
if (!string.IsNullOrEmpty (fullPath)) {
90+
if (!string.IsNullOrEmpty(fullPath))
91+
{
9192
var relativePath = ExportSettings.ConvertToAssetRelativePath(fullPath);
92-
if (string.IsNullOrEmpty(relativePath)) {
93-
Debug.LogWarning ("Please select a location in the Assets folder");
94-
} else {
93+
if (string.IsNullOrEmpty(relativePath))
94+
{
95+
Debug.LogWarning("Please select a location in the Assets folder");
96+
}
97+
else
98+
{
9599
ExportSettings.SetRelativeSavePath(relativePath);
96100

97101
// Make sure focus is removed from the selectable label
@@ -101,7 +105,13 @@ public override void OnInspectorGUI() {
101105
}
102106
}
103107
}
104-
GUILayout.EndHorizontal ();
108+
GUILayout.EndHorizontal();
109+
110+
EditorGUILayout.Space();
111+
EditorGUILayout.Space();
112+
EditorGUI.indentLevel--;
113+
EditorGUILayout.LabelField("Integration", EditorStyles.boldLabel);
114+
EditorGUI.indentLevel++;
105115

106116
GUILayout.BeginHorizontal ();
107117
EditorGUILayout.LabelField(new GUIContent (
@@ -113,6 +123,10 @@ public override void OnInspectorGUI() {
113123
EditorStyles.textField,
114124
GUILayout.MinWidth(SelectableLabelMinWidth),
115125
GUILayout.Height(EditorGUIUtility.singleLineHeight));
126+
GUILayout.EndHorizontal();
127+
GUILayout.BeginHorizontal();
128+
129+
EditorGUILayout.LabelField("", GUILayout.Width(LabelWidth - BrowseButtonOffset));
116130

117131
if (GUILayout.Button(new GUIContent("...", "Browse to a new installation path for 3D application integrations"), EditorStyles.miniButton, GUILayout.Width(BrowseButtonWidth)))
118132
{
@@ -135,8 +149,6 @@ public override void OnInspectorGUI() {
135149

136150
GUILayout.EndHorizontal();
137151

138-
EditorGUILayout.Space ();
139-
140152
GUILayout.BeginHorizontal ();
141153
EditorGUILayout.LabelField(new GUIContent (
142154
"3D Application:",
@@ -146,6 +158,12 @@ public override void OnInspectorGUI() {
146158
var options = ExportSettings.GetDCCOptions();
147159

148160
exportSettings.selectedDCCApp = EditorGUILayout.Popup(exportSettings.selectedDCCApp, options);
161+
162+
GUILayout.EndHorizontal();
163+
GUILayout.BeginHorizontal();
164+
165+
EditorGUILayout.LabelField("", GUILayout.Width(LabelWidth - BrowseButtonOffset));
166+
149167
if (GUILayout.Button(new GUIContent("...", "Browse to a 3D application in a non-default location"), EditorStyles.miniButton, GUILayout.Width(BrowseButtonWidth))) {
150168
var ext = "";
151169
switch (Application.platform) {

0 commit comments

Comments
 (0)