Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-06-16 01:20:27 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-06-16 01:20:27 +0300
commit400d3f85e13d6e6890098b948962b7abc7ae3f66 (patch)
tree197abb776be015f38de058fcd2393c818795d763 /source/blender/editors
parent4054914813e7ff72acabf6571742cbb0db3f682a (diff)
Add support for delayed manipulator removal
This is needed so manipulators can tag themselves for removal without causing problems from freeing data within a callback. Also use properties within the dial manipulator and fix an error where removing a wmManipulatorGroupType didn't remove its keymap.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/manipulator_library/dial3d_manipulator.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/editors/manipulator_library/dial3d_manipulator.c b/source/blender/editors/manipulator_library/dial3d_manipulator.c
index 1db87ac9a3d..55d5f257eb4 100644
--- a/source/blender/editors/manipulator_library/dial3d_manipulator.c
+++ b/source/blender/editors/manipulator_library/dial3d_manipulator.c
@@ -75,6 +75,9 @@ typedef struct DialManipulator {
typedef struct DialInteraction {
float init_mval[2];
+ /* only for when using properties */
+ float init_prop_angle;
+
/* cache the last angle to detect rotations bigger than -/+ PI */
float last_angle;
/* number of full rotations */
@@ -348,8 +351,15 @@ static void manipulator_dial_modal(bContext *C, wmManipulator *mpr, const wmEven
dial_ghostarc_get_angles(dial, event, CTX_wm_region(C), mat, co_outer, &angle_ofs, &angle_delta);
DialInteraction *inter = dial->manipulator.interaction_data;
+
inter->output.angle_delta = angle_delta;
inter->output.angle_ofs = angle_ofs;
+
+ /* set the property for the operator and call its modal function */
+ wmManipulatorProperty *mpr_prop = WM_manipulator_property_find(mpr, "offset");
+ if (mpr_prop && WM_manipulator_property_is_valid(mpr_prop)) {
+ WM_manipulator_property_value_set(C, mpr, mpr_prop, inter->init_prop_angle + angle_delta);
+ }
}
static void manipulator_dial_invoke(
@@ -360,6 +370,11 @@ static void manipulator_dial_invoke(
inter->init_mval[0] = event->mval[0];
inter->init_mval[1] = event->mval[1];
+ wmManipulatorProperty *mpr_prop = WM_manipulator_property_find(mpr, "offset");
+ if (mpr_prop && WM_manipulator_property_is_valid(mpr_prop)) {
+ inter->init_prop_angle = WM_manipulator_property_value_get(mpr, mpr_prop);
+ }
+
mpr->interaction_data = inter;
}