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:
authorCampbell Barton <ideasman42@gmail.com>2010-09-11 08:39:00 +0400
committerCampbell Barton <ideasman42@gmail.com>2010-09-11 08:39:00 +0400
commitb2b08692124cac0571e40f8bbf2b92fde857e8b9 (patch)
treeba53ed3a09b10fd5ae0faa572a7b5b74316e9d7f /source
parent63a8056839b0b43c4e2a0f24ca894ea7912ab234 (diff)
- camera max zoom limit was inconsistent
- camera pan now follows the mouse
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c11
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h3
3 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 56e66e21a72..17516f6a40c 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -923,7 +923,7 @@ void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar)
view3d_get_viewborder_size(scene, ar, size);
rv3d->camzoom= (sqrt(4.0*im_width/size[0]) - M_SQRT2)*50.0;
- rv3d->camzoom= CLAMPIS(rv3d->camzoom, -30, 300);
+ rv3d->camzoom= CLAMPIS(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
}
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 3614717e9e0..e2c12386dd3 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -854,10 +854,11 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf)
static void viewmove_apply(ViewOpsData *vod, int x, int y)
{
if(vod->rv3d->persp==RV3D_CAMOB) {
- float max= (float)MAX2(vod->ar->winx, vod->ar->winy);
+ float zoomfac= (M_SQRT2 + vod->rv3d->camzoom/50.0);
+ zoomfac= (zoomfac*zoomfac)*0.5;
- vod->rv3d->camdx += (vod->oldx - x)/(max);
- vod->rv3d->camdy += (vod->oldy - y)/(max);
+ vod->rv3d->camdx += (vod->oldx - x)/(vod->ar->winx * zoomfac);
+ vod->rv3d->camdy += (vod->oldy - y)/(vod->ar->winy * zoomfac);
CLAMP(vod->rv3d->camdx, -1.0f, 1.0f);
CLAMP(vod->rv3d->camdy, -1.0f, 1.0f);
// XXX preview3d_event= 0;
@@ -1165,7 +1166,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
/* this min and max is also in viewmove() */
if(rv3d->persp==RV3D_CAMOB) {
rv3d->camzoom-= 10;
- if(rv3d->camzoom<-30) rv3d->camzoom= -30;
+ if(rv3d->camzoom < RV3D_CAMZOOM_MIN) rv3d->camzoom= RV3D_CAMZOOM_MIN;
}
else if(rv3d->dist<10.0*v3d->far) {
view_zoom_mouseloc(CTX_wm_region(C), 1.2f, mx, my);
@@ -1174,7 +1175,7 @@ static int viewzoom_exec(bContext *C, wmOperator *op)
else {
if(rv3d->persp==RV3D_CAMOB) {
rv3d->camzoom+= 10;
- if(rv3d->camzoom>600) rv3d->camzoom= 600;
+ if(rv3d->camzoom > RV3D_CAMZOOM_MAX) rv3d->camzoom= RV3D_CAMZOOM_MAX;
}
else if(rv3d->dist> 0.001*v3d->grid) {
view_zoom_mouseloc(CTX_wm_region(C), .83333f, mx, my);
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index 520fc56162c..f692c80f81f 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -299,6 +299,9 @@ typedef struct View3D {
/* may want to use 1 for select ?*/
#define V3D_BGPIC_EXPANDED 2
+#define RV3D_CAMZOOM_MIN -30
+#define RV3D_CAMZOOM_MAX 600
+
#endif