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/object | |
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/object')
-rw-r--r-- | source/blender/editors/object/object_edit.c | 6 | ||||
-rw-r--r-- | source/blender/editors/object/object_remesh.cc | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_transform.c | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 203e18f9621..4da278b7a31 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -340,10 +340,10 @@ static int object_hide_collection_exec(bContext *C, wmOperator *op) View3D *v3d = CTX_wm_view3d(C); int index = RNA_int_get(op->ptr, "collection_index"); - const bool extend = (win->eventstate->shift != 0); + const bool extend = (win->eventstate->modifier & KM_SHIFT) != 0; const bool toggle = RNA_boolean_get(op->ptr, "toggle"); - if (win->eventstate->alt != 0) { + if (win->eventstate->modifier & KM_ALT) { index += 10; } @@ -1427,7 +1427,7 @@ static int object_clear_paths_exec(bContext *C, wmOperator *op) /* operator callback/wrapper */ static int object_clear_paths_invoke(bContext *C, wmOperator *op, const wmEvent *event) { - if ((event->shift) && !RNA_struct_property_is_set(op->ptr, "only_selected")) { + if ((event->modifier & KM_SHIFT) && !RNA_struct_property_is_set(op->ptr, "only_selected")) { RNA_boolean_set(op->ptr, "only_selected", true); } return object_clear_paths_exec(C, op); diff --git a/source/blender/editors/object/object_remesh.cc b/source/blender/editors/object/object_remesh.cc index 44e6fb10528..2e495ac6147 100644 --- a/source/blender/editors/object/object_remesh.cc +++ b/source/blender/editors/object/object_remesh.cc @@ -406,7 +406,7 @@ static int voxel_size_edit_modal(bContext *C, wmOperator *op, const wmEvent *eve d = cd->slow_mval[0] - mval[0]; } - if (event->ctrl) { + if (event->modifier & KM_CTRL) { /* Linear mode, enables jumping to any voxel size. */ d = d * 0.0005f; } diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 94aa7d59f9d..9e82abf4d07 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -1861,7 +1861,7 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const view3d_operator_needs_opengl(C); - const bool is_translate = (event->ctrl != 0); + const bool is_translate = event->modifier & KM_CTRL; const bool is_translate_init = is_translate && (xfd->is_translate != is_translate); if (event->type == MOUSEMOVE || is_translate_init) { |