3
3
using UnityEngine ;
4
4
using UnityEditor ;
5
5
using FbxExporters . EditorTools ;
6
+ #if UNITY_2018_1_OR_NEWER
6
7
using UnityEditor . Presets ;
8
+ #endif
7
9
using System . Linq ;
8
10
9
11
namespace FbxExporters
@@ -29,8 +31,9 @@ public abstract class ExportOptionsEditorWindow : EditorWindow
29
31
protected string m_exportFileName = "" ;
30
32
31
33
protected UnityEditor . Editor m_innerEditor ;
34
+ #if UNITY_2018_1_OR_NEWER
32
35
protected FbxExportPresetSelectorReceiver m_receiver ;
33
-
36
+ #endif
34
37
private static GUIContent presetIcon { get { return EditorGUIUtility . IconContent ( "Preset.Context" ) ; } }
35
38
private static GUIStyle presetIconButton { get { return new GUIStyle ( "IconButton" ) ; } }
36
39
@@ -41,8 +44,9 @@ public abstract class ExportOptionsEditorWindow : EditorWindow
41
44
protected float m_fbxExtLabelWidth ;
42
45
43
46
protected virtual void OnEnable ( ) {
47
+ #if UNITY_2018_1_OR_NEWER
44
48
InitializeReceiver ( ) ;
45
-
49
+ #endif
46
50
m_showOptions = true ;
47
51
this . minSize = new Vector2 ( SelectableLabelMinWidth + LabelWidth + BrowseButtonWidth , MinWindowHeight ) ;
48
52
@@ -67,6 +71,7 @@ protected virtual void InitializeWindow(string filename = ""){
67
71
this . SetFilename ( filename ) ;
68
72
}
69
73
74
+ #if UNITY_2018_1_OR_NEWER
70
75
protected void InitializeReceiver ( ) {
71
76
if ( ! m_receiver ) {
72
77
m_receiver = ScriptableObject . CreateInstance < FbxExportPresetSelectorReceiver > ( ) as FbxExportPresetSelectorReceiver ;
@@ -76,6 +81,7 @@ protected void InitializeReceiver(){
76
81
m_receiver . DialogClosed += SaveExportSettings ;
77
82
}
78
83
}
84
+ #endif
79
85
80
86
public void SetFilename ( string filename ) {
81
87
// remove .fbx from end of filename
@@ -110,6 +116,7 @@ protected virtual bool DisableNameSelection(){
110
116
return false ;
111
117
}
112
118
119
+ #if UNITY_2018_1_OR_NEWER
113
120
protected abstract void ShowPresetReceiver ( ) ;
114
121
115
122
protected void ShowPresetReceiver ( UnityEngine . Object target ) {
@@ -118,6 +125,7 @@ protected void ShowPresetReceiver(UnityEngine.Object target){
118
125
m_receiver . SetInitialValue ( new Preset ( target ) ) ;
119
126
UnityEditor . Presets . PresetSelector . ShowSelector ( target , null , true , m_receiver ) ;
120
127
}
128
+ #endif
121
129
122
130
protected void OnGUI ( )
123
131
{
@@ -126,10 +134,14 @@ protected void OnGUI ()
126
134
127
135
GUILayout . BeginHorizontal ( ) ;
128
136
GUILayout . FlexibleSpace ( ) ;
129
- if ( EditorGUILayout . DropdownButton ( presetIcon , FocusType . Keyboard , presetIconButton ) ) {
137
+
138
+ #if UNITY_2018_1_OR_NEWER
139
+ if ( EditorGUILayout . DropdownButton ( presetIcon , FocusType . Keyboard , presetIconButton ) ) {
130
140
ShowPresetReceiver ( ) ;
131
141
}
132
- GUILayout . EndHorizontal ( ) ;
142
+ #endif
143
+
144
+ GUILayout . EndHorizontal ( ) ;
133
145
134
146
EditorGUILayout . LabelField ( "Naming" ) ;
135
147
EditorGUI . indentLevel ++ ;
@@ -364,10 +376,12 @@ protected override void Export(){
364
376
}
365
377
}
366
378
379
+ #if UNITY_2018_1_OR_NEWER
367
380
protected override void ShowPresetReceiver ( )
368
381
{
369
382
ShowPresetReceiver ( ExportSettings . instance . exportModelSettings ) ;
370
383
}
384
+ #endif
371
385
}
372
386
}
373
387
}
0 commit comments