@@ -166,7 +166,7 @@ public static GameObject Convert (
166
166
}
167
167
168
168
// Copy the mesh/materials from the FBX
169
- UpdateFromFBX ( toConvert , unityMainAsset ) ;
169
+ UpdateFromSourceRecursive ( toConvert , unityMainAsset ) ;
170
170
171
171
// Set up the FbxPrefab component so it will auto-update.
172
172
// Make sure to delete whatever FbxPrefab history we had.
@@ -265,15 +265,15 @@ public static void EnforceUniqueNames(IEnumerable<GameObject> exportSet)
265
265
/// Updates the meshes and materials of the exported GameObjects
266
266
/// to link to those imported from the FBX.
267
267
/// </summary>
268
- /// <param name="orig">Original .</param>
269
- /// <param name="fbx">Fbx .</param>
270
- public static void UpdateFromFBX ( GameObject orig , GameObject fbx )
268
+ /// <param name="dest">GameObject to update .</param>
269
+ /// <param name="source">Source to update from .</param>
270
+ public static void UpdateFromSourceRecursive ( GameObject dest , GameObject source )
271
271
{
272
272
// recurse over orig, for each transform finding the corresponding transform in the FBX
273
273
// and copying the meshes and materials over from the FBX
274
- var goDict = GetNameToFbxGameObject ( orig , fbx ) ;
274
+ var goDict = MapNameToSourceRecursive ( dest , source ) ;
275
275
var q = new Queue < Transform > ( ) ;
276
- q . Enqueue ( orig . transform ) ;
276
+ q . Enqueue ( dest . transform ) ;
277
277
while ( q . Count > 0 ) {
278
278
var t = q . Dequeue ( ) ;
279
279
@@ -289,16 +289,16 @@ public static void UpdateFromFBX(GameObject orig, GameObject fbx)
289
289
}
290
290
291
291
/// <summary>
292
- /// Gets a dictionary linking exported GameObject name to fbx game object.
292
+ /// Gets a dictionary linking dest GameObject name to source game object.
293
293
/// </summary>
294
- /// <returns>Dictionary containing the name to fbx game object.</returns>
295
- /// <param name="orig">Original .</param>
296
- /// <param name="fbx">Fbx .</param>
297
- private static Dictionary < string , GameObject > GetNameToFbxGameObject ( GameObject orig , GameObject fbx ) {
294
+ /// <returns>Dictionary containing the name to source game object.</returns>
295
+ /// <param name="dest">Destination GameObject .</param>
296
+ /// <param name="source">Source GameObject .</param>
297
+ private static Dictionary < string , GameObject > MapNameToSourceRecursive ( GameObject dest , GameObject source ) {
298
298
var nameToGO = new Dictionary < string , GameObject > ( ) ;
299
299
300
300
var q = new Queue < Transform > ( ) ;
301
- q . Enqueue ( orig . transform ) ;
301
+ q . Enqueue ( dest . transform ) ;
302
302
while ( q . Count > 0 ) {
303
303
var t = q . Dequeue ( ) ;
304
304
nameToGO [ t . name ] = null ;
@@ -307,10 +307,10 @@ private static Dictionary<string,GameObject> GetNameToFbxGameObject(GameObject o
307
307
}
308
308
}
309
309
310
- nameToGO [ orig . name ] = fbx ;
310
+ nameToGO [ dest . name ] = source ;
311
311
312
312
var fbxQ = new Queue < Transform > ( ) ;
313
- foreach ( Transform child in fbx . transform ) {
313
+ foreach ( Transform child in source . transform ) {
314
314
fbxQ . Enqueue ( child ) ;
315
315
}
316
316
0 commit comments