From 4641d6d7b0199b9df765141e00af4ce86155de82 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 11 Aug 2022 10:31:50 +1000 Subject: Cleanup: check if the camera was moved before auto-key in smooth-view There is no need to attempt to auto-key when the camera isn't moved. --- source/blender/editors/include/ED_view3d.h | 2 +- .../editors/space_view3d/view3d_navigate_smoothview.c | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index e3fb8fcd433..bb95ea97c1c 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -1171,7 +1171,7 @@ void ED_view3d_camera_lock_init(const struct Depsgraph *depsgraph, * * Apply the 3D Viewport transformation back to the camera object. * - * \return true if the camera is moved. + * \return true if the camera (or one of it's parents) was moved. */ bool ED_view3d_camera_lock_sync(const struct Depsgraph *depsgraph, struct View3D *v3d, diff --git a/source/blender/editors/space_view3d/view3d_navigate_smoothview.c b/source/blender/editors/space_view3d/view3d_navigate_smoothview.c index 9c7d493c76d..6b150d1e771 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_smoothview.c +++ b/source/blender/editors/space_view3d/view3d_navigate_smoothview.c @@ -410,9 +410,10 @@ static void view3d_smoothview_apply_with_interp( v3d->lens = interpf(sms->dst.lens, sms->src.lens, factor); const Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); - ED_view3d_camera_lock_sync(depsgraph, v3d, rv3d); - if (use_autokey) { - ED_view3d_camera_lock_autokey(v3d, rv3d, C, true, true); + if (ED_view3d_camera_lock_sync(depsgraph, v3d, rv3d)) { + if (use_autokey) { + ED_view3d_camera_lock_autokey(v3d, rv3d, C, true, true); + } } } @@ -436,8 +437,9 @@ static void view3d_smoothview_apply_and_finish(bContext *C, View3D *v3d, RegionV view3d_smooth_view_state_restore(&sms->dst, v3d, rv3d); - ED_view3d_camera_lock_sync(depsgraph, v3d, rv3d); - ED_view3d_camera_lock_autokey(v3d, rv3d, C, true, true); + if (ED_view3d_camera_lock_sync(depsgraph, v3d, rv3d)) { + ED_view3d_camera_lock_autokey(v3d, rv3d, C, true, true); + } } if ((RV3D_LOCK_FLAGS(rv3d) & RV3D_LOCK_ROTATION) == 0) { -- cgit v1.2.3