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
This commit is contained in:
parent
5a15039530
commit
631cc5d56e
|
@ -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);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
Loading…
Reference in New Issue