diff options
author | Campbell Barton <campbell@blender.org> | 2022-08-09 02:31:18 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-08-09 02:31:18 +0300 |
commit | 8ed2abf856cbabd970d92aa3de850b0c70dccd0c (patch) | |
tree | d5a347ae3ad7cb123431c34b9046fe7f4e070001 /source/blender/editors/space_view3d/view3d_utils.c | |
parent | b3fc8206be422a7d0155f0282c2493887e441dd3 (diff) |
Fix missing undo steps for smooth-view operators
Support pushing undo steps for smooth-view operations that manipulate
the camera. Now V3D_SmoothParams take optional undo arguments.
Used for:
- VIEW3D_OT_view_center_cursor
- VIEW3D_OT_view_center_pick
- VIEW3D_OT_view_orbit
- VIEW3D_OT_view_roll
- VIEW3D_OT_zoom_border
Follow up fix for T92099.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_utils.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_utils.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c index 99f8cbc975b..0d88824a784 100644 --- a/source/blender/editors/space_view3d/view3d_utils.c +++ b/source/blender/editors/space_view3d/view3d_utils.c @@ -689,6 +689,18 @@ bool ED_view3d_camera_lock_autokey(View3D *v3d, return false; } +bool ED_view3d_camera_lock_undo_test(const View3D *v3d, + const RegionView3D *rv3d, + struct bContext *C) +{ + if (ED_view3d_camera_lock_check(v3d, rv3d)) { + if (ED_undo_is_memfile_compatible(C)) { + return true; + } + } + return false; +} + /** * Create a MEMFILE undo-step for locked camera movement when transforming the view. * Edit and texture paint mode don't use MEMFILE undo so undo push is skipped for them. @@ -699,16 +711,14 @@ bool ED_view3d_camera_lock_autokey(View3D *v3d, static bool view3d_camera_lock_undo_ex( const char *str, View3D *v3d, RegionView3D *rv3d, struct bContext *C, bool undo_group) { - if (ED_view3d_camera_lock_check(v3d, rv3d)) { - if (ED_undo_is_memfile_compatible(C)) { - if (undo_group) { - ED_undo_grouped_push(C, str); - } - else { - ED_undo_push(C, str); - } - return true; + if (ED_view3d_camera_lock_undo_test(v3d, rv3d, C)) { + if (undo_group) { + ED_undo_grouped_push(C, str); + } + else { + ED_undo_push(C, str); } + return true; } return false; } |