[Bf-blender-cvs] [085e5765df5] blender2.8: Cleanup: remove flag from GizmoCommonData

Campbell Barton noreply at git.blender.org
Mon Dec 3 03:03:20 CET 2018


Commit: 085e5765df5a6e5664db4932ca2ade84be4dfc8e
Author: Campbell Barton
Date:   Mon Dec 3 13:01:04 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB085e5765df5a6e5664db4932ca2ade84be4dfc8e

Cleanup: remove flag from GizmoCommonData

Use struct member instead,
there are already many gizmo flags to keep track of.

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

M	source/blender/editors/gizmo_library/gizmo_library_intern.h
M	source/blender/editors/gizmo_library/gizmo_library_utils.c
M	source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c

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

diff --git a/source/blender/editors/gizmo_library/gizmo_library_intern.h b/source/blender/editors/gizmo_library/gizmo_library_intern.h
index db88a52f087..f58935e1fba 100644
--- a/source/blender/editors/gizmo_library/gizmo_library_intern.h
+++ b/source/blender/editors/gizmo_library/gizmo_library_intern.h
@@ -37,8 +37,6 @@
  * Data for common interactions. Used in gizmo_library_utils.c functions.
  */
 typedef struct GizmoCommonData {
-	int flag;
-
 	float range_fac;      /* factor for arrow min/max distance */
 	float offset;
 
@@ -46,6 +44,8 @@ typedef struct GizmoCommonData {
 	float range;
 	/* min/max value for constrained gizmos */
 	float min, max;
+
+	uint is_custom_range_set : 1;
 } GizmoCommonData;
 
 typedef struct GizmoInteraction {
@@ -62,12 +62,6 @@ typedef struct GizmoInteraction {
 	float precision_offset;
 } GizmoInteraction;
 
-/* GizmoCommonData->flag  */
-enum {
-	GIZMO_CUSTOM_RANGE_SET = (1 << 0),
-};
-
-
 float gizmo_offset_from_value(
         GizmoCommonData *data, const float value,
         const bool constrained, const bool inverted);
diff --git a/source/blender/editors/gizmo_library/gizmo_library_utils.c b/source/blender/editors/gizmo_library/gizmo_library_utils.c
index 25364652785..d8c29eb6675 100644
--- a/source/blender/editors/gizmo_library/gizmo_library_utils.c
+++ b/source/blender/editors/gizmo_library/gizmo_library_utils.c
@@ -99,7 +99,7 @@ float gizmo_value_from_offset(
 	}
 
 	/* clamp to custom range */
-	if (data->flag & GIZMO_CUSTOM_RANGE_SET) {
+	if (data->is_custom_range_set) {
 		CLAMP(value, data->min, max);
 	}
 
@@ -124,7 +124,7 @@ void gizmo_property_data_update(
 	float value = WM_gizmo_target_property_float_get(gz, gz_prop);
 
 	if (constrained) {
-		if ((data->flag & GIZMO_CUSTOM_RANGE_SET) == 0) {
+		if (data->is_custom_range_set == false) {
 			float range[2];
 			if (WM_gizmo_target_property_float_range_get(gz, gz_prop, range)) {
 				data->range = range[1] - range[0];
diff --git a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
index 1e39e1cca52..e02d4b8470c 100644
--- a/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
+++ b/source/blender/editors/gizmo_library/gizmo_types/arrow3d_gizmo.c
@@ -416,7 +416,8 @@ void ED_gizmo_arrow3d_set_ui_range(wmGizmo *gz, const float min, const float max
 
 	arrow->data.range = max - min;
 	arrow->data.min = min;
-	arrow->data.flag |= GIZMO_CUSTOM_RANGE_SET;
+	arrow->data.max = max;
+	arrow->data.is_custom_range_set = true;
 }
 
 /**



More information about the Bf-blender-cvs mailing list