@@ -16,12 +16,13 @@ public class ModelConverter : IImported
16
16
17
17
private ImageFormat imageFormat ;
18
18
private Avatar avatar ;
19
- private AnimationClip [ ] animationClipUniqArray = Array . Empty < AnimationClip > ( ) ; //TODO: a proper AnimationClip equality comparer
19
+ private AnimationClip [ ] animationClipUniqArray = Array . Empty < AnimationClip > ( ) ;
20
20
private Dictionary < AnimationClip , string > boundAnimationPathDic = new Dictionary < AnimationClip , string > ( ) ;
21
21
private Dictionary < uint , string > bonePathHash = new Dictionary < uint , string > ( ) ;
22
22
private Dictionary < Texture2D , string > textureNameDictionary = new Dictionary < Texture2D , string > ( ) ;
23
23
private Dictionary < Transform , ImportedFrame > transformDictionary = new Dictionary < Transform , ImportedFrame > ( ) ;
24
24
Dictionary < uint , string > morphChannelNames = new Dictionary < uint , string > ( ) ;
25
+ private IEqualityComparer < AnimationClip > animationClipEqComparer = new AnimationClip . EqComparer ( ) ;
25
26
26
27
public ModelConverter ( GameObject m_GameObject , ImageFormat imageFormat , AnimationClip [ ] animationList = null )
27
28
{
@@ -40,7 +41,7 @@ public ModelConverter(GameObject m_GameObject, ImageFormat imageFormat, Animatio
40
41
}
41
42
if ( animationList != null )
42
43
{
43
- animationClipUniqArray = animationList . Distinct ( ) . ToArray ( ) ;
44
+ animationClipUniqArray = animationList . Distinct ( animationClipEqComparer ) . ToArray ( ) ;
44
45
}
45
46
ConvertAnimations ( ) ;
46
47
}
@@ -67,7 +68,7 @@ public ModelConverter(string rootName, List<GameObject> m_GameObjects, ImageForm
67
68
}
68
69
if ( animationList != null )
69
70
{
70
- animationClipUniqArray = animationList . Distinct ( ) . ToArray ( ) ;
71
+ animationClipUniqArray = animationList . Distinct ( animationClipEqComparer ) . ToArray ( ) ;
71
72
}
72
73
ConvertAnimations ( ) ;
73
74
}
@@ -82,7 +83,7 @@ public ModelConverter(Animator m_Animator, ImageFormat imageFormat, AnimationCli
82
83
}
83
84
else
84
85
{
85
- animationClipUniqArray = animationList . Distinct ( ) . ToArray ( ) ;
86
+ animationClipUniqArray = animationList . Distinct ( animationClipEqComparer ) . ToArray ( ) ;
86
87
}
87
88
ConvertAnimations ( ) ;
88
89
}
@@ -163,7 +164,7 @@ private void ConvertMeshRenderer(Transform m_Transform)
163
164
animationList . Add ( animationClip ) ;
164
165
}
165
166
}
166
- animationClipUniqArray = animationList . Distinct ( ) . ToArray ( ) ;
167
+ animationClipUniqArray = animationList . Distinct ( animationClipEqComparer ) . ToArray ( ) ;
167
168
}
168
169
169
170
foreach ( var pptr in m_Transform . m_Children )
@@ -207,7 +208,7 @@ private void CollectAnimationClip(Animator m_Animator)
207
208
break ;
208
209
}
209
210
}
210
- animationClipUniqArray = animationList . Distinct ( ) . ToArray ( ) ;
211
+ animationClipUniqArray = animationList . Distinct ( animationClipEqComparer ) . ToArray ( ) ;
211
212
}
212
213
}
213
214
0 commit comments