Skip to content

Commit 0b7cf89

Browse files
authored
Merge pull request #442 from Unity-Technologies/UNI-55002-fix-broken-anim-only-export
Uni 55002 fix broken anim only export
2 parents 28e74d6 + 76a3aad commit 0b7cf89

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3417,13 +3417,26 @@ internal int ExportAll (
34173417
int exportProgress = 0;
34183418
IEnumerable<GameObject> revisedExportSet = null;
34193419

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...
34203423
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+
34213432
if(animOnly){
34223433
count = GetAnimOnlyHierarchyCount(exportData);
34233434
revisedExportSet = from entry in exportData select entry.Key;
3435+
rootObjCount = exportData.Keys.Count;
34243436
} else {
34253437
var revisedGOSet = RemoveRedundantObjects(unityExportSet);
34263438
count = GetHierarchyCount (revisedGOSet);
3439+
rootObjCount = revisedGOSet.Count;
34273440
revisedExportSet = revisedGOSet;
34283441
}
34293442

@@ -3438,7 +3451,7 @@ internal int ExportAll (
34383451
switch(ExportOptions.ObjectPosition){
34393452
case ExportSettings.ObjectPosition.LocalCentered:
34403453
// one object to export -> move to (0,0,0)
3441-
if(count == 1){
3454+
if(rootObjCount == 1){
34423455
var tempList = new List<GameObject>(revisedExportSet);
34433456
center = tempList[0].transform.position;
34443457
break;

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,18 @@ IExportOptions exportOptions
8080
Object uniObj = AnimationUtility.GetAnimatedObject(rootObject, uniCurveBinding);
8181
if (!uniObj)
8282
{
83-
return;
83+
continue;
8484
}
8585

8686
GameObject unityGo = ModelExporter.GetGameObject(uniObj);
8787
if (!unityGo)
8888
{
89-
return;
89+
continue;
9090
}
9191

9292
if (!exportOptions.AnimateSkinnedMesh && unityGo.GetComponent<SkinnedMeshRenderer>())
9393
{
94-
return;
94+
continue;
9595
}
9696

9797
// If we have a clip driving a camera or light then force the export of FbxNodeAttribute

0 commit comments

Comments
 (0)