Skip to content

Commit b4031d9

Browse files
committed
store anim clips in dictionary instead of hashset
1 parent 9f48747 commit b4031d9

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

Assets/FbxExporters/Editor/FbxExporter.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,7 +2182,7 @@ protected void ExportAnimationOnly(
21822182
int exportProgress,
21832183
int objectCount,
21842184
Vector3 newCenter,
2185-
HashSet<AnimationClip> animationClips,
2185+
Dictionary<AnimationClip, GameObject> animationClips,
21862186
HashSet<GameObject> goExportSet,
21872187
Dictionary<GameObject, System.Type> exportComponent,
21882188
TransformExportType exportType = TransformExportType.Local
@@ -2235,7 +2235,7 @@ protected void ExportAnimationOnly(
22352235

22362236
// export animation
22372237
foreach (var animClip in animationClips) {
2238-
//ExportAnimationClip (animClip, animationRootObject, fbxScene);
2238+
ExportAnimationClip (animClip.Key, animClip.Value, fbxScene);
22392239
}
22402240
}
22412241

@@ -2394,11 +2394,11 @@ private bool ExportBoneTransform(
23942394

23952395
protected int AnimOnlyHierarchyCount(
23962396
HashSet<GameObject> exportSet,
2397-
out HashSet<AnimationClip> animationClips,
2397+
out Dictionary<AnimationClip, GameObject> animationClips,
23982398
out Dictionary<GameObject, HashSet<GameObject>> mapGameObjectToExportSet,
23992399
out Dictionary<GameObject, System.Type> exportComponent
24002400
){
2401-
animationClips = new HashSet<AnimationClip> ();
2401+
animationClips = new Dictionary<AnimationClip, GameObject> ();
24022402
mapGameObjectToExportSet = new Dictionary<GameObject, HashSet<GameObject>> ();
24032403
exportComponent = new Dictionary<GameObject, System.Type> ();
24042404

@@ -2436,19 +2436,21 @@ protected int AnimOnlyHierarchyCount(
24362436
protected void GetObjectsInAnimationClips(
24372437
AnimationClip[] animClips,
24382438
GameObject animationRootObject,
2439-
ref HashSet<AnimationClip> clipSet,
2439+
ref Dictionary<AnimationClip, GameObject> clipSet,
24402440
ref HashSet<GameObject> goToExport,
24412441
ref Dictionary<GameObject, System.Type> exportComponent
24422442
){
24432443
var cameraProps = new List<string>{"field of view"};
24442444
var lightProps = new List<string>{"m_Intensity", "m_SpotAngle", "m_Color.r", "m_Color.g", "m_Color.b"};
24452445

24462446
foreach (var animClip in animClips) {
2447-
if (!clipSet.Add (animClip)) {
2447+
if (clipSet.ContainsKey(animClip)) {
24482448
// we have already exported gameobjects for this clip
24492449
continue;
24502450
}
24512451

2452+
clipSet.Add (animClip, animationRootObject);
2453+
24522454
foreach (EditorCurveBinding uniCurveBinding in AnimationUtility.GetCurveBindings (animClip)) {
24532455
Object uniObj = AnimationUtility.GetAnimatedObject (animationRootObject, uniCurveBinding);
24542456
if (!uniObj) {

0 commit comments

Comments
 (0)