diff options
Diffstat (limited to 'source/blender/collada/AnimationExporter.cpp')
-rw-r--r-- | source/blender/collada/AnimationExporter.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/collada/AnimationExporter.cpp b/source/blender/collada/AnimationExporter.cpp index 69a25ac7a82..f6d9bee4563 100644 --- a/source/blender/collada/AnimationExporter.cpp +++ b/source/blender/collada/AnimationExporter.cpp @@ -148,6 +148,7 @@ void AnimationExporter::exportAnimation(Object *ob, BCAnimationSampler &sampler) * However Armatures also can have Object animation. */ bool export_as_matrix = this->export_settings->export_transformation_type == BC_TRANSFORMATION_TYPE_MATRIX; + if (export_as_matrix) { export_matrix_animation(ob, sampler); // export all transform_curves as one single matrix animation } @@ -184,6 +185,7 @@ void AnimationExporter::exportAnimation(Object *ob, BCAnimationSampler &sampler) void AnimationExporter::export_curve_animation_set(Object *ob, BCAnimationSampler &sampler, bool export_as_matrix) { BCAnimationCurveMap *curves = sampler.get_curves(ob); + bool keep_flat_curves = this->export_settings->keep_flat_curves; BCAnimationCurveMap::iterator it; for (it = curves->begin(); it != curves->end(); ++it) { @@ -205,7 +207,7 @@ void AnimationExporter::export_curve_animation_set(Object *ob, BCAnimationSample continue; } - if (!curve.is_animated()) { + if (!keep_flat_curves && !curve.is_animated()) { continue; } @@ -222,12 +224,14 @@ void AnimationExporter::export_curve_animation_set(Object *ob, BCAnimationSample void AnimationExporter::export_matrix_animation(Object *ob, BCAnimationSampler &sampler) { + bool keep_flat_curves = this->export_settings->keep_flat_curves; + std::vector<float> frames; sampler.get_object_frames(frames, ob); if (frames.size() > 0) { BCMatrixSampleMap samples; bool is_animated = sampler.get_object_samples(samples, ob); - if (is_animated) { + if (keep_flat_curves || is_animated) { bAction *action = bc_getSceneObjectAction(ob); std::string name = encode_xml(id_name(ob)); std::string action_name = (action == NULL) ? name + "-action" : id_name(action); @@ -245,13 +249,15 @@ void AnimationExporter::export_matrix_animation(Object *ob, BCAnimationSampler & //write bone animations in transform matrix sources void AnimationExporter::export_bone_animations_recursive(Object *ob, Bone *bone, BCAnimationSampler &sampler) { + bool keep_flat_curves = this->export_settings->keep_flat_curves; + std::vector<float> frames; sampler.get_bone_frames(frames, ob, bone); if (frames.size()) { BCMatrixSampleMap samples; bool is_animated = sampler.get_bone_samples(samples, ob, bone); - if (is_animated) { + if (keep_flat_curves || is_animated) { export_bone_animation(ob, bone, frames, samples); } } |