@@ -9,6 +9,23 @@ public class ExportModelSettingsEditor : UnityEditor.Editor
9
9
private const float LabelWidth = 175 ;
10
10
private const float FieldOffset = 18 ;
11
11
12
+ private string [ ] exportFormatOptions = new string [ ] { "ASCII" , "Binary" } ;
13
+ private string [ ] includeOptions = new string [ ] { "Model(s) Only" , "Animation Only" , "Model(s) + Animation" } ;
14
+ private string [ ] lodOptions = new string [ ] { "All" , "Highest" , "Lowest" } ;
15
+
16
+ public const string singleHierarchyOption = "Local Pivot" ;
17
+ public const string multiHerarchyOption = "Local Centered" ;
18
+ private string hierarchyDepOption = "" ;
19
+ private string [ ] objPositionOptions { get { return new string [ ] { hierarchyDepOption , "World Absolute" } ; } }
20
+
21
+ public void SetIsSingleHierarchy ( bool singleHierarchy ) {
22
+ if ( singleHierarchy ) {
23
+ hierarchyDepOption = singleHierarchyOption ;
24
+ return ;
25
+ }
26
+ hierarchyDepOption = multiHerarchyOption ;
27
+ }
28
+
12
29
public override void OnInspectorGUI ( )
13
30
{
14
31
var exportSettings = ( ( ExportModelSettings ) target ) . info ;
@@ -18,24 +35,24 @@ public override void OnInspectorGUI ()
18
35
GUILayout . BeginHorizontal ( ) ;
19
36
EditorGUILayout . LabelField ( new GUIContent ( "Export Format" , "Export the FBX file in the standard binary format." +
20
37
" Select ASCII to export the FBX file in ASCII format." ) , GUILayout . Width ( LabelWidth - FieldOffset ) ) ;
21
- exportSettings . exportFormat = ( ExportModelSettingsSerialize . ExportFormat ) EditorGUILayout . Popup ( ( int ) exportSettings . exportFormat , new string [ ] { "ASCII" , "Binary" } ) ;
38
+ exportSettings . exportFormat = ( ExportModelSettingsSerialize . ExportFormat ) EditorGUILayout . Popup ( ( int ) exportSettings . exportFormat , exportFormatOptions ) ;
22
39
GUILayout . EndHorizontal ( ) ;
23
40
24
41
GUILayout . BeginHorizontal ( ) ;
25
42
EditorGUILayout . LabelField ( new GUIContent ( "Include" , "Select whether to export models, animation or both." ) , GUILayout . Width ( LabelWidth - FieldOffset ) ) ;
26
- exportSettings . include = ( ExportModelSettingsSerialize . Include ) EditorGUILayout . Popup ( ( int ) exportSettings . include , new string [ ] { "Model(s) Only" , "Animation Only" , "Model(s) + Animation" } ) ;
43
+ exportSettings . include = ( ExportModelSettingsSerialize . Include ) EditorGUILayout . Popup ( ( int ) exportSettings . include , includeOptions ) ;
27
44
GUILayout . EndHorizontal ( ) ;
28
45
29
46
// greyed out if animation only
30
47
EditorGUI . BeginDisabledGroup ( exportSettings . include == ExportModelSettingsSerialize . Include . Anim ) ;
31
48
GUILayout . BeginHorizontal ( ) ;
32
49
EditorGUILayout . LabelField ( new GUIContent ( "LOD level" , "Select which LOD to export." ) , GUILayout . Width ( LabelWidth - FieldOffset ) ) ;
33
- exportSettings . lodLevel = ( ExportModelSettingsSerialize . LODExportType ) EditorGUILayout . Popup ( ( int ) exportSettings . lodLevel , new string [ ] { "All" , "Highest" , "Lowest" } ) ;
50
+ exportSettings . lodLevel = ( ExportModelSettingsSerialize . LODExportType ) EditorGUILayout . Popup ( ( int ) exportSettings . lodLevel , lodOptions ) ;
34
51
GUILayout . EndHorizontal ( ) ;
35
52
36
53
GUILayout . BeginHorizontal ( ) ;
37
54
EditorGUILayout . LabelField ( new GUIContent ( "Object(s) Position" , "Select an option for exporting object's transform." ) , GUILayout . Width ( LabelWidth - FieldOffset ) ) ;
38
- exportSettings . objectPosition = ( ExportModelSettingsSerialize . ObjectPosition ) EditorGUILayout . Popup ( ( int ) exportSettings . objectPosition , new string [ ] { "Local Centered" , "World Absolute" , "Local Pivot" } ) ;
55
+ exportSettings . objectPosition = ( ExportModelSettingsSerialize . ObjectPosition ) EditorGUILayout . Popup ( ( int ) exportSettings . objectPosition , objPositionOptions ) ;
39
56
GUILayout . EndHorizontal ( ) ;
40
57
EditorGUI . EndDisabledGroup ( ) ;
41
58
@@ -79,7 +96,7 @@ public enum ExportFormat { ASCII = 0, Binary = 1}
79
96
80
97
public enum Include { Model = 0 , Anim = 1 , ModelAndAnim = 2 }
81
98
82
- public enum ObjectPosition { LocalCentered = 0 , WorldAbsolute = 1 , LocalPivot = 2 }
99
+ public enum ObjectPosition { LocalCentered = 0 , WorldAbsolute = 1 }
83
100
84
101
public enum LODExportType { All = 0 , Highest = 1 , Lowest = 2 }
85
102
0 commit comments