[Bf-blender-cvs] [4641d6d7b01] master: Cleanup: check if the camera was moved before auto-key in smooth-view

Campbell Barton noreply at git.blender.org
Thu Aug 11 03:04:03 CEST 2022


Commit: 4641d6d7b0199b9df765141e00af4ce86155de82
Author: Campbell Barton
Date:   Thu Aug 11 10:31:50 2022 +1000
Branches: master
https://developer.blender.org/rB4641d6d7b0199b9df765141e00af4ce86155de82

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.

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

M	source/blender/editors/include/ED_view3d.h
M	source/blender/editors/space_view3d/view3d_navigate_smoothview.c

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

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



More information about the Bf-blender-cvs mailing list