[Bf-blender-cvs] [d8a3400d559] custom-manipulators: Remove length argument since it's stored in the property

Campbell Barton noreply at git.blender.org
Thu Jun 22 03:31:51 CEST 2017


Commit: d8a3400d55914aaf8c86c20aa3f1c16a949fc54e
Author: Campbell Barton
Date:   Thu Jun 22 11:36:31 2017 +1000
Branches: custom-manipulators
https://developer.blender.org/rBd8a3400d55914aaf8c86c20aa3f1c16a949fc54e

Remove length argument since it's stored in the property

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

M	source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c
M	source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
M	source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c
M	source/blender/windowmanager/manipulators/WM_manipulator_api.h
M	source/blender/windowmanager/manipulators/intern/wm_manipulator_target_props.c

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

diff --git a/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c
index 88ad75ee8c8..c2e549e0be8 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/arrow3d_manipulator.c
@@ -369,7 +369,7 @@ static void manipulator_arrow_invoke(
 	wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset");
 
 	/* Some manipulators don't use properties. */
-	if (mpr_prop && WM_manipulator_target_property_is_valid(mpr_prop)) {
+	if (WM_manipulator_target_property_is_valid(mpr_prop)) {
 		inter->init_value = WM_manipulator_target_property_value_get(mpr, mpr_prop);
 	}
 
diff --git a/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
index c4c572dde2b..b0e2880e28c 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
@@ -397,7 +397,7 @@ static void manipulator_dial_modal(bContext *C, wmManipulator *mpr, const wmEven
 
 	/* set the property for the operator and call its modal function */
 	wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset");
-	if (mpr_prop && WM_manipulator_target_property_is_valid(mpr_prop)) {
+	if (WM_manipulator_target_property_is_valid(mpr_prop)) {
 		WM_manipulator_target_property_value_set(C, mpr, mpr_prop, inter->init_prop_angle + angle_delta);
 	}
 }
@@ -420,7 +420,7 @@ static void manipulator_dial_invoke(
 	inter->init_mval[1] = event->mval[1];
 
 	wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset");
-	if (mpr_prop && WM_manipulator_target_property_is_valid(mpr_prop)) {
+	if (WM_manipulator_target_property_is_valid(mpr_prop)) {
 		inter->init_prop_angle = WM_manipulator_target_property_value_get(mpr, mpr_prop);
 	}
 
diff --git a/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c b/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c
index 4fcb44af3c9..1b2065d30a2 100644
--- a/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/manipulator_types/grab3d_manipulator.c
@@ -197,8 +197,8 @@ static void manipulator_grab_modal(bContext *C, wmManipulator *mpr, const wmEven
 
 	/* set the property for the operator and call its modal function */
 	wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset");
-	if (mpr_prop && WM_manipulator_target_property_is_valid(mpr_prop)) {
-		WM_manipulator_target_property_value_set_array(C, mpr, mpr_prop, inter->output.co_final, 3);
+	if (WM_manipulator_target_property_is_valid(mpr_prop)) {
+		WM_manipulator_target_property_value_set_array(C, mpr, mpr_prop, inter->output.co_final);
 	}
 }
 
@@ -211,8 +211,8 @@ static void manipulator_grab_invoke(
 	inter->init_mval[1] = event->mval[1];
 
 	wmManipulatorProperty *mpr_prop = WM_manipulator_target_property_find(mpr, "offset");
-	if (mpr_prop && WM_manipulator_target_property_is_valid(mpr_prop)) {
-		WM_manipulator_target_property_value_get_array(mpr, mpr_prop, inter->init_prop_co, 3);
+	if (WM_manipulator_target_property_is_valid(mpr_prop)) {
+		WM_manipulator_target_property_value_get_array(mpr, mpr_prop, inter->init_prop_co);
 	}
 
 	mpr->interaction_data = inter;
diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_api.h b/source/blender/windowmanager/manipulators/WM_manipulator_api.h
index 6bcd83dce3b..ea677f2d5a3 100644
--- a/source/blender/windowmanager/manipulators/WM_manipulator_api.h
+++ b/source/blender/windowmanager/manipulators/WM_manipulator_api.h
@@ -164,10 +164,10 @@ void  WM_manipulator_target_property_value_set(
 
 void WM_manipulator_target_property_value_get_array(
         const struct wmManipulator *mpr, struct wmManipulatorProperty *mpr_prop,
-        float *value, const int value_len);
+        float *value);
 void WM_manipulator_target_property_value_set_array(
         struct bContext *C, const struct wmManipulator *mpr, struct wmManipulatorProperty *mpr_prop,
-        const float *value, const int value_len);
+        const float *value);
 
 void WM_manipulator_target_property_range_get(
         const struct wmManipulator *mpr, struct wmManipulatorProperty *mpr_prop,
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator_target_props.c b/source/blender/windowmanager/manipulators/intern/wm_manipulator_target_props.c
index 825206a4ea9..b8bd5097788 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator_target_props.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator_target_props.c
@@ -195,27 +195,25 @@ void WM_manipulator_target_property_value_set(
 
 void WM_manipulator_target_property_value_get_array(
         const wmManipulator *mpr, wmManipulatorProperty *mpr_prop,
-        float *value, const int value_len)
+        float *value)
 {
 	if (mpr_prop->custom_func.value_get_fn) {
-		mpr_prop->custom_func.value_get_fn(mpr, mpr_prop, mpr_prop->custom_func.user_data, value, value_len);
+		mpr_prop->custom_func.value_get_fn(
+		        mpr, mpr_prop, mpr_prop->custom_func.user_data, value, mpr_prop->type->array_length);
 		return;
 	}
-
-	BLI_assert(RNA_property_array_length(&mpr_prop->ptr, mpr_prop->prop) == value_len);
 	return RNA_property_float_get_array(&mpr_prop->ptr, mpr_prop->prop, value);
 }
 
 void WM_manipulator_target_property_value_set_array(
         bContext *C, const wmManipulator *mpr, wmManipulatorProperty *mpr_prop,
-        const float *value, const int value_len)
+        const float *value)
 {
 	if (mpr_prop->custom_func.value_set_fn) {
-		mpr_prop->custom_func.value_set_fn(mpr, mpr_prop, mpr_prop->custom_func.user_data, value, value_len);
+		mpr_prop->custom_func.value_set_fn(
+		        mpr, mpr_prop, mpr_prop->custom_func.user_data, value, mpr_prop->type->array_length);
 		return;
 	}
-
-	BLI_assert(RNA_property_array_length(&mpr_prop->ptr, mpr_prop->prop) == value_len);
 	RNA_property_float_set_array(&mpr_prop->ptr, mpr_prop->prop, value);
 
 	RNA_property_update(C, &mpr_prop->ptr, mpr_prop->prop);




More information about the Bf-blender-cvs mailing list