[Bf-blender-cvs] [31943d13134] master: Fix T102937: "view3d.view_roll" operator conflicts with RMB invocation

Campbell Barton noreply at git.blender.org
Tue Dec 6 10:53:27 CET 2022


Commit: 31943d13134675abca4c1c35a86ffe2fe3f89af5
Author: Campbell Barton
Date:   Tue Dec 6 20:49:38 2022 +1100
Branches: master
https://developer.blender.org/rB31943d13134675abca4c1c35a86ffe2fe3f89af5

Fix T102937: "view3d.view_roll" operator conflicts with RMB invocation

When RMB is used to start the operator, don't use it for canceling.

===================================================================

M	source/blender/editors/space_view3d/view3d_navigate_roll.c

===================================================================

diff --git a/source/blender/editors/space_view3d/view3d_navigate_roll.c b/source/blender/editors/space_view3d/view3d_navigate_roll.c
index af93aa50238..5a6a3ef1fa6 100644
--- a/source/blender/editors/space_view3d/view3d_navigate_roll.c
+++ b/source/blender/editors/space_view3d/view3d_navigate_roll.c
@@ -106,16 +106,22 @@ static int viewroll_modal(bContext *C, wmOperator *op, const wmEvent *event)
         break;
     }
   }
-  else if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) {
-    /* Note this does not remove auto-keys on locked cameras. */
-    copy_qt_qt(vod->rv3d->viewquat, vod->init.quat);
-    ED_view3d_camera_lock_sync(vod->depsgraph, vod->v3d, vod->rv3d);
-    viewops_data_free(C, op->customdata);
-    op->customdata = NULL;
-    return OPERATOR_CANCELLED;
+  else if (event->type == vod->init.event_type) {
+    /* Check `vod->init.event_type` first in case RMB was used to invoke.
+     * in this case confirming takes precedence over canceling, see: T102937. */
+    if (event->val == KM_RELEASE) {
+      event_code = VIEW_CONFIRM;
+    }
   }
-  else if (event->type == vod->init.event_type && event->val == KM_RELEASE) {
-    event_code = VIEW_CONFIRM;
+  else if (ELEM(event->type, EVT_ESCKEY, RIGHTMOUSE)) {
+    if (event->val == KM_PRESS) {
+      /* Note this does not remove auto-keys on locked cameras. */
+      copy_qt_qt(vod->rv3d->viewquat, vod->init.quat);
+      ED_view3d_camera_lock_sync(vod->depsgraph, vod->v3d, vod->rv3d);
+      viewops_data_free(C, op->customdata);
+      op->customdata = NULL;
+      return OPERATOR_CANCELLED;
+    }
   }
 
   if (event_code == VIEW_APPLY) {



More information about the Bf-blender-cvs mailing list