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

When RMB is used to start the operator, don't use it for canceling.
This commit is contained in:
Campbell Barton 2022-12-06 20:49:38 +11:00
parent ea14c48c09
commit 31943d1313
Notes: blender-bot 2023-02-14 00:37:17 +01:00
Referenced by issue #102937, "view3d.view_roll" operator conflicts with Right Mouse button
1 changed files with 15 additions and 9 deletions

View File

@ -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) {