Fix T41137: Old render result from viewport render in camera view does not go away...
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 18 Aug 2014 13:32:25 +0000 (19:32 +0600)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 18 Aug 2014 13:33:06 +0000 (19:33 +0600)
source/blender/editors/space_view3d/view3d_edit.c

index 6cd2e7bfe1bc914331b031afcd2cb056d84d5f4f..2acd842bcecb243e369b234b0b1504cdcc9e5980 100644 (file)
@@ -1172,7 +1172,7 @@ static int viewrotate_modal(bContext *C, wmOperator *op, const wmEvent *event)
  *
  * shared with NDOF.
  */
-static void view3d_ensure_persp(struct View3D *v3d, ARegion *ar)
+static bool view3d_ensure_persp(struct View3D *v3d, ARegion *ar)
 {
        RegionView3D *rv3d = ar->regiondata;
        const bool autopersp = (U.uiflag & USER_AUTOPERSP) != 0;
@@ -1180,7 +1180,7 @@ static void view3d_ensure_persp(struct View3D *v3d, ARegion *ar)
        BLI_assert((rv3d->viewlock & RV3D_LOCKED) == 0);
 
        if (ED_view3d_camera_lock_check(v3d, rv3d))
-               return;
+               return false;
 
        if (rv3d->persp != RV3D_PERSP) {
                if (rv3d->persp == RV3D_CAMOB) {
@@ -1191,7 +1191,10 @@ static void view3d_ensure_persp(struct View3D *v3d, ARegion *ar)
                else if (autopersp && RV3D_VIEW_IS_AXIS(rv3d->view)) {
                        rv3d->persp = RV3D_PERSP;
                }
+               return true;
        }
+
+       return false;
 }
 
 static int viewrotate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
@@ -1210,8 +1213,14 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
        }
 
        /* switch from camera view when: */
-       view3d_ensure_persp(vod->v3d, vod->ar);
-       
+       if (view3d_ensure_persp(vod->v3d, vod->ar)) {
+               /* If we're switching from camera view to the perspective one,
+                * need to tag viewport update, so camera vuew and borders
+                * are properly updated.
+                */
+               ED_region_tag_redraw(vod->ar);
+       }
+
        if (event->type == MOUSEPAN) {
                /* Rotate direction we keep always same */
                if (U.uiflag2 & USER_TRACKPAD_NATURAL)