diff options
author | Matt Ebb <matt@mke3.net> | 2009-11-28 07:43:15 +0300 |
---|---|---|
committer | Matt Ebb <matt@mke3.net> | 2009-11-28 07:43:15 +0300 |
commit | 49b828f7fe484886d050e7884b69cab08db448b6 (patch) | |
tree | 2449aca0e269dd4cf4d40a0b8da96eb517b508b0 /source/blender | |
parent | aa3ed478483e02101d7ee04d9118f5ecca066a8e (diff) |
A few new mouse navigation config options to help transitioning users
* Dolly zoom Vertical/Horizontal switch
Changes between using vertical or horizontal mouse movement for zooming
* Invert Zoom Direction
Inverts the vertical or horizontal mouse movement for dolly zoom
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 15 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 4 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 26 |
3 files changed, 31 insertions, 14 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 22dd7c6da87..2444c461bd0 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -851,8 +851,19 @@ static void viewzoom_apply(ViewOpsData *vod, int x, int y) zfac = vod->dist0 * ((float)len2/len1) / vod->rv3d->dist; } else { /* USER_ZOOM_DOLLY */ - float len1 = (vod->ar->winrct.ymax - y) + 5; - float len2 = (vod->ar->winrct.ymax - vod->origy) + 5; + float len1, len2; + + if (U.uiflag & USER_ZOOM_DOLLY_HORIZ) { + len1 = (vod->ar->winrct.xmax - x) + 5; + len2 = (vod->ar->winrct.xmax - vod->origx) + 5; + } + else { + len1 = (vod->ar->winrct.ymax - y) + 5; + len2 = (vod->ar->winrct.ymax - vod->origy) + 5; + } + if (U.uiflag & USER_ZOOM_INVERT) + SWAP(float, len1, len2); + zfac = vod->dist0 * (2.0*((len2/len1)-1.0) + 1.0) / vod->rv3d->dist; } diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index b70d3786eae..6e610b1c32d 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -414,7 +414,9 @@ extern UserDef U; /* from blenkernel blender.c */ #define USER_SHOW_FPS (1 << 21) #define USER_MMB_PASTE (1 << 22) #define USER_MENUFIXEDORDER (1 << 23) -#define USER_CONTINUOUS_MOUSE (1 << 24) +#define USER_CONTINUOUS_MOUSE (1 << 24) +#define USER_ZOOM_INVERT (1 << 25) +#define USER_ZOOM_DOLLY_HORIZ (1 << 26) /* Auto-Keying mode */ /* AUTOKEY_ON is a bitflag */ diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 1d4e422c7d5..d46f78a7c60 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -2268,26 +2268,21 @@ static void rna_def_userdef_input(BlenderRNA *brna) {USER_TRACKBALL, "TRACKBALL", 0, "Trackball", "Use trackball style rotation in the viewport."}, {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem middle_mouse_mouse_items[] = { - {0, "PAN", 0, "Pan", "Use the middle mouse button for panning the viewport."}, - {USER_VIEWMOVE, "ROTATE", 0, "Rotate", "Use the middle mouse button for rotation the viewport."}, - {0, NULL, 0, NULL, NULL}}; - static EnumPropertyItem view_zoom_styles[] = { {USER_ZOOM_CONT, "CONTINUE", 0, "Continue", "Old style zoom, continues while moving mouse up or down."}, {USER_ZOOM_DOLLY, "DOLLY", 0, "Dolly", "Zooms in and out based on vertical mouse movement."}, {USER_ZOOM_SCALE, "SCALE", 0, "Scale", "Zooms in and out like scaling the view, mouse movements relative to center."}, {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, NULL, 0, NULL, NULL}}; srna= RNA_def_struct(brna, "UserPreferencesInput", NULL); RNA_def_struct_sdna(srna, "UserDef"); RNA_def_struct_nested(brna, srna, "UserPreferences"); RNA_def_struct_ui_text(srna, "Input", "Settings for input devices."); - - prop= RNA_def_property(srna, "middle_mouse", PROP_ENUM, PROP_NONE); - RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); - RNA_def_property_enum_items(prop, middle_mouse_mouse_items); - RNA_def_property_ui_text(prop, "Middle Mouse", "Use the middle mouse button to pan or zoom the view."); prop= RNA_def_property(srna, "select_mouse", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); @@ -2299,6 +2294,15 @@ static void rna_def_userdef_input(BlenderRNA *brna) RNA_def_property_enum_items(prop, view_zoom_styles); RNA_def_property_ui_text(prop, "Viewport Zoom Style", "Which style to use for viewport scaling."); + prop= RNA_def_property(srna, "zoom_axis", PROP_ENUM, PROP_NONE); + RNA_def_property_enum_bitflag_sdna(prop, NULL, "uiflag"); + 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_zoom_direction", 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"); + prop= RNA_def_property(srna, "view_rotation", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag"); RNA_def_property_enum_items(prop, view_rotation_items); @@ -2306,7 +2310,7 @@ static void rna_def_userdef_input(BlenderRNA *brna) prop= RNA_def_property(srna, "continuous_mouse", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_CONTINUOUS_MOUSE); - RNA_def_property_ui_text(prop, "Continuous Grab", "Experimental option to allow moving the mouse outside the view"); + RNA_def_property_ui_text(prop, "Continuous Grab", "Allow moving the mouse outside the view on some manipulations (transform, ui control drag)."); prop= RNA_def_property(srna, "ndof_pan_speed", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "ndof_pan"); |