[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29660] trunk/blender/source/blender: Fix #22553: dragging number buttons would run update functions more often than

Nicholas Bishop nicholasbishop at gmail.com
Thu Jul 1 08:10:20 CEST 2010


Hi Brecht,

Something here seems to break tweak events. For example, clicking and
dragging in the file selector to do a box select, no longer works
after r29659. Noticed this because mesh hiding in my branch is set up
as a tweak event.

-Nicholas

On Wed, Jun 23, 2010 at 2:47 PM, Brecht Van Lommel <brecht at blender.org> wrote:
> Revision: 29660
>          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29660
> Author:   blendix
> Date:     2010-06-23 20:47:56 +0200 (Wed, 23 Jun 2010)
>
> Log Message:
> -----------
> Fix #22553: dragging number buttons would run update functions more often than
> necessary due to the more accurate mouse move events that are useful for
> sculpting and painting (at least on Linux/X11, not sure about other platforms).
> If the update function takes a while to run, this in turn causes more mouse
> move events to be accumulated, making things even slower, .. going into a spiral
> of slower and slower redraws.
>
> As a solution I've added a INBETWEEN_MOUSEMOVE event next to MOUSEMOVE. A
> MOUSEMOVE event is automatically changed to INBETWEEN_MOUSEMOVE when a
> MOUSEMOVE event is added after it. This new event type is only handled by
> painting/sculpting operators, everything else can happily ignore it.
>
> Modified Paths:
> --------------
>    trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
>    trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
>    trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
>    trunk/blender/source/blender/makesrna/intern/rna_wm.c
>    trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
>    trunk/blender/source/blender/windowmanager/wm_event_types.h
>
> Modified: trunk/blender/source/blender/editors/gpencil/gpencil_paint.c
> ===================================================================
> --- trunk/blender/source/blender/editors/gpencil/gpencil_paint.c        2010-06-23 18:28:34 UTC (rev 29659)
> +++ trunk/blender/source/blender/editors/gpencil/gpencil_paint.c        2010-06-23 18:47:56 UTC (rev 29660)
> @@ -1481,6 +1481,7 @@
>
>                /* moving mouse - assumed that mouse button is down if in painting status */
>                case MOUSEMOVE:
> +               case INBETWEEN_MOUSEMOVE:
>                        /* check if we're currently painting */
>                        if (p->status == GP_STATUS_PAINTING) {
>                                /* handle drawing event */
>
> Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
> ===================================================================
> --- trunk/blender/source/blender/editors/sculpt_paint/paint_image.c     2010-06-23 18:28:34 UTC (rev 29659)
> +++ trunk/blender/source/blender/editors/sculpt_paint/paint_image.c     2010-06-23 18:47:56 UTC (rev 29660)
> @@ -4872,6 +4872,7 @@
>                        paint_exit(C, op);
>                        return OPERATOR_FINISHED;
>                case MOUSEMOVE:
> +               case INBETWEEN_MOUSEMOVE:
>                        paint_apply_event(C, op, event);
>                        break;
>                case TIMER:
>
> Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c
> ===================================================================
> --- trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c    2010-06-23 18:28:34 UTC (rev 29659)
> +++ trunk/blender/source/blender/editors/sculpt_paint/paint_stroke.c    2010-06-23 18:47:56 UTC (rev 29660)
> @@ -275,7 +275,7 @@
>                MEM_freeN(stroke);
>                return OPERATOR_FINISHED;
>        }
> -       else if(first || event->type == MOUSEMOVE || (event->type == TIMER && (event->customdata == stroke->timer))) {
> +       else if(first || ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE) || (event->type == TIMER && (event->customdata == stroke->timer))) {
>                if(stroke->stroke_started) {
>                        if(paint_smooth_stroke(stroke, mouse, event)) {
>                                if(paint_space_stroke_enabled(stroke->brush)) {
>
> Modified: trunk/blender/source/blender/makesrna/intern/rna_wm.c
> ===================================================================
> --- trunk/blender/source/blender/makesrna/intern/rna_wm.c       2010-06-23 18:28:34 UTC (rev 29659)
> +++ trunk/blender/source/blender/makesrna/intern/rna_wm.c       2010-06-23 18:47:56 UTC (rev 29660)
> @@ -114,6 +114,7 @@
>        {SELECTMOUSE, "SELECTMOUSE", 0, "Select Mouse", ""},
>        {0, "", 0, NULL, NULL},
>        {MOUSEMOVE, "MOUSEMOVE", 0, "Mouse Move", ""},
> +       {INBETWEEN_MOUSEMOVE, "INBETWEEN_MOUSEMOVE", 0, "Inbetween Move", ""},
>        {MOUSEPAN, "TRACKPADPAN", 0, "Mouse/Trackpad Pan", ""},
>        {MOUSEZOOM, "TRACKPADZOOM", 0, "Mouse/Trackpad Zoom", ""},
>        {MOUSEROTATE, "MOUSEROTATE", 0, "Mouse/Trackpad Rotate", ""},
>
> Modified: trunk/blender/source/blender/windowmanager/intern/wm_event_system.c
> ===================================================================
> --- trunk/blender/source/blender/windowmanager/intern/wm_event_system.c 2010-06-23 18:28:34 UTC (rev 29659)
> +++ trunk/blender/source/blender/windowmanager/intern/wm_event_system.c 2010-06-23 18:47:56 UTC (rev 29660)
> @@ -1614,7 +1614,7 @@
>                while( (event= win->queue.first) ) {
>                        int action = WM_HANDLER_CONTINUE;
>
> -                       if((G.f & G_DEBUG) && event && event->type!=MOUSEMOVE)
> +                       if((G.f & G_DEBUG) && event && !ELEM(event->type, MOUSEMOVE, INBETWEEN_MOUSEMOVE))
>                                printf("pass on evt %d val %d\n", event->type, event->val);
>
>                        wm_eventemulation(event);
> @@ -2138,6 +2138,7 @@
>                case GHOST_kEventCursorMove: {
>                        if(win->active) {
>                                GHOST_TEventCursorData *cd= customdata;
> +                               wmEvent *lastevent= win->queue.last;
>
>  #if defined(__APPLE__) && defined(GHOST_COCOA)
>                                //Cocoa already uses coordinates with y=0 at bottom, and returns inwindow coordinates on mouse moved event
> @@ -2156,6 +2157,12 @@
>
>                                event.type= MOUSEMOVE;
>
> +                               /* some painting operators want accurate mouse events, they can
> +                                  handle inbetween mouse move moves, others can happily ignore
> +                                  them for better performance */
> +                               if(lastevent && lastevent->type == MOUSEMOVE)
> +                                       lastevent->type = INBETWEEN_MOUSEMOVE;
> +
>                                update_tablet_data(win, &event);
>                                wm_event_add(win, &event);
>
>
> Modified: trunk/blender/source/blender/windowmanager/wm_event_types.h
> ===================================================================
> --- trunk/blender/source/blender/windowmanager/wm_event_types.h 2010-06-23 18:28:34 UTC (rev 29659)
> +++ trunk/blender/source/blender/windowmanager/wm_event_types.h 2010-06-23 18:47:56 UTC (rev 29660)
> @@ -70,6 +70,7 @@
>                /* mapped with userdef */
>  #define WHEELINMOUSE   0x00c
>  #define WHEELOUTMOUSE  0x00d
> +#define INBETWEEN_MOUSEMOVE    0x011
>
>
>  /* SYSTEM : 0x01xx */
>
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs
>


More information about the Bf-committers mailing list