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:
-rw-r--r--source/blender/collada/AnimationExporter.cpp12
-rw-r--r--source/blender/collada/ExportSettings.h1
-rw-r--r--source/blender/editors/io/io_collada.c11
3 files changed, 20 insertions, 4 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;
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index 08dcde6da62..635ef60e3df 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -98,6 +98,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
int sampling_rate;
int keep_smooth_curves;
int keep_keyframes;
+ int keep_flat_curves;
int export_animation_type;
int use_texture_copies;
@@ -157,6 +158,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
sampling_rate = (sample_animations) ? RNA_int_get(op->ptr, "sampling_rate") : 0;
keep_smooth_curves = RNA_boolean_get(op->ptr, "keep_smooth_curves");
keep_keyframes = RNA_boolean_get(op->ptr, "keep_keyframes");
+ keep_flat_curves = RNA_boolean_get(op->ptr, "keep_flat_curves");
deform_bones_only = RNA_boolean_get(op->ptr, "deform_bones_only");
@@ -195,6 +197,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
export_settings.include_all_actions = include_all_actions != 0;
export_settings.sampling_rate = sampling_rate;
export_settings.keep_keyframes = keep_keyframes != 0 || sampling_rate < 1;
+ export_settings.keep_flat_curves = keep_flat_curves != 0;
export_settings.active_uv_only = active_uv_only != 0;
export_settings.export_animation_type = export_animation_type;
@@ -357,6 +360,9 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
uiItemR(row, imfptr, "keep_keyframes", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, sampling && include_animations);
+ row = uiLayoutColumn(box, false);
+ uiItemR(row, imfptr, "keep_flat_curves", 0, NULL, ICON_NONE);
+
row = uiLayoutRow(box, false);
uiItemR(row, imfptr, "include_all_actions", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, include_animations);
@@ -502,7 +508,10 @@ void WM_OT_collada_export(wmOperatorType *ot)
"is the unity matrix, otherwise you may end up with odd results)");
RNA_def_boolean(func, "keep_keyframes", 0, "Keep Keyframes",
- "Use existing keyframes as additional sample points (this helps when you want to keep manual tweaks)");
+ "Use existing keyframes as additional sample points (this helps when you want to keep manual tweaks)");
+
+ RNA_def_boolean(func, "keep_flat_curves", 0, "All keyed curves",
+ "Export also curves which have only one key or are totally flat");
RNA_def_boolean(func, "active_uv_only", 0, "Only Selected UV Map",
"Export only the selected UV Map");