diff options
-rw-r--r-- | source/blender/editors/gpencil/drawgpencil.c | 2 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 2 | ||||
-rw-r--r-- | source/blender/editors/include/ED_view3d.h | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_draw.c | 11 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_view.c | 7 |
6 files changed, 16 insertions, 10 deletions
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index e19f774412b..29cdfffa551 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -754,7 +754,7 @@ void draw_gpencil_view3d_ext (Scene *scene, View3D *v3d, ARegion *ar, short only * deal with the camera border, otherwise map the coords to the camera border. */ if(rv3d->persp == RV3D_CAMOB && !(G.f & G_RENDER_OGL)) { rctf rectf; - view3d_calc_camera_border(scene, ar, rv3d, v3d, &rectf); + view3d_calc_camera_border(scene, ar, rv3d, v3d, &rectf, -1); /* negative shift */ BLI_copy_rcti_rctf(&rect, &rectf); } else { diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 75156571cf4..23e2755613c 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -890,7 +890,7 @@ static tGPsdata *gp_session_initpaint (bContext *C) /* for camera view set the subrect */ if(rv3d->persp == RV3D_CAMOB) { - view3d_calc_camera_border(p->scene, p->ar, NULL, v3d, &p->subrect_data); + view3d_calc_camera_border(p->scene, p->ar, NULL, v3d, &p->subrect_data, -1); /* negative shift */ p->subrect= &p->subrect_data; } diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index fe024be29e0..d2c13b7bf85 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -106,7 +106,7 @@ int get_view3d_viewplane(struct View3D *v3d, struct RegionView3D *rv3d, int winx int get_view3d_ortho(struct View3D *v3d, struct RegionView3D *rv3d); void view3d_get_object_project_mat(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]); void view3d_project_float(struct ARegion *a, float *vec, float *adr, float mat[4][4]); -void view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct RegionView3D *rv3d, struct View3D *v3d, struct rctf *viewborder_r); +void view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct RegionView3D *rv3d, struct View3D *v3d, struct rctf *viewborder_r, short do_shift); /* drawobject.c itterators */ void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct EditVert *eve, int x, int y, int index), void *userData, int clipVerts); diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 30880db0c90..0421fdadb7b 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -843,7 +843,7 @@ static void view3d_get_viewborder_size(Scene *scene, ARegion *ar, float size_r[2 } } -void view3d_calc_camera_border(Scene *scene, ARegion *ar, RegionView3D *rv3d, View3D *v3d, rctf *viewborder_r) +void view3d_calc_camera_border(Scene *scene, ARegion *ar, RegionView3D *rv3d, View3D *v3d, rctf *viewborder_r, short do_shift) { float zoomfac, size[2]; float dx= 0.0f, dy= 0.0f; @@ -882,12 +882,13 @@ void view3d_calc_camera_border(Scene *scene, ARegion *ar, RegionView3D *rv3d, Vi viewborder_r->xmax-= dx; viewborder_r->ymax-= dy; - if(v3d->camera && v3d->camera->type==OB_CAMERA) { + if(do_shift && v3d->camera && v3d->camera->type==OB_CAMERA) { Camera *cam= v3d->camera->data; float w = viewborder_r->xmax - viewborder_r->xmin; float h = viewborder_r->ymax - viewborder_r->ymin; float side = MAX2(w, h); - + + if(do_shift == -1) side *= -1; viewborder_r->xmin+= cam->shiftx*side; viewborder_r->xmax+= cam->shiftx*side; viewborder_r->ymin+= cam->shifty*side; @@ -922,7 +923,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) if(v3d->camera->type==OB_CAMERA) ca = v3d->camera->data; - view3d_calc_camera_border(scene, ar, rv3d, v3d, &viewborder); + view3d_calc_camera_border(scene, ar, rv3d, v3d, &viewborder, FALSE); /* the offsets */ x1= viewborder.xmin; y1= viewborder.ymin; @@ -1259,7 +1260,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d) if(rv3d->persp==RV3D_CAMOB) { rctf vb; - view3d_calc_camera_border(scene, ar, rv3d, v3d, &vb); + view3d_calc_camera_border(scene, ar, rv3d, v3d, &vb, FALSE); x1= vb.xmin; y1= vb.ymin; diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 42767d98c80..d3f977072c1 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -1594,7 +1594,7 @@ static int render_border_exec(bContext *C, wmOperator *op) rect.ymax= RNA_int_get(op->ptr, "ymax"); /* calculate range */ - view3d_calc_camera_border(scene, ar, rv3d, v3d, &vb); + view3d_calc_camera_border(scene, ar, rv3d, v3d, &vb, FALSE); scene->r.border.xmin= ((float)rect.xmin-vb.xmin)/(vb.xmax-vb.xmin); scene->r.border.ymin= ((float)rect.ymin-vb.ymin)/(vb.ymax-vb.ymin); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 85c8e06a555..046ba29365f 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -1021,6 +1021,11 @@ int get_view3d_viewplane(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi, if(cam) { float dx= 0.5*fac*rv3d->camdx*(x2-x1); float dy= 0.5*fac*rv3d->camdy*(y2-y1); + + /* shify offset */ + dx += ((cam->shiftx/10.0f) / cam->lens) * 32.0; + dy += ((cam->shifty/10.0f) / cam->lens) * 32.0; + x1+= dx; x2+= dx; y1+= dy; @@ -1762,7 +1767,7 @@ static int game_engine_exec(bContext *C, wmOperator *op) if(rv3d->persp==RV3D_CAMOB && startscene->gm.framing.type == SCE_GAMEFRAMING_BARS && startscene->gm.stereoflag != STEREO_DOME) { /* Letterbox */ rctf cam_framef; - view3d_calc_camera_border(startscene, ar, rv3d, CTX_wm_view3d(C), &cam_framef); + view3d_calc_camera_border(startscene, ar, rv3d, CTX_wm_view3d(C), &cam_framef, FALSE); cam_frame.xmin = cam_framef.xmin + ar->winrct.xmin; cam_frame.xmax = cam_framef.xmax + ar->winrct.xmin; cam_frame.ymin = cam_framef.ymin + ar->winrct.ymin; |