[Bf-blender-cvs] [bdbdd3d3200] collada: Refactor Collada: Renamed Enumerations to avoid confusion

Gaia Clary noreply at git.blender.org
Tue Apr 17 22:38:21 CEST 2018


Commit: bdbdd3d32007ee2ccaf26b2a0d6305e089a75758
Author: Gaia Clary
Date:   Tue Apr 17 17:35:59 2018 +0200
Branches: collada
https://developer.blender.org/rBbdbdd3d32007ee2ccaf26b2a0d6305e089a75758

Refactor Collada: Renamed Enumerations to avoid confusion

The Curve animation type enumeration looked almost identical
to the enumeration that describes if the exporter shall
export sample frames or keyframes.

Details

old names:
 BC_ANIMATION_TYPE_SAMPLE,
 BC_ANIMATION_TYPE_KEYS

replaced by the more descriptive names:
 BC_ANIMATION_EXPORT_SAMPLES,
 BC_ANIMATION_EXPORT_KEYS

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

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

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

diff --git a/source/blender/collada/BCAnimationSampler.cpp b/source/blender/collada/BCAnimationSampler.cpp
index 63195f1c753..3826e30ce3b 100644
--- a/source/blender/collada/BCAnimationSampler.cpp
+++ b/source/blender/collada/BCAnimationSampler.cpp
@@ -205,7 +205,7 @@ void BCAnimationSampler::sample_scene(
 			is_scene_sample_frame = true;
 		}
 
-		bool needs_sampling = is_scene_sample_frame || keep_keyframes || export_animation_type == BC_ANIMATION_TYPE_KEYS;
+		bool needs_sampling = is_scene_sample_frame || keep_keyframes || export_animation_type == BC_ANIMATION_EXPORT_KEYS;
 		if (!needs_sampling) {
 			continue;
 		}
@@ -334,8 +334,8 @@ bool BCAnimationSampler::get_object_samples(BCMatrixSampleMap &samples, Object *
 
    curve: The curve to whioch the data is added
    matrices: The set of matrix values from where the data is taken
-   animation_type BC_ANIMATION_TYPE_SAMPLE: Use all matrix data
-   animation_type BC_ANIMATION_TYPE_KEYS: Only take data from matrices for keyframes
+   animation_type BC_ANIMATION_EXPORT_SAMPLES: Use all matrix data
+   animation_type BC_ANIMATION_EXPORT_KEYS: Only take data from matrices for keyframes
 */
 
 void BCAnimationSampler::add_value_set(
@@ -349,7 +349,7 @@ void BCAnimationSampler::add_value_set(
 	BCFrameSampleMap::iterator it;
 	for (it = samples.begin(); it != samples.end(); ++it) {
 		const int frame_index = nearbyint(it->first);
-		if (animation_type == BC_ANIMATION_TYPE_SAMPLE || curve.is_keyframe(frame_index)) {
+		if (animation_type == BC_ANIMATION_EXPORT_SAMPLES || curve.is_keyframe(frame_index)) {
 
 			const BCSample *sample = it->second;
 			float val = 0;
diff --git a/source/blender/collada/ExportSettings.h b/source/blender/collada/ExportSettings.h
index 800ddcf608d..02bcfea7ab7 100644
--- a/source/blender/collada/ExportSettings.h
+++ b/source/blender/collada/ExportSettings.h
@@ -49,8 +49,8 @@ typedef enum BC_export_texture_type {
 } BC_export_texture_type;
 
 typedef enum BC_export_animation_type {
-	BC_ANIMATION_TYPE_SAMPLE,
-	BC_ANIMATION_TYPE_KEYS
+	BC_ANIMATION_EXPORT_SAMPLES,
+	BC_ANIMATION_EXPORT_KEYS
 } BC_export_animation_type;
 
 typedef enum BC_ui_export_section {
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index dd9cc76321c..2590ebf8af0 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -150,7 +150,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
 	include_animations       = RNA_boolean_get(op->ptr, "include_animations");
 	include_all_actions      = RNA_boolean_get(op->ptr, "include_all_actions");
 	export_animation_type    = RNA_enum_get(op->ptr, "export_animation_type_selection");
-	sample_animations        = (export_animation_type == BC_ANIMATION_TYPE_SAMPLE);
+	sample_animations        = (export_animation_type == BC_ANIMATION_EXPORT_SAMPLES);
 	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");
@@ -202,7 +202,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
 	export_settings.use_blender_profile = use_blender_profile != 0;
 	export_settings.sort_by_name = sort_by_name != 0;
 
-	if (export_animation_type == BC_ANIMATION_TYPE_SAMPLE) {
+	if (export_animation_type == BC_ANIMATION_EXPORT_SAMPLES) {
 		export_settings.export_transformation_type = export_transformation_type;
 	}
 	else {
@@ -257,7 +257,7 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
 	BC_export_animation_type animation_type = RNA_enum_get(imfptr, "export_animation_type_selection");
 	BC_export_transformation_type transformation_type = RNA_enum_get(imfptr, "export_transformation_type_selection");
 
-	bool sampling = animation_type == BC_ANIMATION_TYPE_SAMPLE;
+	bool sampling = animation_type == BC_ANIMATION_EXPORT_SAMPLES;
 
 	/* Export Options: */
 	box = uiLayoutBox(layout);
@@ -343,12 +343,12 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
 		split = uiLayoutSplit(row, 0.6f, UI_LAYOUT_ALIGN_RIGHT);
 		uiItemL(split, IFACE_("Transformation Type"), ICON_NONE);
 		uiItemR(split, imfptr, "export_transformation_type_selection", 0, "", ICON_NONE);
-		uiLayoutSetEnabled(row, animation_type == BC_ANIMATION_TYPE_SAMPLE);
+		uiLayoutSetEnabled(row, animation_type == BC_ANIMATION_EXPORT_SAMPLES);
 
 		row = uiLayoutColumn(box, false);
 		uiItemR(row, imfptr, "keep_smooth_curves", 0, NULL, ICON_NONE);
 		uiLayoutSetEnabled(row, include_animations && 
-			(transformation_type == BC_TRANSFORMATION_TYPE_TRANSROTLOC || animation_type == BC_ANIMATION_TYPE_KEYS));
+			(transformation_type == BC_TRANSFORMATION_TYPE_TRANSROTLOC || animation_type == BC_ANIMATION_EXPORT_KEYS));
 
 		row = uiLayoutColumn(box, false);
 		uiItemR(row, imfptr, "sampling_rate", 0, NULL, ICON_NONE);
@@ -430,8 +430,8 @@ void WM_OT_collada_export(wmOperatorType *ot)
 	};
 
 	static const EnumPropertyItem prop_bc_export_animation_type[] = {
-	{ BC_ANIMATION_TYPE_SAMPLE, "sample", 0, "Samples", "Export Sampled points guided by sampling rate" },
-	{ BC_ANIMATION_TYPE_KEYS, "keys", 0, "Curves", "Export Curves\n Note: guided by curve keys" },
+	{ BC_ANIMATION_EXPORT_SAMPLES, "sample", 0, "Samples", "Export Sampled points guided by sampling rate" },
+	{ BC_ANIMATION_EXPORT_KEYS, "keys", 0, "Curves", "Export Curves\n Note: guided by curve keys" },
 	{ 0, NULL, 0, NULL, NULL }
 	};



More information about the Bf-blender-cvs mailing list