Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2006-01-05 00:16:09 +0300
committerTon Roosendaal <ton@blender.org>2006-01-05 00:16:09 +0300
commit987a3216c3f980ace0023580b4223b76e9640c17 (patch)
treebf8743bd65549da949643685c6b439ca9d815407 /source
parent1521012c18fbac571275367d0ff39de6567d16bf (diff)
Orange: Hold SHIFT+MMB in camera view shifts the viewports around.
Diffstat (limited to 'source')
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h1
-rw-r--r--source/blender/src/drawview.c12
-rw-r--r--source/blender/src/view.c26
3 files changed, 27 insertions, 12 deletions
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 3e1628a658c..960ed6181e5 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -102,6 +102,7 @@ typedef struct View3D {
short scenelock, around, camzoom, flag;
float lens, grid, gridview, pixsize, near, far;
+ float camdx, camdy; /* camera view offsets, 1.0 = viewplane moves entire width/height */
float ofs[3], cursor[3];
short gridlines, viewbut;
diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c
index 2382857c44f..17cbb226e7b 100644
--- a/source/blender/src/drawview.c
+++ b/source/blender/src/drawview.c
@@ -866,7 +866,8 @@ static void view3d_get_viewborder_size(View3D *v3d, float size_r[2])
void calc_viewborder(struct View3D *v3d, rcti *viewborder_r)
{
float zoomfac, size[2];
-
+ float dx= 0.0f, dy= 0.0f;
+
view3d_get_viewborder_size(v3d, size);
/* magic zoom calculation, no idea what
@@ -888,6 +889,15 @@ void calc_viewborder(struct View3D *v3d, rcti *viewborder_r)
viewborder_r->ymin= 0.5*v3d->area->winy - 0.5*size[1];
viewborder_r->xmax= viewborder_r->xmin + size[0];
viewborder_r->ymax= viewborder_r->ymin + size[1];
+
+ dx= v3d->area->winx*G.vd->camdx;
+ dy= v3d->area->winy*G.vd->camdy;
+
+ /* apply offset */
+ viewborder_r->xmin-= dx;
+ viewborder_r->ymin-= dy;
+ viewborder_r->xmax-= dx;
+ viewborder_r->ymax-= dy;
}
void view3d_set_1_to_1_viewborder(View3D *v3d)
diff --git a/source/blender/src/view.c b/source/blender/src/view.c
index 5de5e134c4b..1fb162465c3 100644
--- a/source/blender/src/view.c
+++ b/source/blender/src/view.c
@@ -585,7 +585,7 @@ void viewmove(int mode)
G.vd->view= 0;
}
- if(G.vd->persp==2 || (G.vd->persp==3 && mode!=1)) {
+ if(G.vd->persp==2 && mode!=1) {
G.vd->persp= 1;
scrarea_do_windraw(curarea);
scrarea_queue_headredraw(curarea);
@@ -694,16 +694,11 @@ void viewmove(int mode)
}
}
else if(mode==1) { /* translate */
- if(G.vd->persp==3) {
- /* zoom= 0.5+0.5*(float)(2<<G.vd->rt1); */
- /* dx-= (mval[0]-mvalo[0])/zoom; */
- /* dy-= (mval[1]-mvalo[1])/zoom; */
- /* G.vd->rt2= dx; */
- /* G.vd->rt3= dy; */
- /* if(G.vd->rt2<-320) G.vd->rt2= -320; */
- /* if(G.vd->rt2> 320) G.vd->rt2= 320; */
- /* if(G.vd->rt3<-250) G.vd->rt3= -250; */
- /* if(G.vd->rt3> 250) G.vd->rt3= 250; */
+ if(G.vd->persp==2) {
+ float max= (float)MAX2(curarea->winx, curarea->winy);
+
+ G.vd->camdx += (mvalo[0]-mval[0])/(max);
+ G.vd->camdy += (mvalo[1]-mval[1])/(max);
}
else {
window_to_3d(dvec, mval[0]-mvalo[0], mval[1]-mvalo[1]);
@@ -860,6 +855,15 @@ void setwinmatrixview3d(rctf *rect) /* rect: for picking */
y2= -y1;
orth= 0;
}
+ /* cam view offset */
+ if(cam) {
+ float dx= G.vd->camdx*(x2-x1);
+ float dy= G.vd->camdy*(y2-y1);
+ x1+= dx;
+ x2+= dx;
+ y1+= dy;
+ y2+= dy;
+ }
}
if(rect) { /* picking */