Commit: 1b9399f44632cabd2b760e9e287b88c82fd18d6b
Author: Campbell Barton
Date: Thu Jun 22 18:24:25 2017 +1000
Branches: custom-manipulators
https://developer.blender.org/rB1b9399f44632cabd2b760e9e287b88c82fd18d6b
Remove counter of set properties, just check when needed
===================================================================
M
source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
M source/blender/windowmanager/manipulators/WM_manipulator_api.h
M source/blender/windowmanager/manipulators/WM_manipulator_types.h
M source/blender/windowmanager/manipulators/intern/wm_manipulator.c
M
source/blender/windowmanager/manipulators/intern/wm_manipulator_target_props.c
===================================================================
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 b0e2880e28c..0260fc44010 100644
---
a/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
+++
b/source/blender/editors/manipulator_library/manipulator_types/dial3d_manipulator.c
@@ -293,7 +293,7 @@ static void dial_draw_intern(
DialInteraction *inter = mpr->interaction_data;
/* XXX, View3D rotation manipulator doesn't call modal. */
- if (mpr->target_properties_len_set == 0) {
+ if (!WM_manipulator_target_property_is_valid_any(mpr)) {
wmWindow *win = CTX_wm_window(C);
manipulator_dial_modal((bContext *)C, mpr,
win->eventstate, 0);
}
diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_api.h
b/source/blender/windowmanager/manipulators/WM_manipulator_api.h
index ea677f2d5a3..d6e468089f8 100644
--- a/source/blender/windowmanager/manipulators/WM_manipulator_api.h
+++ b/source/blender/windowmanager/manipulators/WM_manipulator_api.h
@@ -154,6 +154,7 @@ void WM_manipulator_target_property_def_func(
struct wmManipulator *mpr, const char *idname,
const struct wmManipulatorPropertyFnParams *params);
+bool WM_manipulator_target_property_is_valid_any(struct wmManipulator *mpr);
bool WM_manipulator_target_property_is_valid(
const struct wmManipulatorProperty *mpr_prop);
float WM_manipulator_target_property_value_get(
diff --git a/source/blender/windowmanager/manipulators/WM_manipulator_types.h
b/source/blender/windowmanager/manipulators/WM_manipulator_types.h
index 34805aa72f6..119d77b1181 100644
--- a/source/blender/windowmanager/manipulators/WM_manipulator_types.h
+++ b/source/blender/windowmanager/manipulators/WM_manipulator_types.h
@@ -112,8 +112,6 @@ struct wmManipulator {
struct IDProperty *properties;
- int target_properties_len_set;
-
/* over alloc target_properties after 'wmManipulatorType.struct_size' */
};
diff --git a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
index ee1ba5c2c1a..e9250663818 100644
--- a/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
+++ b/source/blender/windowmanager/manipulators/intern/wm_manipulator.c
@@ -471,7 +471,7 @@ void wm_manipulator_calculate_scale(wmManipulator *mpr,
const bContext *C)
static void manipulator_update_prop_data(wmManipulator *mpr)
{
/* manipulator property might have been changed, so update manipulator
*/
- if (mpr->type->property_update && mpr->target_properties_len_set) {
+ if (mpr->type->property_update) {
wmManipulatorProperty *mpr_prop_array =
WM_manipulator_target_property_array(mpr);
for (int i = 0; i < mpr->type->target_property_defs_len; i++) {
wmManipulatorProperty *mpr_prop = &mpr_prop_array[i];
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 e43b70a8381..9acd1a974cd 100644
---
a/source/blender/windowmanager/manipulators/intern/wm_manipulator_target_props.c
+++
b/source/blender/windowmanager/manipulators/intern/wm_manipulator_target_props.c
@@ -67,7 +67,7 @@ wmManipulatorProperty
*WM_manipulator_target_property_at_index(wmManipulator *mp
{
BLI_assert(index < mpr->type->target_property_defs_len);
BLI_assert(index != -1);
- wmManipulatorProperty *mpr_prop_array =
WM_manipulator_target_property_array(mpr);
+ wmManipulatorProperty *mpr_prop_array =
wm_manipulator_target_property_array(mpr);
return &mpr_prop_array[index];
}
@@ -98,8 +98,6 @@ void WM_manipulator_target_property_def_rna_ptr(
mpr_prop->prop = prop;
mpr_prop->index = index;
- mpr->target_properties_len_set += 1;
-
if (mpr->type->property_update) {
mpr->type->property_update(mpr, mpr_prop);
}
@@ -131,8 +129,6 @@ void WM_manipulator_target_property_def_func_ptr(
mpr_prop->custom_func.free_fn = params->free_fn;
mpr_prop->custom_func.user_data = params->user_data;
- mpr->target_properties_len_set += 1;
-
if (mpr->type->property_update) {
mpr->type->property_update(mpr, mpr_prop);
}
@@ -154,6 +150,18 @@ void WM_manipulator_target_property_def_func(
/** \name Property Access
* \{ */
+bool WM_manipulator_target_property_is_valid_any(wmManipulator *mpr)
+{
+ wmManipulatorProperty *mpr_prop_array =
wm_manipulator_target_property_array(mpr);
+ for (int i = 0; i < mpr->type->target_property_defs_len; i++) {
+ wmManipulatorProperty *mpr_prop = &mpr_prop_array[i];
+ if (WM_manipulator_target_property_is_valid(mpr_prop)) {
+ return true;
+ }
+ }
+ return false;
+}
+
bool WM_manipulator_target_property_is_valid(const wmManipulatorProperty
*mpr_prop)
{
return ((mpr_prop->prop != NULL) ||
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs