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-04-22 18:47:35 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-04-22 18:47:35 +0400
commitee9ea98e48d6dd1c7447baa049d15739588fe6de (patch)
treead4bea198b6793a9a532026065c9b94743588018
parent05c7db95b684bde9e251caf2c993d616180dd72f (diff)
zoom operator.
- continue zoom now uses the same options as dolly (hoz/vert & invert). - remove event mouse coord hack to bypass touchpad zoom invert, instead pass invert as an argument.
-rw-r--r--release/scripts/startup/bl_ui/space_userpref.py4
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c35
-rw-r--r--source/blender/makesdna/DNA_userdef_types.h2
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c6
-rw-r--r--source/blender/render/intern/source/rayshade.c2
5 files changed, 30 insertions, 19 deletions
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 13ff09d7f23..7ae2efb3696 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -800,9 +800,9 @@ class USERPREF_PT_input(InputKeyMapPanel):
sub.label(text="Zoom Style:")
sub.row().prop(inputs, "view_zoom_method", text="")
- if inputs.view_zoom_method == 'DOLLY':
+ if inputs.view_zoom_method in {'DOLLY', 'CONTINUE'}:
sub.row().prop(inputs, "view_zoom_axis", expand=True)
- sub.prop(inputs, "invert_mouse_wheel_zoom")
+ sub.prop(inputs, "invert_mouse_zoom")
#sub.prop(inputs, "use_mouse_mmb_paste")
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 67576c188af..2b971a84af6 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -1075,16 +1075,28 @@ static void view_zoom_mouseloc(ARegion *ar, float dfac, int mx, int my)
}
-static void viewzoom_apply(ViewOpsData *vod, int x, int y, short viewzoom)
+static void viewzoom_apply(ViewOpsData *vod, int x, int y, const short viewzoom, const short zoom_invert)
{
float zfac=1.0;
if(viewzoom==USER_ZOOM_CONT) {
double time= PIL_check_seconds_timer();
float time_step= (float)(time - vod->timer_lastdraw);
+ float fac;
+
+ if (U.uiflag & USER_ZOOM_HORIZ) {
+ fac= (float)(x - vod->origx);
+ }
+ else {
+ fac= (float)(y - vod->origy);
+ }
+
+ if(zoom_invert) {
+ fac= -fac;
+ }
// oldstyle zoom
- zfac = 1.0f + (((float)(vod->origx - x + vod->origy - y) / 20.0f) * time_step);
+ zfac = 1.0f + ((fac / 20.0f) * time_step);
vod->timer_lastdraw= time;
}
else if(viewzoom==USER_ZOOM_SCALE) {
@@ -1102,7 +1114,7 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, short viewzoom)
else { /* USER_ZOOM_DOLLY */
float len1, len2;
- if (U.uiflag & USER_ZOOM_DOLLY_HORIZ) {
+ if (U.uiflag & USER_ZOOM_HORIZ) {
len1 = (vod->ar->winrct.xmax - x) + 5;
len2 = (vod->ar->winrct.xmax - vod->origx) + 5;
}
@@ -1110,14 +1122,15 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y, short viewzoom)
len1 = (vod->ar->winrct.ymax - y) + 5;
len2 = (vod->ar->winrct.ymax - vod->origy) + 5;
}
- if (U.uiflag & USER_ZOOM_INVERT)
+ if (zoom_invert) {
SWAP(float, len1, len2);
+ }
zfac = vod->dist0 * (2.0f * ((len2/len1)-1.0f) + 1.0f) / vod->rv3d->dist;
}
if(zfac != 1.0f && zfac*vod->rv3d->dist > 0.001f * vod->grid &&
- zfac * vod->rv3d->dist < 10.0f * vod->far)
+ zfac * vod->rv3d->dist < 10.0f * vod->far)
view_zoom_mouseloc(vod->ar, zfac, vod->oldx, vod->oldy);
@@ -1179,7 +1192,7 @@ static int viewzoom_modal(bContext *C, wmOperator *op, wmEvent *event)
}
if(event_code==VIEW_APPLY) {
- viewzoom_apply(vod, event->x, event->y, U.viewzoom);
+ viewzoom_apply(vod, event->x, event->y, U.viewzoom, (U.uiflag & USER_ZOOM_INVERT) != 0);
}
else if (event_code==VIEW_CONFIRM) {
request_depth_update(vod->rv3d);
@@ -1272,18 +1285,16 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, wmEvent *event)
vod= op->customdata;
if (event->type == MOUSEZOOM) {
- if (U.uiflag & USER_ZOOM_INVERT) /* Bypass Zoom invert flag */
- SWAP(int, event->x, event->prevx);
+ /* Bypass Zoom invert flag for track pads (pass FALSE always) */
- if (U.uiflag & USER_ZOOM_DOLLY_HORIZ) {
+ if (U.uiflag & USER_ZOOM_HORIZ) {
vod->origx = vod->oldx = event->x;
- viewzoom_apply(vod, event->prevx, event->prevy, USER_ZOOM_DOLLY);
+ viewzoom_apply(vod, event->prevx, event->prevy, USER_ZOOM_DOLLY, FALSE);
}
else {
-
/* Set y move = x move as MOUSEZOOM uses only x axis to pass magnification value */
vod->origy = vod->oldy = vod->origy + event->x - event->prevx;
- viewzoom_apply(vod, event->prevx, event->prevy, USER_ZOOM_DOLLY);
+ viewzoom_apply(vod, event->prevx, event->prevy, USER_ZOOM_DOLLY, FALSE);
}
request_depth_update(vod->rv3d);
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 1eff1c3c640..1be67a4501b 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -476,7 +476,7 @@ extern UserDef U; /* from blenkernel blender.c */
#define USER_MENUFIXEDORDER (1 << 23)
#define USER_CONTINUOUS_MOUSE (1 << 24)
#define USER_ZOOM_INVERT (1 << 25)
-#define USER_ZOOM_DOLLY_HORIZ (1 << 26)
+#define USER_ZOOM_HORIZ (1 << 26) /* for CONTINUE and DOLLY zoom */
#define USER_SPLASH_DISABLE (1 << 27)
#define USER_HIDE_RECENT (1 << 28)
#define USER_SHOW_THUMBNAILS (1 << 29)
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index c21feead18f..a914d875490 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -2651,8 +2651,8 @@ static void rna_def_userdef_input(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL}};
static EnumPropertyItem view_zoom_axes[] = {
- {0, "VERTICAL", 0, "Vertical", "Zooms in and out based on vertical mouse movement"},
- {USER_ZOOM_DOLLY_HORIZ, "HORIZONTAL", 0, "Horizontal", "Zooms in and out based on horizontal mouse movement"},
+ {0, "VERTICAL", 0, "Vertical", "Zooms in and out based on vertical mouse movement"},
+ {USER_ZOOM_HORIZ, "HORIZONTAL", 0, "Horizontal", "Zooms in and out based on horizontal mouse movement"},
{0, NULL, 0, NULL, NULL}};
srna= RNA_def_struct(brna, "UserPreferencesInput", NULL);
@@ -2676,7 +2676,7 @@ static void rna_def_userdef_input(BlenderRNA *brna)
RNA_def_property_enum_items(prop, view_zoom_axes);
RNA_def_property_ui_text(prop, "Zoom Axis", "Axis of mouse movement to zoom in or out on");
- prop= RNA_def_property(srna, "invert_mouse_wheel_zoom", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "invert_mouse_zoom", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZOOM_INVERT);
RNA_def_property_ui_text(prop, "Invert Zoom Direction", "Invert the axis of mouse movement for zooming");
diff --git a/source/blender/render/intern/source/rayshade.c b/source/blender/render/intern/source/rayshade.c
index 4147fc4cdd8..b57fe5a8c3b 100644
--- a/source/blender/render/intern/source/rayshade.c
+++ b/source/blender/render/intern/source/rayshade.c
@@ -445,7 +445,7 @@ void makeraytree(Render *re)
re->i.infostr= "Raytree.. preparing";
re->stats_draw(re->sdh, &re->i);
- /* disable options not yet suported by octree,
+ /* disable options not yet supported by octree,
they might actually never be supported (unless people really need it) */
if(re->r.raytrace_structure == R_RAYSTRUCTURE_OCTREE)
re->r.raytrace_options &= ~( R_RAYTRACE_USE_INSTANCES | R_RAYTRACE_USE_LOCAL_COORDS);