@@ -3417,13 +3417,26 @@ internal int ExportAll (
3417
3417
int exportProgress = 0 ;
3418
3418
IEnumerable < GameObject > revisedExportSet = null ;
3419
3419
3420
+ // Total # of objects to be exported
3421
+ // Used by progress bar to show how many objects will be exported in total
3422
+ // i.e. exporting x/count...
3420
3423
int count = 0 ;
3424
+
3425
+ // number of object hierarchies being exported.
3426
+ // Used to figure out exported transforms for root objects.
3427
+ // i.e. if we are exporting a single hierarchy at local position, then it's root is set to zero,
3428
+ // but if we are exporting multiple hierarchies at local position, then each hierarchy will be recentered according
3429
+ // to the center of the bounding box.
3430
+ int rootObjCount = 0 ;
3431
+
3421
3432
if ( animOnly ) {
3422
3433
count = GetAnimOnlyHierarchyCount ( exportData ) ;
3423
3434
revisedExportSet = from entry in exportData select entry . Key ;
3435
+ rootObjCount = exportData . Keys . Count ;
3424
3436
} else {
3425
3437
var revisedGOSet = RemoveRedundantObjects ( unityExportSet ) ;
3426
3438
count = GetHierarchyCount ( revisedGOSet ) ;
3439
+ rootObjCount = revisedGOSet . Count ;
3427
3440
revisedExportSet = revisedGOSet ;
3428
3441
}
3429
3442
@@ -3438,7 +3451,7 @@ internal int ExportAll (
3438
3451
switch ( ExportOptions . ObjectPosition ) {
3439
3452
case ExportSettings . ObjectPosition . LocalCentered :
3440
3453
// one object to export -> move to (0,0,0)
3441
- if ( count == 1 ) {
3454
+ if ( rootObjCount == 1 ) {
3442
3455
var tempList = new List < GameObject > ( revisedExportSet ) ;
3443
3456
center = tempList [ 0 ] . transform . position ;
3444
3457
break ;
0 commit comments