@@ -47,57 +47,72 @@ public AnimationOnlyExportData(
47
47
}
48
48
49
49
/// <summary>
50
- /// collect all objects dependencies for animation clips.
50
+ /// collect all object dependencies for given animation clip
51
51
/// </summary>
52
52
public void CollectDependencies (
53
- AnimationClip [ ] animClips ,
53
+ AnimationClip animClip ,
54
54
GameObject rootObject ,
55
55
IExportOptions exportOptions
56
56
)
57
57
{
58
58
Debug . Assert ( rootObject != null ) ;
59
59
Debug . Assert ( exportOptions != null ) ;
60
60
61
+ if ( this . animationClips . ContainsKey ( animClip ) )
62
+ {
63
+ // we have already exported gameobjects for this clip
64
+ return ;
65
+ }
66
+
61
67
// NOTE: the object (animationRootObject) containing the animation is not necessarily animated
62
68
// when driven by an animator or animation component.
63
- foreach ( var animClip in animClips )
69
+ this . animationClips . Add ( animClip , rootObject ) ;
70
+
71
+ foreach ( EditorCurveBinding uniCurveBinding in AnimationUtility . GetCurveBindings ( animClip ) )
64
72
{
65
- if ( this . animationClips . ContainsKey ( animClip ) )
73
+ Object uniObj = AnimationUtility . GetAnimatedObject ( rootObject , uniCurveBinding ) ;
74
+ if ( ! uniObj )
66
75
{
67
- // we have already exported gameobjects for this clip
68
- continue ;
76
+ return ;
69
77
}
70
78
71
- this . animationClips . Add ( animClip , rootObject ) ;
79
+ GameObject unityGo = ModelExporter . GetGameObject ( uniObj ) ;
80
+ if ( ! unityGo )
81
+ {
82
+ return ;
83
+ }
72
84
73
- foreach ( EditorCurveBinding uniCurveBinding in AnimationUtility . GetCurveBindings ( animClip ) )
85
+ if ( ! exportOptions . AnimateSkinnedMesh && unityGo . GetComponent < SkinnedMeshRenderer > ( ) )
74
86
{
75
- Object uniObj = AnimationUtility . GetAnimatedObject ( rootObject , uniCurveBinding ) ;
76
- if ( ! uniObj )
77
- {
78
- continue ;
79
- }
80
-
81
- GameObject unityGo = ModelExporter . GetGameObject ( uniObj ) ;
82
- if ( ! unityGo )
83
- {
84
- continue ;
85
- }
86
-
87
- if ( ! exportOptions . AnimateSkinnedMesh && unityGo . GetComponent < SkinnedMeshRenderer > ( ) )
88
- {
89
- continue ;
90
- }
91
-
92
- // If we have a clip driving a camera or light then force the export of FbxNodeAttribute
93
- // so that they point the right way when imported into Maya.
94
- if ( unityGo . GetComponent < Light > ( ) )
95
- this . exportComponent [ unityGo ] = typeof ( Light ) ;
96
- else if ( unityGo . GetComponent < Camera > ( ) )
97
- this . exportComponent [ unityGo ] = typeof ( Camera ) ;
98
-
99
- this . goExportSet . Add ( unityGo ) ;
87
+ return ;
100
88
}
89
+
90
+ // If we have a clip driving a camera or light then force the export of FbxNodeAttribute
91
+ // so that they point the right way when imported into Maya.
92
+ if ( unityGo . GetComponent < Light > ( ) )
93
+ this . exportComponent [ unityGo ] = typeof ( Light ) ;
94
+ else if ( unityGo . GetComponent < Camera > ( ) )
95
+ this . exportComponent [ unityGo ] = typeof ( Camera ) ;
96
+
97
+ this . goExportSet . Add ( unityGo ) ;
98
+ }
99
+ }
100
+
101
+ /// <summary>
102
+ /// collect all objects dependencies for animation clips.
103
+ /// </summary>
104
+ public void CollectDependencies (
105
+ AnimationClip [ ] animClips ,
106
+ GameObject rootObject ,
107
+ IExportOptions exportOptions
108
+ )
109
+ {
110
+ Debug . Assert ( rootObject != null ) ;
111
+ Debug . Assert ( exportOptions != null ) ;
112
+
113
+ foreach ( var animClip in animClips )
114
+ {
115
+ CollectDependencies ( animClip , rootObject , exportOptions ) ;
101
116
}
102
117
}
103
118
0 commit comments