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
This commit is contained in:
2009-11-28 04:43:15 +00:00
parent aa3ed47848
commit 49b828f7fe
4 changed files with 34 additions and 15 deletions

View File

@@ -1136,6 +1136,9 @@ class USERPREF_PT_input(bpy.types.Panel):
sub.label(text="Zoom Style:")
sub.row().prop(inputs, "viewport_zoom_style", expand=True)
if inputs.viewport_zoom_style == 'DOLLY':
sub.row().prop(inputs, "zoom_axis", expand=True)
sub.prop(inputs, "invert_zoom_direction")
#sub.prop(inputs, "use_middle_mouse_paste")
@@ -1143,7 +1146,6 @@ class USERPREF_PT_input(bpy.types.Panel):
#sub = col.column()
#sub.label(text="Mouse Wheel:")
#sub.prop(view, "wheel_invert_zoom", text="Invert Zoom")
#sub.prop(view, "wheel_scroll_lines", text="Scroll Lines")
col.separator()

View File

@@ -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;
}

View File

@@ -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 */

View File

@@ -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");