[Bf-blender-cvs] [3cd398f16fb] blender-v3.0-release: Fix T92694: Auto Perspective is inconsistent with axis aligned views

Campbell Barton noreply at git.blender.org
Mon Nov 1 07:16:18 CET 2021


Commit: 3cd398f16fbe4c5be05561ba47acd06121ee568d
Author: Campbell Barton
Date:   Mon Nov 1 17:02:01 2021 +1100
Branches: blender-v3.0-release
https://developer.blender.org/rB3cd398f16fbe4c5be05561ba47acd06121ee568d

Fix T92694: Auto Perspective is inconsistent with axis aligned views

Snapping to an axis aligned view with a 45 degree rotation would
set the view orthographic without setting it back to perspective
when orbiting the view as you would expect with auto-perspective.

Now orthographic is only set for views with rotation of 0, 90, 180, -90.

Notes:

- Partially reverts logic from cebd025e02f1147c48cd658816ad835f94128a4a
  at the time RegionView3D.view_axis_roll had not been added,
  so only setting the orthographic with one particular rotation
  was a bigger limitation than it is now.

- Auto-perspective could be supported when snapping the viewport to
  diagonal angles, however that's a larger project.

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

M	source/blender/editors/space_view3d/view3d_edit.c

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

diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 44652fdaf5a..b85b424405e 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -673,7 +673,6 @@ static void viewrotate_apply_snap(ViewOpsData *vod)
   float zaxis_best[3];
   int x, y, z;
   bool found = false;
-  bool is_axis_aligned = false;
 
   invert_qt_qt_normalized(viewquat_inv, vod->curr.viewquat);
 
@@ -691,10 +690,6 @@ static void viewrotate_apply_snap(ViewOpsData *vod)
           if (angle_normalized_v3v3(zaxis_test, zaxis) < axis_limit) {
             copy_v3_v3(zaxis_best, zaxis_test);
             found = true;
-
-            if (abs(x) + abs(y) + abs(z) == 1) {
-              is_axis_aligned = true;
-            }
           }
         }
       }
@@ -767,7 +762,7 @@ static void viewrotate_apply_snap(ViewOpsData *vod)
     viewrotate_apply_dyn_ofs(vod, rv3d->viewquat);
 
     if (U.uiflag & USER_AUTOPERSP) {
-      if (is_axis_aligned) {
+      if (RV3D_VIEW_IS_AXIS(rv3d->view)) {
         if (rv3d->persp == RV3D_PERSP) {
           rv3d->persp = RV3D_ORTHO;
         }



More information about the Bf-blender-cvs mailing list