Fix outliner crashes when dragging elements in some cases.

Avoid rebuilding outliner tree in more cases, also helps performance.
This commit is contained in:
2018-05-22 14:41:49 +02:00
parent d97471ddf7
commit cc9513d944
7 changed files with 26 additions and 22 deletions

View File

@@ -127,6 +127,7 @@ void ED_screen_global_areas_create(
void ED_area_do_listen(struct bScreen *sc, ScrArea *sa, struct wmNotifier *note, Scene *scene,
struct WorkSpace *workspace);
void ED_area_tag_redraw(ScrArea *sa);
void ED_area_tag_redraw_no_rebuild(ScrArea *sa);
void ED_area_tag_redraw_regiontype(ScrArea *sa, int type);
void ED_area_tag_refresh(ScrArea *sa);
void ED_area_do_refresh(struct bContext *C, ScrArea *sa);

View File

@@ -819,7 +819,7 @@ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
}
/* region possibly changed, so refresh */
ED_region_tag_redraw(ar);
ED_region_tag_redraw_no_rebuild(ar);
}
}
}
@@ -845,7 +845,7 @@ void UI_view2d_sync(bScreen *screen, ScrArea *area, View2D *v2dcur, int flag)
}
/* region possibly changed, so refresh */
ED_region_tag_redraw(ar);
ED_region_tag_redraw_no_rebuild(ar);
}
}
}

View File

@@ -169,14 +169,8 @@ static void view_pan_apply_ex(bContext *C, v2dViewPanData *vpd, float dx, float
/* validate that view is in valid configuration after this operation */
UI_view2d_curRect_validate(v2d);
/* exceptions */
if (vpd->sa->spacetype == SPACE_OUTLINER) {
/* don't rebuild full tree, since we're just changing our view */
ED_region_tag_redraw_no_rebuild(vpd->ar);
}
else {
ED_region_tag_redraw(vpd->ar);
}
/* don't rebuild full tree in outliner, since we're just changing our view */
ED_region_tag_redraw_no_rebuild(vpd->ar);
/* request updates to be done... */
WM_event_add_mousemove(C);
@@ -734,7 +728,7 @@ static void view_zoomstep_apply_ex(
}
/* request updates to be done... */
ED_region_tag_redraw(vzd->ar);
ED_region_tag_redraw_no_rebuild(vzd->ar);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
}
@@ -978,7 +972,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
}
/* request updates to be done... */
ED_region_tag_redraw(vzd->ar);
ED_region_tag_redraw_no_rebuild(vzd->ar);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
}
@@ -1493,7 +1487,7 @@ void UI_view2d_smooth_view(
v2d->cur = sms.new_cur;
UI_view2d_curRect_validate(v2d);
ED_region_tag_redraw(ar);
ED_region_tag_redraw_no_rebuild(ar);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
}
}
@@ -1537,7 +1531,7 @@ static int view2d_smoothview_invoke(bContext *C, wmOperator *UNUSED(op), const w
UI_view2d_curRect_validate(v2d);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
ED_region_tag_redraw(ar);
ED_region_tag_redraw_no_rebuild(ar);
if (v2d->sms == NULL) {
UI_view2d_zoom_cache_reset();
@@ -1749,7 +1743,7 @@ static void scroller_activate_init(bContext *C, wmOperator *op, const wmEvent *e
}
UI_view2d_scrollers_free(scrollers);
ED_region_tag_redraw(ar);
ED_region_tag_redraw_no_rebuild(ar);
}
/* cleanup temp customdata */
@@ -1763,7 +1757,7 @@ static void scroller_activate_exit(bContext *C, wmOperator *op)
MEM_freeN(op->customdata);
op->customdata = NULL;
ED_region_tag_redraw(CTX_wm_region(C));
ED_region_tag_redraw_no_rebuild(CTX_wm_region(C));
}
}
@@ -1825,7 +1819,7 @@ static void scroller_activate_apply(bContext *C, wmOperator *op)
UI_view2d_curRect_validate(v2d);
/* request updates to be done... */
ED_region_tag_redraw(vsm->ar);
ED_region_tag_redraw_no_rebuild(vsm->ar);
UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY);
}

View File

@@ -225,7 +225,7 @@ void ED_area_azones_update(ScrArea *sa, const int mouse_xy[2])
if (changed) {
sa->flag &= ~AREA_FLAG_ACTIONZONES_UPDATE;
ED_area_tag_redraw(sa);
ED_area_tag_redraw_no_rebuild(sa);
}
}
@@ -607,6 +607,15 @@ void ED_area_tag_redraw(ScrArea *sa)
ED_region_tag_redraw(ar);
}
void ED_area_tag_redraw_no_rebuild(ScrArea *sa)
{
ARegion *ar;
if (sa)
for (ar = sa->regionbase.first; ar; ar = ar->next)
ED_region_tag_redraw_no_rebuild(ar);
}
void ED_area_tag_redraw_regiontype(ScrArea *sa, int regiontype)
{
ARegion *ar;

View File

@@ -1041,7 +1041,7 @@ void ED_screen_set_active_region(bContext *C, wmWindow *win, const int xy[2])
if (do_draw) {
for (ar = area_iter->regionbase.first; ar; ar = ar->next) {
if (ar->regiontype == RGN_TYPE_HEADER) {
ED_region_tag_redraw(ar);
ED_region_tag_redraw_no_rebuild(ar);
}
}
}

View File

@@ -707,7 +707,7 @@ AZone *is_in_area_actionzone(ScrArea *sa, const int xy[2])
}
/* XXX force redraw to show/hide the action zone */
ED_area_tag_redraw(sa);
ED_area_tag_redraw_no_rebuild(sa);
break;
}
else if (az->type == AZONE_REGION_SCROLL) {
@@ -759,7 +759,7 @@ AZone *is_in_area_actionzone(ScrArea *sa, const int xy[2])
}
if (redraw) {
ED_area_tag_redraw(sa);
ED_area_tag_redraw_no_rebuild(sa);
}
/* Don't return! */
}

View File

@@ -1057,7 +1057,7 @@ static int outliner_scroll_page_exec(bContext *C, wmOperator *op)
ar->v2d.cur.ymin += dy;
ar->v2d.cur.ymax += dy;
ED_region_tag_redraw(ar);
ED_region_tag_redraw_no_rebuild(ar);
return OPERATOR_FINISHED;
}