Skip to content

Commit b092608

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/master' into UNI-30401-fix-exporting-without-normals-error
# Conflicts: # Assets/FbxExporters/Editor/FbxExporter.cs
2 parents a51c0e8 + f20c664 commit b092608

File tree

3 files changed

+304
-59
lines changed

3 files changed

+304
-59
lines changed

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 50 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +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 = 18;
17+
const float BrowseButtonOffset = 5;
1618

1719
public override void OnInspectorGUI() {
1820
ExportSettings exportSettings = (ExportSettings)target;
@@ -27,6 +29,8 @@ public override void OnInspectorGUI() {
2729
GUILayout.Label ("Version: " + version, EditorStyles.centeredGreyMiniLabel);
2830
EditorGUILayout.Space ();
2931
}
32+
EditorGUILayout.LabelField("Export Options", EditorStyles.boldLabel);
33+
EditorGUI.indentLevel++;
3034
GUILayout.BeginVertical();
3135
exportSettings.mayaCompatibleNames = EditorGUILayout.Toggle (
3236
new GUIContent ("Compatible Naming:",
@@ -45,47 +49,53 @@ public override void OnInspectorGUI() {
4549
exportSettings.centerObjects
4650
);
4751

48-
EditorGUILayout.Space();
49-
5052
GUILayout.BeginHorizontal();
51-
GUILayout.Label(new GUIContent("Export Format:", "Export the FBX file in the standard binary format." +
52-
" Select ASCII to export the FBX file in ASCII format."), GUILayout.Width(LabelWidth - 3));
53+
EditorGUILayout.LabelField(new GUIContent("Export Format:", "Export the FBX file in the standard binary format." +
54+
" Select ASCII to export the FBX file in ASCII format."), GUILayout.Width(LabelWidth - FieldOffset));
5355
exportSettings.ExportFormatSelection = EditorGUILayout.Popup(exportSettings.ExportFormatSelection, new string[]{"Binary", "ASCII"});
5456
GUILayout.EndHorizontal();
5557

56-
EditorGUILayout.Space();
57-
58-
GUILayout.BeginHorizontal ();
59-
GUILayout.Label (new GUIContent (
58+
GUILayout.BeginHorizontal();
59+
EditorGUILayout.LabelField(new GUIContent(
6060
"Export Path:",
61-
"Relative path for saving Model Prefabs."), GUILayout.Width(LabelWidth - 3));
61+
"Relative path for saving Model Prefabs."), GUILayout.Width(LabelWidth - FieldOffset));
6262

6363
var pathLabel = ExportSettings.GetRelativeSavePath();
6464
if (pathLabel == ".") { pathLabel = "(Assets root)"; }
6565
EditorGUILayout.SelectableLabel(pathLabel,
6666
EditorStyles.textField,
6767
GUILayout.MinWidth(SelectableLabelMinWidth),
6868
GUILayout.Height(EditorGUIUtility.singleLineHeight));
69+
GUILayout.EndHorizontal();
70+
GUILayout.BeginHorizontal();
6971

70-
if (GUILayout.Button (new GUIContent("...", "Browse to a new location for saving model prefabs"), EditorStyles.miniButton, GUILayout.Width (BrowseButtonWidth))) {
72+
GUILayout.Space(LabelWidth + BrowseButtonOffset);
73+
74+
if (GUILayout.Button(new GUIContent("...", "Browse to a new location for saving model prefabs"), EditorStyles.miniButton, GUILayout.Width(BrowseButtonWidth)))
75+
{
7176
string initialPath = ExportSettings.GetAbsoluteSavePath();
7277

7378
// if the directory doesn't exist, set it to the default save path
7479
// so we don't open somewhere unexpected
75-
if (!System.IO.Directory.Exists (initialPath)) {
80+
if (!System.IO.Directory.Exists(initialPath))
81+
{
7682
initialPath = Application.dataPath;
7783
}
7884

79-
string fullPath = EditorUtility.OpenFolderPanel (
85+
string fullPath = EditorUtility.OpenFolderPanel(
8086
"Select Model Prefabs Path", initialPath, null
8187
);
8288

8389
// Unless the user canceled, make sure they chose something in the Assets folder.
84-
if (!string.IsNullOrEmpty (fullPath)) {
90+
if (!string.IsNullOrEmpty(fullPath))
91+
{
8592
var relativePath = ExportSettings.ConvertToAssetRelativePath(fullPath);
86-
if (string.IsNullOrEmpty(relativePath)) {
87-
Debug.LogWarning ("Please select a location in the Assets folder");
88-
} else {
93+
if (string.IsNullOrEmpty(relativePath))
94+
{
95+
Debug.LogWarning("Please select a location in the Assets folder");
96+
}
97+
else
98+
{
8999
ExportSettings.SetRelativeSavePath(relativePath);
90100

91101
// Make sure focus is removed from the selectable label
@@ -95,18 +105,28 @@ public override void OnInspectorGUI() {
95105
}
96106
}
97107
}
98-
GUILayout.EndHorizontal ();
108+
GUILayout.EndHorizontal();
109+
110+
EditorGUILayout.Space();
111+
EditorGUILayout.Space();
112+
EditorGUI.indentLevel--;
113+
EditorGUILayout.LabelField("Integration", EditorStyles.boldLabel);
114+
EditorGUI.indentLevel++;
99115

100116
GUILayout.BeginHorizontal ();
101-
GUILayout.Label (new GUIContent (
117+
EditorGUILayout.LabelField(new GUIContent (
102118
"Integrations Path:",
103-
"Installation path for 3D application integrations."), GUILayout.Width(LabelWidth - 3));
119+
"Installation path for 3D application integrations."), GUILayout.Width(LabelWidth - FieldOffset));
104120

105121
var IntegrationsPathLabel = ExportSettings.GetIntegrationSavePath();
106122
EditorGUILayout.SelectableLabel(IntegrationsPathLabel,
107123
EditorStyles.textField,
108124
GUILayout.MinWidth(SelectableLabelMinWidth),
109125
GUILayout.Height(EditorGUIUtility.singleLineHeight));
126+
GUILayout.EndHorizontal();
127+
GUILayout.BeginHorizontal();
128+
129+
GUILayout.Space(LabelWidth + BrowseButtonOffset);
110130

111131
if (GUILayout.Button(new GUIContent("...", "Browse to a new installation path for 3D application integrations"), EditorStyles.miniButton, GUILayout.Width(BrowseButtonWidth)))
112132
{
@@ -129,17 +149,21 @@ public override void OnInspectorGUI() {
129149

130150
GUILayout.EndHorizontal();
131151

132-
EditorGUILayout.Space ();
133-
134152
GUILayout.BeginHorizontal ();
135-
GUILayout.Label (new GUIContent (
153+
EditorGUILayout.LabelField(new GUIContent (
136154
"3D Application:",
137-
"Select the 3D Application for which you would like to install the Unity integration."), GUILayout.Width(LabelWidth - 3));
155+
"Select the 3D Application for which you would like to install the Unity integration."), GUILayout.Width(LabelWidth - FieldOffset));
138156

139157
// dropdown to select Maya version to use
140158
var options = ExportSettings.GetDCCOptions();
141159

142160
exportSettings.selectedDCCApp = EditorGUILayout.Popup(exportSettings.selectedDCCApp, options);
161+
162+
GUILayout.EndHorizontal();
163+
GUILayout.BeginHorizontal();
164+
165+
GUILayout.Space(LabelWidth + BrowseButtonOffset);
166+
143167
if (GUILayout.Button(new GUIContent("...", "Browse to a 3D application in a non-default location"), EditorStyles.miniButton, GUILayout.Width(BrowseButtonWidth))) {
144168
var ext = "";
145169
switch (Application.platform) {
@@ -762,7 +786,8 @@ public static void SetRelativeSavePath(string newPath) {
762786
public static string GetIntegrationSavePath()
763787
{
764788
//If the save path gets messed up and ends up not being valid, just use the project folder as the default
765-
if (string.IsNullOrEmpty(instance.IntegrationSavePath.Trim()) || !Directory.Exists(instance.IntegrationSavePath))
789+
if (string.IsNullOrEmpty(instance.IntegrationSavePath) ||
790+
!Directory.Exists(instance.IntegrationSavePath))
766791
{
767792
//The project folder, above the asset folder
768793
instance.IntegrationSavePath = DefaultIntegrationSavePath;

0 commit comments

Comments
 (0)