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:
authorJuanfran Matheu <jfmatheu>2021-02-12 08:45:29 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-02-12 08:45:29 +0300
commit631cc5d56ee9445ece0a9982ed58b1de1dcbbe5b (patch)
treedb7752f4e0d9fe0b41f0853ce0359bb94ef41608
parent5a1503953096927860b68f6315e354d2e39fb8bc (diff)
WM: Add 'Confirm On Release' option for WM_OT_radial_control
Adds a new property called "Confirm On Release" that does what it says, confirm the action without having to do left-click or to press any other extra-key which concludes in a more dynamic and efficient way of changing brush size or strength for example, especially for tablet users. Reviewed By: campbellbarton Ref D10233
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index e82f6cc9d76..297575e8dff 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -2087,6 +2087,7 @@ typedef struct {
bool use_secondary_tex;
void *cursor;
NumInput num_input;
+ int init_event;
} RadialControl;
static void radial_control_update_header(wmOperator *op, bContext *C)
@@ -2705,6 +2706,8 @@ static int radial_control_invoke(bContext *C, wmOperator *op, const wmEvent *eve
radial_control_set_initial_mouse(rc, event);
radial_control_set_tex(rc);
+ rc->init_event = WM_userdef_event_type_from_keymap_type(event->type);
+
/* temporarily disable other paint cursors */
wm = CTX_wm_manager(C);
rc->orig_paintcursors = wm->paintcursors;
@@ -2962,6 +2965,11 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even
return OPERATOR_RUNNING_MODAL;
}
+ if (!handled && (event->val == KM_RELEASE) && (rc->init_event == event->type) &&
+ RNA_boolean_get(op->ptr, "release_confirm")) {
+ ret = OPERATOR_FINISHED;
+ }
+
ED_region_tag_redraw(CTX_wm_region(C));
radial_control_update_header(op, C);
@@ -3070,6 +3078,10 @@ static void WM_OT_radial_control(wmOperatorType *ot)
prop = RNA_def_boolean(
ot->srna, "secondary_tex", false, "Secondary Texture", "Tweak brush secondary/mask texture");
RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+
+ prop = RNA_def_boolean(
+ ot->srna, "release_confirm", false, "Confirm On Release", "Finish operation on key release");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
}
/** \} */