diff options
author | Campbell Barton <campbell@blender.org> | 2022-02-24 14:48:34 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-02-25 09:58:22 +0300 |
commit | ad0b3abf539bbb358f799d3f36649b5d46f222c8 (patch) | |
tree | d7aff552c5541880ca1ce2648595455418cafc56 /source/blender/editors/mesh | |
parent | e7cae5187773f41e62830be597c6f598bff0653f (diff) |
Cleanup: use flags for wmEvent modifier keys
Using flags makes checking multiple modifiers at once more convenient
and avoids macros/functions such as IS_EVENT_MOD & WM_event_modifier_flag
which have been removed. It also simplifies checking if modifier keys
have changed.
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/editmesh_bevel.c | 2 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_loopcut.c | 6 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_select.c | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/editors/mesh/editmesh_bevel.c b/source/blender/editors/mesh/editmesh_bevel.c index 429db50f321..e53dda1760e 100644 --- a/source/blender/editors/mesh/editmesh_bevel.c +++ b/source/blender/editors/mesh/editmesh_bevel.c @@ -546,7 +546,7 @@ static void edbm_bevel_mouse_set_value(wmOperator *op, const wmEvent *event) value = value_start[vmode] + value * opdata->scale[vmode]; /* Fake shift-transform... */ - if (event->shift) { + if (event->modifier & KM_SHIFT) { if (opdata->shift_value[vmode] < 0.0f) { opdata->shift_value[vmode] = (vmode == SEGMENTS_VALUE) ? opdata->segments : diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index b2ed6780443..c9fc48c3568 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -581,7 +581,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) handled = true; break; case MOUSEPAN: - if (event->alt == 0) { + if ((event->modifier & KM_ALT) == 0) { cuts += 0.02f * (event->xy[1] - event->prev_xy[1]); if (cuts < 1 && lcd->cuts >= 1) { cuts = 1; @@ -598,7 +598,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) if (event->val == KM_RELEASE) { break; } - if (event->alt == 0) { + if ((event->modifier & KM_ALT) == 0) { cuts += 1; } else { @@ -612,7 +612,7 @@ static int loopcut_modal(bContext *C, wmOperator *op, const wmEvent *event) if (event->val == KM_RELEASE) { break; } - if (event->alt == 0) { + if ((event->modifier & KM_ALT) == 0) { cuts = max_ff(cuts - 1, 1); } else { diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index fc1d60fc768..d8fc7a4f9d4 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -1367,10 +1367,10 @@ static int edbm_select_mode_invoke(bContext *C, wmOperator *op, const wmEvent *e /* detecting these options based on shift/ctrl here is weak, but it's done * to make this work when clicking buttons or menus */ if (!RNA_struct_property_is_set(op->ptr, "use_extend")) { - RNA_boolean_set(op->ptr, "use_extend", event->shift); + RNA_boolean_set(op->ptr, "use_extend", event->modifier & KM_SHIFT); } if (!RNA_struct_property_is_set(op->ptr, "use_expand")) { - RNA_boolean_set(op->ptr, "use_expand", event->ctrl); + RNA_boolean_set(op->ptr, "use_expand", event->modifier & KM_CTRL); } return edbm_select_mode_exec(C, op); |