[Bf-blender-cvs] [1639ee04081] collada: Feature: Collada added new User interface options

Gaia Clary noreply at git.blender.org
Wed Mar 28 21:30:53 CEST 2018


Commit: 1639ee040819b57b11eeb89fab341b4649f299fa
Author: Gaia Clary
Date:   Tue Mar 20 21:11:46 2018 +0100
Branches: collada
https://developer.blender.org/rB1639ee040819b57b11eeb89fab341b4649f299fa

Feature: Collada added new User interface options

keep_keyframes:
When sampling the distance between 2 keyframes is defined by
the sampling rate. Furthermore the keyframes defined in the
FCurves are not exported. However when this option is enabled
then also the defined keyframes will be added to the exported fcurves

keep_smooth_curves:
When sampling we do not use FCurves. So we also have no Curve handles
for smooth exporting. However when this option is enabled, Blender
does its best to recreate the handles for export. This is a very
experimental feature and it is know to break when:

- the exported animated objects have parent inverse matrices different
  from the unit matrix
- The exported objects have negative scaling

There may be many other situations when this feature breaks.
This needs to be further tested. It may be removed later or replaced
by something less wonky.

===================================================================

M	source/blender/collada/ExportSettings.h
M	source/blender/editors/io/io_collada.c

===================================================================

diff --git a/source/blender/collada/ExportSettings.h b/source/blender/collada/ExportSettings.h
index 66fce31b805..03cf88c4f38 100644
--- a/source/blender/collada/ExportSettings.h
+++ b/source/blender/collada/ExportSettings.h
@@ -60,6 +60,8 @@ typedef struct ExportSettings {
 	bool include_animations;
 	bool include_all_actions;
 	int sampling_rate;
+	bool keep_smooth_curves;
+	bool keep_keyframes;
 
 	bool active_uv_only;
 	BC_export_texture_type export_texture_type;
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index 78a8d28cfdd..21c991115ff 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -93,6 +93,8 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
 	int sample_animations;
 	int include_all_actions;
 	int sampling_rate;
+	int keep_smooth_curves;
+	int keep_keyframes;
 
 	int export_texture_type;
 	int use_texture_copies;
@@ -148,6 +150,8 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
 	sample_animations        = RNA_boolean_get(op->ptr, "sample_animations");
 	include_all_actions      = RNA_boolean_get(op->ptr, "include_all_actions");
 	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");
 
 	deform_bones_only        = RNA_boolean_get(op->ptr, "deform_bones_only");
 
@@ -184,6 +188,8 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
 	export_settings.include_animations = include_animations != 0;
 	export_settings.include_all_actions = include_all_actions != 0;
 	export_settings.sampling_rate = sampling_rate;
+	export_settings.keep_smooth_curves = keep_smooth_curves != 0;
+	export_settings.keep_keyframes = keep_keyframes != 0;
 
 	export_settings.active_uv_only = active_uv_only != 0;
 	export_settings.export_texture_type = export_texture_type;
@@ -259,16 +265,29 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
 
 	row = uiLayoutRow(box, false);
 	uiItemR(row, imfptr, "include_animations", 0, NULL, ICON_NONE);
-	row = uiLayoutRow(box, false);
+
 	if (include_animations) {
-		uiItemR(row, imfptr, "include_all_actions", 0, NULL, ICON_NONE);
+		bool sampling = RNA_boolean_get(imfptr, "sample_animations");
+
+		row = uiLayoutColumn(box, false);
+		uiItemR(row, imfptr, "keep_smooth_curves", 0, NULL, ICON_NONE);
+
 		row = uiLayoutColumn(box, false);
 		uiItemR(row, imfptr, "sample_animations", 0, NULL, ICON_NONE);
+
 		row = uiLayoutColumn(box, false);
 		uiItemR(row, imfptr, "sampling_rate", 0, NULL, ICON_NONE);
-		uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "sample_animations"));
+		uiLayoutSetEnabled(row, sampling);
+
+		row = uiLayoutColumn(box, false);
+		uiItemR(row, imfptr, "keep_keyframes", 0, NULL, ICON_NONE);
+		uiLayoutSetEnabled(row, sampling);
+
+		row = uiLayoutRow(box, false);
+		uiItemR(row, imfptr, "include_all_actions", 0, NULL, ICON_NONE);
 	}
 
+
 	/* Texture options */
 	box = uiLayoutBox(layout);
 	row = uiLayoutRow(box, false);
@@ -408,6 +427,8 @@ void WM_OT_collada_export(wmOperatorType *ot)
 	RNA_def_boolean(func, "deform_bones_only", false, "Deform Bones only",
 	            	"Only export deforming bones with armatures");
 
+
+
 	RNA_def_boolean(func, "include_animations", true,
 		"Include Animations", "Export Animations if available.\nExporting Animations will enforce the decomposition of node transforms\ninto  <translation> <rotation> and <scale> components");
 
@@ -420,6 +441,17 @@ void WM_OT_collada_export(wmOperatorType *ot)
 	RNA_def_int(func, "sampling_rate", 1, 1, INT_MAX,
 		"Sampling Rate", "The distance between 2 keyframes. 1 means: Every frame is keyed", 1, INT_MAX);
 
+	RNA_def_boolean(func, "sample_animations", 0,
+		"Sample Animations", "Auto-generate keyframes with a frame distance set by 'Sampling Rate'.\nWhen disabled, export only the keyframes defined in the animation f-curves (may be less accurate)");
+
+	RNA_def_boolean(func, "keep_smooth_curves", 0,
+		"Keep Smooth curves", "Export also the curve handles (if available).\nThis does only work when the inverse parent matrix is the Unity matrix\nOtherwise you may end up with odd results\n");
+
+	RNA_def_boolean(func, "keep_keyframes", 0,
+		"Keep Keyframes", "Use existing keyframes as additional sample points.\nThis helps when you want to keep manual tweeks");
+
+
+
 	RNA_def_boolean(func, "active_uv_only", 0, "Only Selected UV Map",
 	                "Export only the selected UV Map");



More information about the Bf-blender-cvs mailing list