Skip to content

Commit 002ecdd

Browse files
authored
Merge pull request #358 from Unity-Technologies/UNI-42094-animated-skinned-mesh-transforms
UNI-42094 don't export skinned mesh transform if "animated skinned mesh" off
2 parents b7895c3 + cc95490 commit 002ecdd

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2342,7 +2342,8 @@ public AnimationOnlyExportData(
23422342

23432343
public void ComputeObjectsInAnimationClips(
23442344
AnimationClip[] animClips,
2345-
GameObject animationRootObject
2345+
GameObject animationRootObject,
2346+
bool exportSkinnedMeshAnim = true
23462347
){
23472348
foreach (var animClip in animClips) {
23482349
if (this.animationClips.ContainsKey(animClip)) {
@@ -2363,6 +2364,10 @@ GameObject animationRootObject
23632364
continue;
23642365
}
23652366

2367+
if (!exportSkinnedMeshAnim && unityGo.GetComponent<SkinnedMeshRenderer>()) {
2368+
continue;
2369+
}
2370+
23662371
if (lightProps.Contains (uniCurveBinding.propertyName)) {
23672372
this.exportComponent.Add (unityGo, typeof(Light));
23682373
} else if (cameraProps.Contains (uniCurveBinding.propertyName)) {
@@ -2720,7 +2725,7 @@ protected Dictionary<GameObject, AnimationOnlyExportData> GetTimelineAnimationEx
27202725
var exportComponent = new Dictionary<GameObject, System.Type>();
27212726

27222727
var exportData = new AnimationOnlyExportData(animationClips, goToExport, exportComponent);
2723-
exportData.ComputeObjectsInAnimationClips(animationClipsList.ToArray(), rootObject);
2728+
exportData.ComputeObjectsInAnimationClips(animationClipsList.ToArray(), rootObject, ExportOptions.AnimateSkinnedMesh);
27242729

27252730
Dictionary<GameObject, AnimationOnlyExportData> data = new Dictionary<GameObject, AnimationOnlyExportData>();
27262731
data.Add(rootObject, exportData);
@@ -2758,7 +2763,7 @@ protected Dictionary<GameObject, AnimationOnlyExportData> GetAnimationExportData
27582763
}
27592764

27602765
var animClips = AnimationUtility.GetAnimationClips(anim.gameObject);
2761-
exportData.ComputeObjectsInAnimationClips(animClips, anim.gameObject);
2766+
exportData.ComputeObjectsInAnimationClips(animClips, anim.gameObject, ExportOptions.AnimateSkinnedMesh);
27622767
}
27632768

27642769
int depthFromRootAnimator = int.MaxValue;
@@ -2777,7 +2782,7 @@ protected Dictionary<GameObject, AnimationOnlyExportData> GetAnimationExportData
27772782
var controller = anim.runtimeAnimatorController;
27782783
if (controller)
27792784
{
2780-
exportData.ComputeObjectsInAnimationClips(controller.animationClips, anim.gameObject);
2785+
exportData.ComputeObjectsInAnimationClips(controller.animationClips, anim.gameObject, ExportOptions.AnimateSkinnedMesh);
27812786
}
27822787
}
27832788

0 commit comments

Comments
 (0)