forked from bartvdbraak/blender
Bugfix #26270
Transform started with button in Toolbar was drawing the helper line badly. This needed two fixes: - helper line now has poll() callback to check for correct region - event system needs to set 'subwinactive' for modal handlers too The latter might fix issues with cursor/overlay drawing in other cases?
This commit is contained in:
parent
9d5c6bbe3d
commit
882514d28f
@ -1243,6 +1243,15 @@ static void drawArc(float size, float angle_start, float angle_end, int segments
|
||||
glEnd();
|
||||
}
|
||||
|
||||
static int helpline_poll(bContext *C)
|
||||
{
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
|
||||
if(ar && ar->regiontype==RGN_TYPE_WINDOW)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void drawHelpline(bContext *UNUSED(C), int x, int y, void *customdata)
|
||||
{
|
||||
TransInfo *t = (TransInfo*)customdata;
|
||||
@ -1557,7 +1566,7 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
|
||||
t->draw_handle_apply = ED_region_draw_cb_activate(t->ar->type, drawTransformApply, t, REGION_DRAW_PRE_VIEW);
|
||||
t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
|
||||
//t->draw_handle_pixel = ED_region_draw_cb_activate(t->ar->type, drawTransformPixel, t, REGION_DRAW_POST_PIXEL);
|
||||
t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), NULL, drawHelpline, t);
|
||||
t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t);
|
||||
}
|
||||
else if(t->spacetype == SPACE_IMAGE) {
|
||||
unit_m3(t->spacemtx);
|
||||
|
@ -1622,6 +1622,7 @@ static void wm_paintcursor_test(bContext *C, wmEvent *event)
|
||||
|
||||
if(wm->paintcursors.first) {
|
||||
ARegion *ar= CTX_wm_region(C);
|
||||
|
||||
if(ar)
|
||||
wm_paintcursor_tag(C, wm->paintcursors.first, ar);
|
||||
|
||||
@ -1734,6 +1735,14 @@ void wm_event_do_handlers(bContext *C)
|
||||
CTX_wm_area_set(C, area_event_inside(C, event->x, event->y));
|
||||
CTX_wm_region_set(C, region_event_inside(C, event->x, event->y));
|
||||
|
||||
/* XXX to solve, here screen handlers? */
|
||||
if(event->type==MOUSEMOVE) {
|
||||
/* state variables in screen, cursors, also used in wm_draw.c */
|
||||
ED_screen_set_subwinactive(win, event);
|
||||
/* for regions having custom cursors */
|
||||
wm_paintcursor_test(C, event);
|
||||
}
|
||||
|
||||
/* MVC demands to not draw in event handlers... but we need to leave it for ogl selecting etc */
|
||||
wm_window_make_drawable(C, win);
|
||||
|
||||
@ -1754,15 +1763,7 @@ void wm_event_do_handlers(bContext *C)
|
||||
ScrArea *sa;
|
||||
ARegion *ar;
|
||||
int doit= 0;
|
||||
|
||||
/* XXX to solve, here screen handlers? */
|
||||
if(event->type==MOUSEMOVE) {
|
||||
/* state variables in screen, cursors */
|
||||
ED_screen_set_subwinactive(win, event);
|
||||
/* for regions having custom cursors */
|
||||
wm_paintcursor_test(C, event);
|
||||
}
|
||||
|
||||
|
||||
for(sa= win->screen->areabase.first; sa; sa= sa->next) {
|
||||
if(wm_event_inside_i(event, &sa->totrct)) {
|
||||
CTX_wm_area_set(C, sa);
|
||||
|
Loading…
Reference in New Issue
Block a user