From b98bc2617380ae3a8299b64d1b0a57079c3c8bdc Mon Sep 17 00:00:00 2001
From: Germano Cavalcante <germano.costa@ig.com.br>
Date: Mon, 13 Nov 2023 14:30:14 +0100
Subject: [PATCH] Fix #114714: Rotating the View can drastically change the
 view's position when Auto Depth or Orbit Arround Select is set

Caused by 6faa39edb7

In that commit it was assumed that the view offset does not need to be
updated if the operator is `V3D_OP_MODE_ROTATE` instead of simply
checking `this->use_dyn_ofs`.

Since `use_dyn_ofs` is always `True` when using Auto Depth or Orbit
Arround Select, the offset should always be updated in these cases.

Pull Request: https://projects.blender.org/blender/blender/pulls/114726
---
 source/blender/editors/space_view3d/view3d_navigate.cc | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/source/blender/editors/space_view3d/view3d_navigate.cc b/source/blender/editors/space_view3d/view3d_navigate.cc
index f5c3a6a7092..05a45c6e9a5 100644
--- a/source/blender/editors/space_view3d/view3d_navigate.cc
+++ b/source/blender/editors/space_view3d/view3d_navigate.cc
@@ -280,8 +280,9 @@ void ViewOpsData::init_navigation(bContext *C,
     negate_v3_v3(this->dyn_ofs, pivot_new);
     this->use_dyn_ofs = true;
 
-    if (!(nav_type->flag & VIEWOPS_FLAG_ORBIT_SELECT)) {
-      /* Calculate new #RegionView3D::ofs and #RegionView3D::dist. */
+    {
+      /* The pivot has changed so the offset needs to be updated as well.
+       * Calculate new #RegionView3D::ofs and #RegionView3D::dist. */
 
       if (rv3d->is_persp) {
         float my_origin[3]; /* Original #RegionView3D.ofs. */
-- 
GitLab