From ac433977674d64cbb513ecdb01d8245a5950a027 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 15 May 2013 17:59:55 +0000 Subject: Fix action zones not drawing properly while sculpting, due to recent bugfix. Partial redraw doesn't work so well with these, now I've changed the action zones to just draw as part of regions instead of as a special overdraw done at the end, which fits better with partial redraw by avoiding any special exceptions. --- source/blender/editors/screen/area.c | 86 +++++++++++++++--------------------- 1 file changed, 35 insertions(+), 51 deletions(-) (limited to 'source/blender/editors/screen/area.c') diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 82ba0568823..9196fdc1980 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -149,25 +149,6 @@ void ED_area_do_refresh(bContext *C, ScrArea *sa) sa->do_refresh = FALSE; } -/* based on screen region draw tags, set draw tags in azones, and future region tabs etc */ -/* only exported for WM */ -void ED_area_overdraw_flush(ScrArea *sa, ARegion *ar) -{ - AZone *az; - - for (az = sa->actionzones.first; az; az = az->next) { - int xs, ys; - - xs = (az->x1 + az->x2) / 2; - ys = (az->y1 + az->y2) / 2; - - /* test if inside */ - if (BLI_rcti_isect_pt(&ar->winrct, xs, ys)) { - az->do_draw = TRUE; - } - } -} - /** * \brief Corner widgets use for dragging and splitting the view. */ @@ -347,49 +328,50 @@ static void region_draw_azone_tria(AZone *az) glDisable(GL_BLEND); } -/* only exported for WM */ -void ED_area_overdraw(bContext *C) +static void region_draw_azones(ScrArea *sa, ARegion *ar) { - wmWindow *win = CTX_wm_window(C); - bScreen *screen = CTX_wm_screen(C); - ScrArea *sa; - - /* Draw AZones, in screenspace */ - wmSubWindowSet(win, screen->mainwin); + AZone *az; + + if (!sa) + return; glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + + glPushMatrix(); + glTranslatef(-ar->winrct.xmin, -ar->winrct.ymin, 0.0f); - for (sa = screen->areabase.first; sa; sa = sa->next) { - AZone *az; - for (az = sa->actionzones.first; az; az = az->next) { - if (az->do_draw) { - if (az->type == AZONE_AREA) { - area_draw_azone(az->x1, az->y1, az->x2, az->y2); - } - else if (az->type == AZONE_REGION) { - - if (az->ar) { - /* only display tab or icons when the region is hidden */ - if (az->ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) { - if (G.debug_value == 3) - region_draw_azone_icon(az); - else if (G.debug_value == 2) - region_draw_azone_tria(az); - else if (G.debug_value == 1) - region_draw_azone_tab(az); - else - region_draw_azone_tab_plus(az); - } + for (az = sa->actionzones.first; az; az = az->next) { + /* test if action zone is over this region */ + rcti azrct; + BLI_rcti_init(&azrct, az->x1, az->x2, az->y1, az->y2); + + if (BLI_rcti_isect(&ar->drawrct, &azrct, NULL)) { + if (az->type == AZONE_AREA) { + area_draw_azone(az->x1, az->y1, az->x2, az->y2); + } + else if (az->type == AZONE_REGION) { + + if (az->ar) { + /* only display tab or icons when the region is hidden */ + if (az->ar->flag & (RGN_FLAG_HIDDEN | RGN_FLAG_TOO_SMALL)) { + if (G.debug_value == 3) + region_draw_azone_icon(az); + else if (G.debug_value == 2) + region_draw_azone_tria(az); + else if (G.debug_value == 1) + region_draw_azone_tab(az); + else + region_draw_azone_tab_plus(az); } } - - az->do_draw = FALSE; } } } + + glPopMatrix(); + glDisable(GL_BLEND); - } /* only exported for WM */ @@ -454,6 +436,8 @@ void ED_region_do_draw(bContext *C, ARegion *ar) ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_PIXEL); + region_draw_azones(sa, ar); + /* for debugging unneeded area redraws and partial redraw */ #if 0 glEnable(GL_BLEND); -- cgit v1.2.3