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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-05-20 08:14:29 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-05-20 08:14:29 +0400
commit984d2e42e4a81c1f92dc405ce1b265842bc94b9a (patch)
tree21b11fb1d14a552bebb032a452cbd54ae9036d07 /source/blender/editors/space_view3d/view3d_edit.c
parentc07012b41e3da6df172e0bee407ac9623ddf4b03 (diff)
make api functions for converting rv3d->camzoom, so the odd logic for this isn't inlined all over.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_edit.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index f0f77353435..897114b5a3f 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -56,6 +56,7 @@
#include "BKE_paint.h"
#include "BKE_report.h"
#include "BKE_scene.h"
+#include "BKE_screen.h"
#include "BKE_depsgraph.h" /* for ED_view3d_camera_lock_sync */
@@ -919,14 +920,11 @@ void viewmove_modal_keymap(wmKeyConfig *keyconf)
static void viewmove_apply(ViewOpsData *vod, int x, int y)
{
if((vod->rv3d->persp==RV3D_CAMOB) && !(vod->v3d->flag2 & V3D_LOCK_CAMERA)) {
- float zoomfac= ((float)M_SQRT2 + (float)vod->rv3d->camzoom / 50.0f);
- zoomfac= (zoomfac * zoomfac) * 0.5f;
-
+ const float zoomfac= BKE_screen_view3d_zoom_to_fac((float)vod->rv3d->camzoom) * 2.0f;
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;
}
else {
float dvec[3];
@@ -1888,8 +1886,8 @@ static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was
xfac= (float)ar->winx / (float)(size[0] + 4);
yfac= (float)ar->winy / (float)(size[1] + 4);
- rv3d->camzoom= (sqrtf(4.0f * MIN2(xfac, yfac)) - (float)M_SQRT2) * 50.0f;
- rv3d->camzoom= CLAMPIS(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
+ rv3d->camzoom= BKE_screen_view3d_zoom_from_fac(MIN2(xfac, yfac));
+ CLAMP(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C));
@@ -2145,9 +2143,9 @@ static void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar)
int im_width= (scene->r.size*scene->r.xsch)/100;
view3d_viewborder_size_get(scene, ar, size);
-
- rv3d->camzoom= (sqrtf(4.0f * (float)im_width/size[0]) - (float)M_SQRT2) * 50.0f;
- rv3d->camzoom= CLAMPIS(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
+
+ rv3d->camzoom= BKE_screen_view3d_zoom_from_fac((float)im_width/size[0]);
+ CLAMP(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
}
static int view3d_zoom_1_to_1_camera_exec(bContext *C, wmOperator *UNUSED(op))