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.
This commit is contained in:
Brecht Van Lommel 2013-05-15 17:59:55 +00:00
parent a4b5c05aad
commit ac43397767
3 changed files with 35 additions and 61 deletions

@ -74,8 +74,6 @@ void ED_region_visible_rect(struct ARegion *ar, struct rcti *rect);
void ED_spacetypes_keymap(struct wmKeyConfig *keyconf); void ED_spacetypes_keymap(struct wmKeyConfig *keyconf);
int ED_area_header_switchbutton(const struct bContext *C, struct uiBlock *block, int yco); int ED_area_header_switchbutton(const struct bContext *C, struct uiBlock *block, int yco);
int ED_area_header_standardbuttons(const struct bContext *C, struct uiBlock *block, int yco); int ED_area_header_standardbuttons(const struct bContext *C, struct uiBlock *block, int yco);
void ED_area_overdraw(struct bContext *C);
void ED_area_overdraw_flush(struct ScrArea *sa, struct ARegion *ar);
/* areas */ /* areas */

@ -149,25 +149,6 @@ void ED_area_do_refresh(bContext *C, ScrArea *sa)
sa->do_refresh = FALSE; 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. * \brief Corner widgets use for dragging and splitting the view.
*/ */
@ -347,23 +328,25 @@ static void region_draw_azone_tria(AZone *az)
glDisable(GL_BLEND); glDisable(GL_BLEND);
} }
/* only exported for WM */ static void region_draw_azones(ScrArea *sa, ARegion *ar)
void ED_area_overdraw(bContext *C)
{ {
wmWindow *win = CTX_wm_window(C); AZone *az;
bScreen *screen = CTX_wm_screen(C);
ScrArea *sa;
/* Draw AZones, in screenspace */ if (!sa)
wmSubWindowSet(win, screen->mainwin); return;
glEnable(GL_BLEND); glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
for (sa = screen->areabase.first; sa; sa = sa->next) { glPushMatrix();
AZone *az; glTranslatef(-ar->winrct.xmin, -ar->winrct.ymin, 0.0f);
for (az = sa->actionzones.first; az; az = az->next) { for (az = sa->actionzones.first; az; az = az->next) {
if (az->do_draw) { /* 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) { if (az->type == AZONE_AREA) {
area_draw_azone(az->x1, az->y1, az->x2, az->y2); area_draw_azone(az->x1, az->y1, az->x2, az->y2);
} }
@ -383,13 +366,12 @@ void ED_area_overdraw(bContext *C)
} }
} }
} }
}
}
glPopMatrix();
az->do_draw = FALSE;
}
}
}
glDisable(GL_BLEND); glDisable(GL_BLEND);
} }
/* only exported for WM */ /* 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); ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_PIXEL);
region_draw_azones(sa, ar);
/* for debugging unneeded area redraws and partial redraw */ /* for debugging unneeded area redraws and partial redraw */
#if 0 #if 0
glEnable(GL_BLEND); glEnable(GL_BLEND);

@ -167,7 +167,6 @@ static void wm_method_draw_full(bContext *C, wmWindow *win)
CTX_wm_region_set(C, ar); CTX_wm_region_set(C, ar);
ED_region_do_draw(C, ar); ED_region_do_draw(C, ar);
wm_paintcursor_draw(C, ar); wm_paintcursor_draw(C, ar);
ED_area_overdraw_flush(sa, ar);
CTX_wm_region_set(C, NULL); CTX_wm_region_set(C, NULL);
} }
} }
@ -177,7 +176,6 @@ static void wm_method_draw_full(bContext *C, wmWindow *win)
} }
ED_screen_draw(win); ED_screen_draw(win);
ED_area_overdraw(C);
/* draw overlapping regions */ /* draw overlapping regions */
for (ar = screen->regionbase.first; ar; ar = ar->next) { for (ar = screen->regionbase.first; ar; ar = ar->next) {
@ -282,7 +280,6 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
CTX_wm_region_set(C, ar); CTX_wm_region_set(C, ar);
ED_region_do_draw(C, ar); ED_region_do_draw(C, ar);
wm_paintcursor_draw(C, ar); wm_paintcursor_draw(C, ar);
ED_area_overdraw_flush(sa, ar);
CTX_wm_region_set(C, NULL); CTX_wm_region_set(C, NULL);
if (exchange) if (exchange)
@ -293,7 +290,6 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
CTX_wm_region_set(C, ar); CTX_wm_region_set(C, ar);
ED_region_do_draw(C, ar); ED_region_do_draw(C, ar);
wm_paintcursor_draw(C, ar); wm_paintcursor_draw(C, ar);
ED_area_overdraw_flush(sa, ar);
CTX_wm_region_set(C, NULL); CTX_wm_region_set(C, NULL);
ar->swap = WIN_BOTH_OK; ar->swap = WIN_BOTH_OK;
@ -328,8 +324,6 @@ static void wm_method_draw_overlap_all(bContext *C, wmWindow *win, int exchange)
screen->swap = WIN_BOTH_OK; screen->swap = WIN_BOTH_OK;
} }
ED_area_overdraw(C);
/* draw marked overlapping regions */ /* draw marked overlapping regions */
for (ar = screen->regionbase.first; ar; ar = ar->next) { for (ar = screen->regionbase.first; ar; ar = ar->next) {
if (ar->swinid && ar->do_draw) { if (ar->swinid && ar->do_draw) {
@ -621,7 +615,6 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
if (ar->overlap == 0) { if (ar->overlap == 0) {
CTX_wm_region_set(C, ar); CTX_wm_region_set(C, ar);
ED_region_do_draw(C, ar); ED_region_do_draw(C, ar);
ED_area_overdraw_flush(sa, ar);
CTX_wm_region_set(C, NULL); CTX_wm_region_set(C, NULL);
copytex = 1; copytex = 1;
} }
@ -634,7 +627,6 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
if (copytex) { if (copytex) {
wmSubWindowSet(win, screen->mainwin); wmSubWindowSet(win, screen->mainwin);
ED_area_overdraw(C);
wm_triple_copy_textures(win, triple); wm_triple_copy_textures(win, triple);
} }