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 <campbell@blender.org>2022-03-17 08:22:33 +0300
committerCampbell Barton <campbell@blender.org>2022-03-17 08:22:33 +0300
commit3017585ebfe84852f6969493badc77e27fdb8b54 (patch)
treedb7be6da5b87bb864ab6599c9789f52b98a3ed6b /source/blender/windowmanager
parent859c062a2a3083f53d801fce4b722dcc52482e7e (diff)
View 3D: the select operator now uses the cancel flag on failure
Needed so mapping selection to click doesn't pass the click event through to setting the 3D cursor for e.g. While this doesn't happen with the default key-map, setting selection to LMB-click would set the 3D cursor as well (when the selection fell through to nothing).
Diffstat (limited to 'source/blender/windowmanager')
-rw-r--r--source/blender/windowmanager/intern/wm_operator_utils.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/windowmanager/intern/wm_operator_utils.c b/source/blender/windowmanager/intern/wm_operator_utils.c
index 5a817075cd5..bde072bf000 100644
--- a/source/blender/windowmanager/intern/wm_operator_utils.c
+++ b/source/blender/windowmanager/intern/wm_operator_utils.c
@@ -32,9 +32,15 @@
int WM_operator_flag_only_pass_through_on_press(int retval, const struct wmEvent *event)
{
- if ((event->val != KM_PRESS) &&
- ((retval & OPERATOR_PASS_THROUGH) && (retval & OPERATOR_FINISHED))) {
- retval &= ~OPERATOR_PASS_THROUGH;
+ if (event->val != KM_PRESS) {
+ if (retval & OPERATOR_PASS_THROUGH) {
+ /* Operators that use this function should either finish or cancel,
+ * otherwise non-press events will be passed through to other key-map items. */
+ BLI_assert((retval & ~OPERATOR_PASS_THROUGH) != 0);
+ if (retval & (OPERATOR_FINISHED | OPERATOR_CANCELLED)) {
+ retval &= ~OPERATOR_PASS_THROUGH;
+ }
+ }
}
return retval;
}