Fix #29432: Marquee Select Bug
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 7 Dec 2011 09:55:37 +0000 (09:55 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 7 Dec 2011 09:55:37 +0000 (09:55 +0000)
Moved tweak threshold value to user preferences

This threshold might be needed to be tweaked when working with tables, i.e.
to prevent tap+slight movement be treated as tweak event.

release/scripts/startup/bl_ui/space_userpref.py
source/blender/editors/interface/resources.c
source/blender/makesdna/DNA_userdef_types.h
source/blender/makesrna/intern/rna_userdef.c
source/blender/windowmanager/intern/wm_gesture.c

index d71d57509c14b12360237360b17d19f2e16c8977..df8c085d77efe87da966271ce593073c986b29ad 100644 (file)
@@ -889,6 +889,8 @@ class USERPREF_PT_input(Panel, InputKeyMapPanel):
         sub.label(text="NDOF Device:")
         sub.prop(inputs, "ndof_sensitivity", text="NDOF Sensitivity")
 
+        col.prop(inputs, "tweak_threshold")
+
         row.separator()
 
     def draw(self, context):
index dee945ecd7d1eb5813bcda9dca21ba713dc20c85..c3fe50edcd3d1d1eedda57eb5025c1f0ea013004 100644 (file)
@@ -1715,6 +1715,8 @@ void init_userdef_do_versions(void)
                U.ndof_flag = NDOF_LOCK_HORIZON |
                        NDOF_SHOULD_PAN | NDOF_SHOULD_ZOOM | NDOF_SHOULD_ROTATE;
        }
+       if (U.tweak_threshold == 0 )
+               U.tweak_threshold= 10;
 
        /* funny name, but it is GE stuff, moves userdef stuff to engine */
 // XXX space_set_commmandline_options();
index 4f6c7e22f5eeef496477e1d75de5784b6046ae17..851d4b562e6e586e73c41514ef25fa96bb5adc56 100644 (file)
@@ -408,7 +408,9 @@ typedef struct UserDef {
        struct ColorBand coba_weight;   /* from texture.h */
 
        float sculpt_paint_overlay_col[3];
-       int pad3;
+
+       short tweak_threshold;
+       short pad3;
 
        char author[80];        /* author name for file formats supporting it */
 } UserDef;
index 0ea6b902150e6bf6399f116c9674cdf635b94ff8..f9b20d3ac78d550ee98f909a6b64e35b7e825d50 100644 (file)
@@ -2929,6 +2929,11 @@ static void rna_def_userdef_input(BlenderRNA *brna)
        RNA_def_property_range(prop, 3, 40);
        RNA_def_property_ui_text(prop, "Drag Threshold", "Amount of pixels you have to drag before dragging UI items happens");
 
+       prop= RNA_def_property(srna, "tweak_threshold", PROP_INT, PROP_NONE);
+       RNA_def_property_int_sdna(prop, NULL, "tweak_threshold");
+       RNA_def_property_range(prop, 3, 1024);
+       RNA_def_property_ui_text(prop, "Tweak Threshold", "Number of pixels you have to drag before tweak event is triggered");
+
        /* 3D mouse settings */
        /* global options */
        prop= RNA_def_property(srna, "ndof_sensitivity", PROP_FLOAT, PROP_NONE);
index ef463989c64adc232f3885a80a9fdd24a90446a3..4fb8751de69253423452fdb55063748adec902e1 100644 (file)
@@ -124,14 +124,13 @@ void WM_gestures_remove(bContext *C)
 
 
 /* tweak and line gestures */
-#define TWEAK_THRESHOLD                10
 int wm_gesture_evaluate(wmGesture *gesture)
 {
        if(gesture->type==WM_GESTURE_TWEAK) {
                rcti *rect= gesture->customdata;
                int dx= rect->xmax - rect->xmin;
                int dy= rect->ymax - rect->ymin;
-               if(ABS(dx)+ABS(dy) > TWEAK_THRESHOLD) {
+               if(ABS(dx)+ABS(dy) > U.tweak_threshold) {
                        int theta= (int)floor(4.0f*atan2f((float)dy, (float)dx)/(float)M_PI + 0.5f);
                        int val= EVT_GESTURE_W;