@@ -2323,7 +2323,7 @@ private void TransferMotion(Transform source, Transform dest, float sampleRate,
2323
2323
2324
2324
for ( int k = 0 ; k < 3 ; k ++ ) {
2325
2325
posKeyFrames [ k ] [ keyIndex ] = new Keyframe ( currSampleTime , ( float ) translation [ k ] ) ;
2326
- rotKeyFrames [ k ] [ keyIndex ] = new Keyframe ( currSampleTime , ( float ) rot [ k ] ) ;
2326
+ rotKeyFrames [ k ] [ keyIndex ] = new Keyframe ( currSampleTime , rot [ k ] ) ;
2327
2327
scaleKeyFrames [ k ] [ keyIndex ] = new Keyframe ( currSampleTime , ( float ) scale [ k ] ) ;
2328
2328
}
2329
2329
keyIndex ++ ;
@@ -2734,18 +2734,6 @@ internal int ExportAnimationOnly(
2734
2734
}
2735
2735
}
2736
2736
2737
- // export animation
2738
- // export default clip first
2739
- if ( exportData . defaultClip != null ) {
2740
- var defaultClip = exportData . defaultClip ;
2741
- ExportAnimationClip ( defaultClip , exportData . animationClips [ defaultClip ] , fbxScene ) ;
2742
- exportData . animationClips . Remove ( defaultClip ) ;
2743
- }
2744
-
2745
- foreach ( var animClip in exportData . animationClips ) {
2746
- ExportAnimationClip ( animClip . Key , animClip . Value , fbxScene ) ;
2747
- }
2748
-
2749
2737
return numObjectsExported ;
2750
2738
}
2751
2739
@@ -3012,7 +3000,7 @@ internal static Dictionary<GameObject, IExportData> GetExportData(Object[] objec
3012
3000
3013
3001
Dictionary < GameObject , IExportData > exportData = new Dictionary < GameObject , IExportData > ( ) ;
3014
3002
3015
- if ( exportOptions . ModelAnimIncludeOption != ExportSettings . Include . Anim )
3003
+ if ( exportOptions . ModelAnimIncludeOption == ExportSettings . Include . Model )
3016
3004
{
3017
3005
return null ;
3018
3006
}
@@ -3174,21 +3162,7 @@ private bool ExportComponents(FbxScene fbxScene, bool exportAnim = true)
3174
3162
}
3175
3163
3176
3164
ExportConstraints ( unityGo , fbxScene , fbxNode ) ;
3177
-
3178
- // check if this object contains animation, keep track of it
3179
- // if it does
3180
- if ( exportAnim && GameObjectHasAnimation ( unityGo ) ) {
3181
- animationNodes . Add ( unityGo ) ;
3182
- }
3183
3165
}
3184
-
3185
- // export all GameObjects that have animation
3186
- if ( animationNodes . Count > 0 ) {
3187
- foreach ( var go in animationNodes ) {
3188
- ExportAnimation ( go , fbxScene ) ;
3189
- }
3190
- }
3191
-
3192
3166
return true ;
3193
3167
}
3194
3168
@@ -3366,7 +3340,7 @@ internal int ExportAll (
3366
3340
}
3367
3341
3368
3342
try {
3369
- bool animOnly = exportData != null ;
3343
+ bool animOnly = exportData != null && ExportOptions . ModelAnimIncludeOption == ExportSettings . Include . Anim ;
3370
3344
bool status = false ;
3371
3345
// Create the FBX manager
3372
3346
using ( var fbxManager = FbxManager . Create ( ) ) {
@@ -3508,6 +3482,28 @@ internal int ExportAll (
3508
3482
}
3509
3483
}
3510
3484
3485
+ foreach ( var unityGo in revisedExportSet )
3486
+ {
3487
+ IExportData iData ;
3488
+ if ( ! exportData . TryGetValue ( unityGo , out iData ) )
3489
+ {
3490
+ continue ;
3491
+ }
3492
+ var data = iData as AnimationOnlyExportData ;
3493
+ // export animation
3494
+ // export default clip first
3495
+ if ( data . defaultClip != null )
3496
+ {
3497
+ var defaultClip = data . defaultClip ;
3498
+ ExportAnimationClip ( defaultClip , data . animationClips [ defaultClip ] , fbxScene ) ;
3499
+ data . animationClips . Remove ( defaultClip ) ;
3500
+ }
3501
+
3502
+ foreach ( var animClip in data . animationClips )
3503
+ {
3504
+ ExportAnimationClip ( animClip . Key , animClip . Value , fbxScene ) ;
3505
+ }
3506
+ }
3511
3507
// Set the scene's default camera.
3512
3508
SetDefaultCamera ( fbxScene ) ;
3513
3509
0 commit comments