Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaia Clary <gaia.clary@machinimatrix.org>2019-01-05 23:36:28 +0300
committerGaia Clary <gaia.clary@machinimatrix.org>2019-01-05 23:52:41 +0300
commit4b7596ec914e9d748b23831db736ef89eb879886 (patch)
tree4d9384ca1d4adc3b7faa0f5e629f460665b20398 /source/blender/collada
parente8d4304b5541d82b6ebc85f17d11da1f61a6e5d7 (diff)
fix T59743: Collada exporter: Add option for exporting flat curves
The Collada exporter suppresses the export of flat animation curves to optimize the animation (in fact to make the exported file smaller). But sometimes it is important to also have the flat curves exported because they may be needed to define an initial transformation to a fixed location - like translating the weapon from the ground floor to the back of the model in the report. I added a new option "all keyed curves" which is disabled by default but when enabled it also exports flat curves. feedback is very welcome
Diffstat (limited to 'source/blender/collada')
-rw-r--r--source/blender/collada/AnimationExporter.cpp12
-rw-r--r--source/blender/collada/ExportSettings.h1
2 files changed, 10 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);
}
}
diff --git a/source/blender/collada/ExportSettings.h b/source/blender/collada/ExportSettings.h
index 3b4397a6093..fa4f0ccb2e1 100644
--- a/source/blender/collada/ExportSettings.h
+++ b/source/blender/collada/ExportSettings.h
@@ -71,6 +71,7 @@ typedef struct ExportSettings {
int sampling_rate;
bool keep_smooth_curves;
bool keep_keyframes;
+ bool keep_flat_curves;
bool active_uv_only;
BC_export_animation_type export_animation_type;