Release todo: added userpref for Mac users having "Natural Scroll" set.

As per discussion and analysis of all trackpad usage, we now
follow this convention:

- Blender follows system setting for trackpad direction preference.

- If you set your system to "natural" scroll, we need to invert a couple
  of cases in Blender we do "natural" already. Like:

   - view rotate (the inversed option just never feels ok)
   - scroll active items in list or pulldown menu (up/down is absolute)
   - ALT+scroll values in buttons (up/down is absolute)

The new User Preference setting "Trackpad Natural" handles this.

For 2.66 we only have trackpad handling for OS X... so this isn't
affecting trackpad usage in Windows and Linux, which stick to be mapped
to Scroll Wheel still.

(Note: viewrotate now is "natural" always, changing how it worked in the
past weeks).
This commit is contained in:
Ton Roosendaal 2013-02-08 12:12:57 +00:00
parent 08326778c5
commit 1dfb6404b7
6 changed files with 28 additions and 6 deletions

@ -1,3 +1,3 @@
These matcap images are licensed as GNU GPL 2 or later, like the rest of Blender's code.
Thanks to Kent Trammell, Aidy Burrows, John Herreno , Terry Wallwork for making the pictures.
Thanks to Kent Trammell, Aidy Burrows, John Herreno , Terry Wallwork and David Silverman for making the pictures.

@ -963,6 +963,8 @@ class USERPREF_PT_input(Panel, InputKeyMapPanel):
return (userpref.active_section == 'INPUT')
def draw_input_prefs(self, inputs, layout):
import sys
# General settings
row = layout.row()
col = row.column()
@ -1015,6 +1017,11 @@ class USERPREF_PT_input(Panel, InputKeyMapPanel):
sub.prop(inputs, "invert_zoom_wheel", text="Invert Wheel Zoom Direction")
#sub.prop(view, "wheel_scroll_lines", text="Scroll Lines")
if sys.platform == "darwin":
sub = col.column()
sub.label(text="Trackpad:")
sub.prop(inputs, "use_trackpad_natural")
col.separator()
sub = col.column()
sub.label(text="NDOF Device:")

@ -237,8 +237,14 @@ void ui_pan_to_scroll(const wmEvent *event, int *type, int *val)
lastdy += dy;
if (ABS(lastdy) > (int)UI_UNIT_Y) {
int dy = event->prevy - event->y;
if (U.uiflag2 & USER_TRACKPAD_NATURAL)
dy = -dy;
*val = KM_PRESS;
if (event->prevy - event->y > 0)
if (dy > 0)
*type = WHEELUPMOUSE;
else
*type = WHEELDOWNMOUSE;

@ -921,8 +921,12 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
if (event->type == MOUSEPAN) {
/* invert it, trackpad scroll then follows how you mapped it globally */
viewrotate_apply(vod, 2 * event->x - event->prevx, 2 * event->y - event->prevy);
/* Rotate direction we keep always same */
if (U.uiflag2 & USER_TRACKPAD_NATURAL)
viewrotate_apply(vod, 2 * event->x - event->prevx, 2 * event->y - event->prevy);
else
viewrotate_apply(vod, event->prevx, event->prevy);
ED_view3d_depth_tag_update(rv3d);
viewops_data_free(C, op);

@ -568,7 +568,8 @@ typedef enum eUserpref_UI_Flag {
/* uiflag2 */
typedef enum eUserpref_UI_Flag2 {
USER_KEEP_SESSION = (1 << 0),
USER_REGION_OVERLAP = (1 << 1)
USER_REGION_OVERLAP = (1 << 1),
USER_TRACKPAD_NATURAL = (1 << 2)
} eUserpref_UI_Flag2;
/* Auto-Keying mode */

@ -3549,7 +3549,6 @@ static void rna_def_userdef_system(BlenderRNA *brna)
"Draw tool/property regions over the main region, when using Triple Buffer");
RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
#ifdef WITH_CYCLES
prop = RNA_def_property(srna, "compute_device_type", PROP_ENUM, PROP_NONE);
RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
@ -3755,6 +3754,11 @@ static void rna_def_userdef_input(BlenderRNA *brna)
RNA_def_property_range(prop, 0, 32);
RNA_def_property_ui_text(prop, "Wheel Scroll Lines", "Number of lines scrolled at a time with the mouse wheel");
prop = RNA_def_property(srna, "use_trackpad_natural", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uiflag2", USER_TRACKPAD_NATURAL);
RNA_def_property_ui_text(prop, "Trackpad Natural",
"If your system uses 'natural' scrolling, this option keeps consistent trackpad usage throughout the UI");
prop = RNA_def_property(srna, "active_keyconfig", PROP_STRING, PROP_DIRPATH);
RNA_def_property_string_sdna(prop, NULL, "keyconfigstr");
RNA_def_property_ui_text(prop, "Key Config", "The name of the active key configuration");