Skip to content

Commit 7d44984

Browse files
committed
fix so preset button shows appropriate presets
- convert to prefab window shows convert to prefab presets, and export model window shows export model presets
1 parent 55c371f commit 7d44984

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

Assets/FbxExporters/Editor/ConvertToPrefabEditorWindow.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,14 @@ protected override bool DisableNameSelection ()
8282
return m_toConvert.Length > 1;
8383
}
8484

85+
protected override void ShowPresetReceiver ()
86+
{
87+
InitializeReceiver ();
88+
m_receiver.SetTarget(ExportSettings.instance.convertToPrefabSettings);
89+
m_receiver.SetInitialValue (new Preset (ExportSettings.instance.convertToPrefabSettings));
90+
UnityEditor.Presets.PresetSelector.ShowSelector(ExportSettings.instance.convertToPrefabSettings, null, true, m_receiver);
91+
}
92+
8593
protected override void CreateCustomUI ()
8694
{
8795
GUILayout.BeginHorizontal ();

Assets/FbxExporters/Editor/ExportModelEditorWindow.cs

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public abstract class ExportOptionsEditorWindow : EditorWindow
2727
protected bool m_singleHierarchyExport = true;
2828

2929
protected UnityEditor.Editor m_innerEditor;
30-
private FbxExportPresetSelectorReceiver m_receiver;
30+
protected FbxExportPresetSelectorReceiver m_receiver;
3131

3232
private static GUIContent presetIcon { get { return EditorGUIUtility.IconContent ("Preset.Context"); }}
3333
private static GUIStyle presetIconButton { get { return new GUIStyle("IconButton"); }}
@@ -70,7 +70,7 @@ private void SetTitle(){
7070
this.titleContent = m_windowTitle;
7171
}
7272

73-
private void InitializeReceiver(){
73+
protected void InitializeReceiver(){
7474
if (!m_receiver) {
7575
m_receiver = ScriptableObject.CreateInstance<FbxExportPresetSelectorReceiver> () as FbxExportPresetSelectorReceiver;
7676
m_receiver.SelectionChanged -= OnPresetSelectionChanged;
@@ -128,6 +128,8 @@ protected virtual bool DisableNameSelection(){
128128
return false;
129129
}
130130

131+
protected abstract void ShowPresetReceiver ();
132+
131133
protected void OnGUI ()
132134
{
133135
// Increasing the label width so that none of the text gets cut off
@@ -136,10 +138,7 @@ protected void OnGUI ()
136138
GUILayout.BeginHorizontal ();
137139
GUILayout.FlexibleSpace ();
138140
if(EditorGUILayout.DropdownButton(presetIcon, FocusType.Keyboard, presetIconButton)){
139-
InitializeReceiver ();
140-
m_receiver.SetTarget(ExportSettings.instance.exportModelSettings);
141-
m_receiver.SetInitialValue (new Preset (ExportSettings.instance.exportModelSettings));
142-
UnityEditor.Presets.PresetSelector.ShowSelector(ExportSettings.instance.exportModelSettings, null, true, m_receiver);
141+
ShowPresetReceiver ();
143142
}
144143
GUILayout.EndHorizontal();
145144

@@ -299,6 +298,14 @@ protected override void Export(){
299298
AssetDatabase.Refresh ();
300299
}
301300
}
301+
302+
protected override void ShowPresetReceiver ()
303+
{
304+
InitializeReceiver ();
305+
m_receiver.SetTarget(ExportSettings.instance.exportModelSettings);
306+
m_receiver.SetInitialValue (new Preset (ExportSettings.instance.exportModelSettings));
307+
UnityEditor.Presets.PresetSelector.ShowSelector(ExportSettings.instance.exportModelSettings, null, true, m_receiver);
308+
}
302309
}
303310
}
304311
}

0 commit comments

Comments
 (0)