@@ -17,13 +17,13 @@ namespace FbxExporters.UnitTests
17
17
public class DefaultSelectionTest : ExporterTestBase
18
18
{
19
19
protected GameObject m_root ;
20
- protected ExportModelSettingsSerialize . ObjectPosition m_centerObjectsSetting ;
20
+ protected ExportModelSettings m_centerObjectsSetting ;
21
21
22
22
[ SetUp ]
23
23
public override void Init ( )
24
24
{
25
25
base . Init ( ) ;
26
- // m_centerObjectsSetting = FbxExporters.EditorTools.ExportSettings.GetObjectPosition() ;
26
+ m_centerObjectsSetting = ScriptableObject . CreateInstance ( typeof ( ExportModelSettings ) ) as ExportModelSettings ;
27
27
}
28
28
29
29
[ TearDown ]
@@ -33,8 +33,6 @@ public override void Term ()
33
33
if ( m_root ) {
34
34
UnityEngine . Object . DestroyImmediate ( m_root ) ;
35
35
}
36
- // restore original setting
37
- // FbxExporters.EditorTools.ExportSettings.SetObjectPosition(m_centerObjectsSetting);
38
36
}
39
37
40
38
[ Test ]
@@ -63,12 +61,12 @@ public void TestDefaultSelection ()
63
61
Assert . IsNotNull ( m_root ) ;
64
62
65
63
// test without centered objects
66
- //FbxExporters.EditorTools.ExportSettings .SetObjectPosition(ExportModelSettingsSerialize.ObjectPosition.WorldAbsolute);
64
+ m_centerObjectsSetting . SetObjectPosition ( ExportModelSettingsSerialize . ObjectPosition . WorldAbsolute ) ;
67
65
68
66
// test Export Root
69
67
// Expected result: everything gets exported
70
68
// Expected transform: all transforms unchanged
71
- var exportedRoot = ExportSelection ( new Object [ ] { m_root } ) ;
69
+ var exportedRoot = ExportSelection ( m_root , m_centerObjectsSetting ) ;
72
70
CompareHierarchies ( m_root , exportedRoot , true , false ) ;
73
71
CompareGlobalTransform ( exportedRoot . transform , m_root . transform ) ;
74
72
@@ -77,15 +75,15 @@ public void TestDefaultSelection ()
77
75
// Expected transform: all transforms unchanged
78
76
var parent1 = m_root . transform . Find ( "Parent1" ) ;
79
77
var child1 = parent1 . Find ( "Child1" ) ;
80
- exportedRoot = ExportSelection ( new Object [ ] { parent1 . gameObject , child1 . gameObject } ) ;
78
+ exportedRoot = ExportSelection ( new Object [ ] { parent1 . gameObject , child1 . gameObject } , m_centerObjectsSetting ) ;
81
79
CompareHierarchies ( parent1 . gameObject , exportedRoot , true , false ) ;
82
80
CompareGlobalTransform ( exportedRoot . transform , parent1 ) ;
83
81
84
82
// test Export Child2
85
83
// Expected result: Child2
86
84
// Expected transform: Child2 unchanged
87
85
var child2 = parent1 . Find ( "Child2" ) . gameObject ;
88
- exportedRoot = ExportSelection ( new Object [ ] { child2 } ) ;
86
+ exportedRoot = ExportSelection ( child2 , m_centerObjectsSetting ) ;
89
87
CompareHierarchies ( child2 , exportedRoot , true , false ) ;
90
88
CompareGlobalTransform ( exportedRoot . transform , child2 . transform ) ;
91
89
@@ -98,20 +96,20 @@ public void TestDefaultSelection ()
98
96
var goExportSet = new GameObject [ ] { child2 . gameObject , parent2 . gameObject } ;
99
97
100
98
// test without centering objects
101
- //FbxExporters.EditorTools.ExportSettings .SetObjectPosition(ExportModelSettingsSerialize.ObjectPosition.WorldAbsolute);
99
+ m_centerObjectsSetting . SetObjectPosition ( ExportModelSettingsSerialize . ObjectPosition . WorldAbsolute ) ;
102
100
103
- exportedRoot = ExportSelection ( exportSet ) ;
101
+ exportedRoot = ExportSelection ( exportSet , m_centerObjectsSetting ) ;
104
102
List < GameObject > children = new List < GameObject > ( ) ;
105
103
foreach ( Transform child in exportedRoot . transform ) {
106
104
children . Add ( child . gameObject ) ;
107
105
}
108
106
CompareHierarchies ( new GameObject [ ] { child2 , parent2 . gameObject } , children . ToArray ( ) ) ;
109
107
110
108
// test with centered objects
111
- //FbxExporters.EditorTools.ExportSettings .SetObjectPosition(ExportModelSettingsSerialize.ObjectPosition.LocalCentered);
109
+ m_centerObjectsSetting . SetObjectPosition ( ExportModelSettingsSerialize . ObjectPosition . LocalCentered ) ;
112
110
var newCenter = FbxExporters . Editor . ModelExporter . FindCenter ( goExportSet ) ;
113
111
114
- exportedRoot = ExportSelection ( exportSet ) ;
112
+ exportedRoot = ExportSelection ( exportSet , m_centerObjectsSetting ) ;
115
113
children = new List < GameObject > ( ) ;
116
114
foreach ( Transform child in exportedRoot . transform ) {
117
115
children . Add ( child . gameObject ) ;
0 commit comments