Fix for [#20159] Orthographic camera + viewport
authorMatt Ebb <matt@mke3.net>
Mon, 7 Dec 2009 10:40:55 +0000 (10:40 +0000)
committerMatt Ebb <matt@mke3.net>
Mon, 7 Dec 2009 10:40:55 +0000 (10:40 +0000)
Patch provided by Aurel W. Thanks!

source/blender/editors/space_view3d/view3d_edit.c

index 844ee2973ce3f8dcf738c8c01e4b379d44c02b01..0ea185589e1c46b7e8ecee9e0f329d953f1d51ec 100644 (file)
@@ -1628,36 +1628,43 @@ static int viewnumpad_exec(bContext *C, wmOperator *op)
        RegionView3D *rv3d= CTX_wm_region_view3d(C);
        Scene *scene= CTX_data_scene(C);
        static int perspo=RV3D_PERSP;
-       int viewnum, align_active;
+       int viewnum, align_active, nextperspo;
 
        viewnum = RNA_enum_get(op->ptr, "type");
        align_active = RNA_boolean_get(op->ptr, "align_active");
 
+
        /* Use this to test if we started out with a camera */
 
+       if (rv3d->persp == RV3D_CAMOB) {
+               nextperspo= rv3d->lpersp;
+       } else {
+               nextperspo= perspo;
+       }
+
        switch (viewnum) {
                case RV3D_VIEW_BOTTOM :
-                       axis_set_view(C, 0.0, -1.0, 0.0, 0.0, viewnum, perspo, align_active);
+                       axis_set_view(C, 0.0, -1.0, 0.0, 0.0, viewnum, nextperspo, align_active);
                        break;
 
                case RV3D_VIEW_BACK:
-                       axis_set_view(C, 0.0, 0.0, (float)-cos(M_PI/4.0), (float)-cos(M_PI/4.0), viewnum, perspo, align_active);
+                       axis_set_view(C, 0.0, 0.0, (float)-cos(M_PI/4.0), (float)-cos(M_PI/4.0), viewnum, nextperspo, align_active);
                        break;
 
                case RV3D_VIEW_LEFT:
-                       axis_set_view(C, 0.5, -0.5, 0.5, 0.5, viewnum, perspo, align_active);
+                       axis_set_view(C, 0.5, -0.5, 0.5, 0.5, viewnum, nextperspo, align_active);
                        break;
 
                case RV3D_VIEW_TOP:
-                       axis_set_view(C, 1.0, 0.0, 0.0, 0.0, viewnum, perspo, align_active);
+                       axis_set_view(C, 1.0, 0.0, 0.0, 0.0, viewnum, nextperspo, align_active);
                        break;
 
                case RV3D_VIEW_FRONT:
-                       axis_set_view(C, (float)cos(M_PI/4.0), (float)-sin(M_PI/4.0), 0.0, 0.0, viewnum, perspo, align_active);
+                       axis_set_view(C, (float)cos(M_PI/4.0), (float)-sin(M_PI/4.0), 0.0, 0.0, viewnum, nextperspo, align_active);
                        break;
 
                case RV3D_VIEW_RIGHT:
-                       axis_set_view(C, 0.5, -0.5, -0.5, -0.5, viewnum, perspo, align_active);
+                       axis_set_view(C, 0.5, -0.5, -0.5, -0.5, viewnum, nextperspo, align_active);
                        break;
 
                case RV3D_VIEW_CAMERA: