3DView: ability to cancel out of viewport roll

This adds the ability to cancel out of the roll using ESC or RMB
(which is not common for viewops -- but makes sense in the case of roll
I think). This resets the view as well as potential locked cameras to
the original orientations (but does not remove potential autokeys --
which no transform does on cancel btw.)

Maniphest Tasks: T89883

Differential Revision: https://developer.blender.org/D12582
This commit is contained in:
Philipp Oeser 2021-09-27 11:54:25 +02:00
parent 69893ef27c
commit 5d5504d8a4
Notes: blender-bot 2023-02-14 10:11:49 +01:00
Referenced by issue #102937, "view3d.view_roll" operator conflicts with Right Mouse button
Referenced by issue #94528, bpy.ops.view3d.view_roll(type='ANGLE') Operation failure
Referenced by issue #89883, Bug? Inconsistency? Viewport roll use horizontal move instead angle
1 changed files with 7 additions and 0 deletions

View File

@ -4408,6 +4408,13 @@ 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 autokeys 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);
return OPERATOR_CANCELLED;
}
else if (event->type == vod->init.event_type && event->val == KM_RELEASE) {
event_code = VIEW_CONFIRM;
}