Fix T50570: pressing pgup or pgdn in any scrollable area irreversably alters scrollin...
authorBastien Montagne <montagne29@wanadoo.fr>
Wed, 1 Feb 2017 11:52:26 +0000 (12:52 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Wed, 1 Feb 2017 11:52:26 +0000 (12:52 +0100)
'page' prop of scroll up/down operators would get stuck once set once by
pageup/down keys... Now only take this prop into account if explicitely
set, not when its value is inherited from previous run.

source/blender/editors/interface/view2d_ops.c

index d2b2f12c1a5057a6a31f7f2068ac5781fb8c50ed..fa2c1f25cfcd55d704139615d0a526a9d0c32d84 100644 (file)
@@ -447,7 +447,8 @@ static int view_scrolldown_exec(bContext *C, wmOperator *op)
        RNA_int_set(op->ptr, "deltax", 0);
        RNA_int_set(op->ptr, "deltay", -40);
        
-       if (RNA_boolean_get(op->ptr, "page")) {
+       PropertyRNA *prop = RNA_struct_find_property(op->ptr, "page");
+       if (RNA_property_is_set(op->ptr, prop) && RNA_property_boolean_get(op->ptr, prop)) {
                ARegion *ar = CTX_wm_region(C);
                RNA_int_set(op->ptr, "deltay", ar->v2d.mask.ymin - ar->v2d.mask.ymax);
        }
@@ -497,7 +498,8 @@ static int view_scrollup_exec(bContext *C, wmOperator *op)
        RNA_int_set(op->ptr, "deltax", 0);
        RNA_int_set(op->ptr, "deltay", 40);
        
-       if (RNA_boolean_get(op->ptr, "page")) {
+       PropertyRNA *prop = RNA_struct_find_property(op->ptr, "page");
+       if (RNA_property_is_set(op->ptr, prop) && RNA_property_boolean_get(op->ptr, prop)) {
                ARegion *ar = CTX_wm_region(C);
                RNA_int_set(op->ptr, "deltay", BLI_rcti_size_y(&ar->v2d.mask));
        }