[Bf-blender-cvs] [a65ef6a] master: Fix T37586: Auto-perspective was changing to perspective while orbiting

Campbell Barton noreply at git.blender.org
Mon Nov 25 02:57:49 CET 2013


Commit: a65ef6a1df8fc22105575013128eecbb071df5e4
Author: Campbell Barton
Date:   Mon Nov 25 12:53:40 2013 +1100
http://developer.blender.org/rBa65ef6a1df8fc22105575013128eecbb071df5e4

Fix T37586: Auto-perspective was changing to perspective while orbiting

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

M	source/blender/editors/space_view3d/view3d_edit.c
M	source/blender/makesdna/DNA_view3d_types.h

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

diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index b49abaf..c659468 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -992,15 +992,15 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
 
 	/* switch from camera view when: */
 	if (vod->rv3d->persp != RV3D_PERSP) {
-
-		if (U.uiflag & USER_AUTOPERSP) {
+		if (vod->rv3d->persp == RV3D_CAMOB) {
+			const short lpersp = (U.uiflag & USER_AUTOPERSP) ? RV3D_PERSP : vod->rv3d->lpersp;
+			view3d_persp_switch_from_camera(vod->v3d, vod->rv3d, lpersp);
+		}
+		else if ((U.uiflag & USER_AUTOPERSP) && RV3D_VIEW_IS_AXIS(vod->rv3d->view)) {
 			if (!ED_view3d_camera_lock_check(vod->v3d, vod->rv3d)) {
 				vod->rv3d->persp = RV3D_PERSP;
 			}
 		}
-		else if (vod->rv3d->persp == RV3D_CAMOB) {
-			view3d_persp_switch_from_camera(vod->v3d, vod->rv3d, vod->rv3d->lpersp);
-		}
 		ED_region_tag_redraw(vod->ar);
 	}
 	
@@ -3344,20 +3344,19 @@ static void axis_set_view(bContext *C, View3D *v3d, ARegion *ar,
 		return;
 	}
 
-	if (rv3d->persp == RV3D_CAMOB && v3d->camera) {
-
-		if (U.uiflag & USER_AUTOPERSP) rv3d->persp = view ? RV3D_ORTHO : RV3D_PERSP;
-		else if (rv3d->persp == RV3D_CAMOB) rv3d->persp = perspo;
+	if (U.uiflag & USER_AUTOPERSP) {
+		rv3d->persp = RV3D_VIEW_IS_AXIS(view) ? RV3D_ORTHO : perspo;
+	}
+	else if (rv3d->persp == RV3D_CAMOB) {
+		rv3d->persp = perspo;
+	}
 
+	if (rv3d->persp == RV3D_CAMOB && v3d->camera) {
 		ED_view3d_smooth_view(C, v3d, ar, v3d->camera, NULL,
 		                      rv3d->ofs, new_quat, NULL, NULL,
 		                      smooth_viewtx);
 	}
 	else {
-
-		if (U.uiflag & USER_AUTOPERSP) rv3d->persp = view ? RV3D_ORTHO : RV3D_PERSP;
-		else if (rv3d->persp == RV3D_CAMOB) rv3d->persp = perspo;
-
 		ED_view3d_smooth_view(C, v3d, ar, NULL, NULL,
 		                      NULL, new_quat, NULL, NULL,
 		                      smooth_viewtx);
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index c724340..a154f6f 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -266,6 +266,9 @@ typedef struct View3D {
 #define RV3D_VIEW_PERSPORTHO	 7
 #define RV3D_VIEW_CAMERA		 8
 
+#define RV3D_VIEW_IS_AXIS(view) \
+	((view >= RV3D_VIEW_FRONT) && (view <= RV3D_VIEW_BOTTOM))
+
 /* View3d->flag2 (short) */
 #define V3D_RENDER_OVERRIDE		4
 #define V3D_SOLID_TEX			8




More information about the Bf-blender-cvs mailing list