Skip to content

Commit eaa9686

Browse files
committed
fix calculating center of object.
was using "count" as if it was the number of root objects, when it's actually the total number of objects to export. Added a new var for the root objects
1 parent 827a446 commit eaa9686

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Packages/com.unity.formats.fbx/Editor/Scripts/FbxExporter.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3418,12 +3418,16 @@ internal int ExportAll (
34183418
IEnumerable<GameObject> revisedExportSet = null;
34193419

34203420
int count = 0;
3421+
int rootObjCount = 0; // # of objects to export that are root objects
3422+
34213423
if(animOnly){
34223424
count = GetAnimOnlyHierarchyCount(exportData);
34233425
revisedExportSet = from entry in exportData select entry.Key;
3426+
rootObjCount = exportData.Keys.Count;
34243427
} else {
34253428
var revisedGOSet = RemoveRedundantObjects(unityExportSet);
34263429
count = GetHierarchyCount (revisedGOSet);
3430+
rootObjCount = revisedGOSet.Count;
34273431
revisedExportSet = revisedGOSet;
34283432
}
34293433

@@ -3438,7 +3442,7 @@ internal int ExportAll (
34383442
switch(ExportOptions.ObjectPosition){
34393443
case ExportSettings.ObjectPosition.LocalCentered:
34403444
// one object to export -> move to (0,0,0)
3441-
if(count == 1){
3445+
if(rootObjCount == 1){
34423446
var tempList = new List<GameObject>(revisedExportSet);
34433447
center = tempList[0].transform.position;
34443448
break;

0 commit comments

Comments
 (0)