Skip to content

Commit b187725

Browse files
committed
code review fixes
- change so all forward slashes have space around them - fix so min window height doesn't cut off buttons - for multi gameobject convert, show filename as "automatic"
1 parent 51c98d1 commit b187725

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

Assets/FbxExporters/Editor/ConvertToModel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using UnityEngine.SceneManagement;
55
using UnityEditor;
66
using Unity.FbxSdk;
7+
using System.Linq;
78

89
namespace FbxExporters
910
{
@@ -76,8 +77,7 @@ public static GameObject[] CreateInstantiatedModelPrefab (
7677
GameObject [] unityGameObjectsToConvert)
7778
{
7879
var toExport = ModelExporter.RemoveRedundantObjects (unityGameObjectsToConvert);
79-
var wasExported = new GameObject[toExport.Count];
80-
toExport.CopyTo (wasExported);
80+
var wasExported = Enumerable.ToArray (toExport);
8181
ConvertToPrefabEditorWindow.Init (wasExported);
8282
return wasExported;
8383
}

Assets/FbxExporters/Editor/ConvertToPrefabEditorWindow.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using UnityEditor;
55
using FbxExporters.EditorTools;
66
using UnityEditor.Presets;
7+
using System.Linq;
78

89
namespace FbxExporters
910
{
@@ -12,6 +13,7 @@ namespace Editor
1213
public class ConvertToPrefabEditorWindow : ExportOptionsEditorWindow
1314
{
1415
protected override GUIContent m_windowTitle { get { return new GUIContent ("Convert Options"); }}
16+
protected override float MinWindowHeight { get { return 280; } }
1517
private GameObject[] m_toConvert;
1618
private string m_prefabFileName = "";
1719

@@ -24,22 +26,19 @@ public static void Init (IEnumerable<GameObject> toConvert)
2426
}
2527

2628
protected void SetGameObjectsToConvert(IEnumerable<GameObject> toConvert){
27-
var tempList = new List<GameObject> ();
28-
foreach (var go in toConvert) {
29-
tempList.Add (go);
30-
}
31-
m_toConvert = tempList.ToArray ();
29+
m_toConvert = Enumerable.ToArray (toConvert);
3230

33-
if (m_toConvert.Length >= 1) {
31+
if (m_toConvert.Length == 1) {
3432
m_prefabFileName = m_toConvert [0].name;
35-
this.SetFilename (m_prefabFileName);
33+
} else if (m_toConvert.Length > 1) {
34+
m_prefabFileName = "(automatic)";
3635
}
36+
this.SetFilename (m_prefabFileName);
3737
}
3838

3939
protected override void OnEnable ()
4040
{
4141
base.OnEnable ();
42-
4342
if (!m_innerEditor) {
4443
var ms = ExportSettings.instance.convertToPrefabSettings;
4544
if (!ms) {

Assets/FbxExporters/Editor/ExportModelEditorWindow.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public abstract class ExportOptionsEditorWindow : EditorWindow
1919
protected const float TextFieldAlignOffset = 3;
2020
protected const float ExportButtonWidth = 100;
2121
protected const float FbxExtOffset = -7;
22+
protected virtual float MinWindowHeight { get { return 250; } }
2223

2324
protected virtual GUIContent m_windowTitle { get { return new GUIContent (DefaultWindowTitle); } }
2425

@@ -41,7 +42,7 @@ public abstract class ExportOptionsEditorWindow : EditorWindow
4142
protected virtual void OnEnable(){
4243
InitializeReceiver ();
4344
m_showOptions = true;
44-
this.minSize = new Vector2 (SelectableLabelMinWidth + LabelWidth + BrowseButtonWidth, 220);
45+
this.minSize = new Vector2 (SelectableLabelMinWidth + LabelWidth + BrowseButtonWidth, MinWindowHeight);
4546

4647
m_nameTextFieldStyle = new GUIStyle(GUIStyle.none);
4748
m_nameTextFieldStyle.alignment = TextAnchor.LowerCenter;

Assets/FbxExporters/Editor/FbxExportSettings.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -958,9 +958,9 @@ public static string[] GetRelativeSavePaths(List<string> exportSavePaths){
958958
string[] relSavePaths = new string[exportSavePaths.Count];
959959
// use special forward slash unicode char as "/" is a special character
960960
// that affects the dropdown layout.
961-
string forwardslash = "\u2044";
961+
string forwardslash = " \u2044 ";
962962
for (int i = 0; i < relSavePaths.Length; i++) {
963-
relSavePaths [i] = string.Format("Assets {0} {1}", forwardslash, exportSavePaths[i] == "."? "" : NormalizePath(exportSavePaths [i], isRelative: true).Replace("/", forwardslash));
963+
relSavePaths [i] = string.Format("Assets{0}{1}", forwardslash, exportSavePaths[i] == "."? "" : NormalizePath(exportSavePaths [i], isRelative: true).Replace("/", forwardslash));
964964
}
965965
return relSavePaths;
966966
}

0 commit comments

Comments
 (0)