File tree Expand file tree Collapse file tree 6 files changed +34
-21
lines changed
Assets/FbxExporters/Editor Expand file tree Collapse file tree 6 files changed +34
-21
lines changed Original file line number Diff line number Diff line change @@ -237,9 +237,18 @@ public static void UpdateLinkedPrefab(GameObject prefabInstance)
237
237
// Launch the manual update UI to allow the user to fix
238
238
// renamed nodes (or auto-update if there's nothing to rename).
239
239
var fbxPrefabUtility = new FbxPrefabUtility ( fbxPrefabComponent ) ;
240
- ManualUpdateEditorWindow window = ( ManualUpdateEditorWindow ) EditorWindow . GetWindow ( typeof ( ManualUpdateEditorWindow ) ) ;
241
- window . Init ( fbxPrefabUtility , fbxPrefabComponent ) ;
242
- window . Show ( ) ;
240
+
241
+ if ( FbxExporters . EditorTools . ExportSettings . instance . autoUpdaterEnabled || runningUnitTest )
242
+ {
243
+ fbxPrefabUtility . SyncPrefab ( ) ;
244
+ }
245
+ else
246
+ {
247
+ ManualUpdateEditorWindow window = ( ManualUpdateEditorWindow ) EditorWindow . GetWindow ( typeof ( ManualUpdateEditorWindow ) ) ;
248
+ window . Init ( fbxPrefabUtility , fbxPrefabComponent ) ;
249
+ window . Show ( ) ;
250
+ }
251
+
243
252
}
244
253
}
245
254
Original file line number Diff line number Diff line change @@ -19,8 +19,9 @@ public class DefaultSelectionTest : ExporterTestBase
19
19
protected bool m_centerObjectsSetting ;
20
20
21
21
[ SetUp ]
22
- public void Init ( )
22
+ public override void Init ( )
23
23
{
24
+ base . Init ( ) ;
24
25
m_centerObjectsSetting = FbxExporters . EditorTools . ExportSettings . instance . centerObjects ;
25
26
}
26
27
Original file line number Diff line number Diff line change @@ -18,8 +18,9 @@ public class ExportPerformanceTest : ExporterTestBase
18
18
private GameObject m_toExport ;
19
19
20
20
[ SetUp ]
21
- public void Init ( )
21
+ public override void Init ( )
22
22
{
23
+ base . Init ( ) ;
23
24
m_stopwatch = new Stopwatch ( ) ;
24
25
m_toExport = CreateGameObjectToExport ( ) ;
25
26
}
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ namespace FbxExporters.UnitTests
9
9
{
10
10
public abstract class ExporterTestBase
11
11
{
12
+ bool isAutoUpdaterOn ;
12
13
/// <summary>
13
14
/// Sleep an amount of time (in ms) so we can safely assume that the
14
15
/// timestamp on an fbx will change.
@@ -200,8 +201,19 @@ public virtual void Term ()
200
201
// Delete the directory on the next editor update. Otherwise,
201
202
// prefabs don't get deleted and the directory delete fails.
202
203
EditorApplication . update += DeleteOnNextUpdate ;
204
+
205
+ // Put back the initial setting for the auto-updater toggle
206
+ FbxExporters . EditorTools . ExportSettings . instance . autoUpdaterEnabled = isAutoUpdaterOn ;
203
207
}
204
208
209
+ [ SetUp ]
210
+ public virtual void Init ( )
211
+ {
212
+ isAutoUpdaterOn = FbxExporters . EditorTools . ExportSettings . instance . autoUpdaterEnabled ;
213
+ FbxExporters . EditorTools . ExportSettings . instance . autoUpdaterEnabled = true ;
214
+ }
215
+
216
+
205
217
/// <summary>
206
218
/// Exports the Objects in selected.
207
219
/// </summary>
Original file line number Diff line number Diff line change @@ -19,8 +19,9 @@ public class FbxPrefabAutoUpdaterTest : ExporterTestBase
19
19
string m_prefabPath ;
20
20
21
21
[ SetUp ]
22
- public void Init ( )
22
+ public override void Init ( )
23
23
{
24
+ base . Init ( ) ;
24
25
var capsule = GameObject . CreatePrimitive ( PrimitiveType . Capsule ) ;
25
26
m_fbx = ExportSelection ( capsule ) ;
26
27
m_fbxPath = AssetDatabase . GetAssetPath ( m_fbx ) ;
@@ -175,14 +176,6 @@ public void TestNameMapping()
175
176
176
177
public class FbxPrefabAutoUpdaterRemappingTest : ExporterTestBase
177
178
{
178
- bool isAutoUpdaterOn ;
179
- [ SetUp ]
180
- public void Init ( )
181
- {
182
- isAutoUpdaterOn = FbxExporters . EditorTools . ExportSettings . instance . autoUpdaterEnabled ;
183
- FbxExporters . EditorTools . ExportSettings . instance . autoUpdaterEnabled = true ;
184
- }
185
-
186
179
[ Test ]
187
180
public void RemappingTest ( )
188
181
{
@@ -228,19 +221,15 @@ public void RemappingTest()
228
221
Assert . IsTrue ( cubePrefabInstance . transform . GetChild ( 0 ) . name == "SphereFBX" ) ;
229
222
Assert . IsTrue ( cubePrefabInstance . transform . GetChild ( 0 ) . GetComponent < MeshFilter > ( ) . sharedMesh != null ) ;
230
223
}
231
- [ TearDown ]
232
- public void stopTest ( )
233
- {
234
- FbxExporters . EditorTools . ExportSettings . instance . autoUpdaterEnabled = isAutoUpdaterOn ;
235
- }
236
224
}
237
225
238
226
public class FbxPrefabAutoUpdaterToggleTest : ExporterTestBase
239
227
{
240
228
bool isAutoUpdaterOn ;
241
229
[ SetUp ]
242
- public void Init ( )
230
+ public override void Init ( )
243
231
{
232
+ base . Init ( ) ;
244
233
// Save the initial setting for the auto updater toggle and disable it for the unit test
245
234
isAutoUpdaterOn = FbxExporters . EditorTools . ExportSettings . instance . autoUpdaterEnabled ;
246
235
FbxExporters . EditorTools . ExportSettings . instance . autoUpdaterEnabled = false ;
Original file line number Diff line number Diff line change @@ -146,7 +146,8 @@ public static void AssertAreDifferent(
146
146
}
147
147
148
148
[ SetUp ]
149
- public void Init ( ) {
149
+ public override void Init ( ) {
150
+ base . Init ( ) ;
150
151
// Create a test hierarchy. It has unique names.
151
152
m_original = CreateHierarchy ( "FbxPrefabTestRoot" ) ;
152
153
m_originalRep = Rep ( m_original ) ;
You can’t perform that action at this time.
0 commit comments