From b077de086e14291fe5f7cdf6d3564a8f1cfb9cb3 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Thu, 20 Aug 2020 20:17:00 +0200 Subject: Outliner: Avoid rebuilding tree on selection/active changes We can avoid the rather expensive outliner tree rebuilds and only redraw if nothing but the selection or active item changes. This should give a bit of speedup for heavy scenes. For this to work I had to correct a few notifiers, some were only sending selection/active change notifiers that actually did things like adding objects. I also added a more precise notifier type for when the active collection changes. At the notifier subtype/action level we're not even close to running out of bits, so this should be fine. Also had to correct a wrong notifier check (was using `&` rather than `==`). --- source/blender/editors/space_outliner/outliner_edit.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'source/blender/editors/space_outliner/outliner_edit.c') diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index cd2fcd8e2cf..8567dd4da13 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -193,13 +193,7 @@ static int outliner_item_openclose_modal(bContext *C, wmOperator *op, const wmEv if (te->xs == data->x_location) { outliner_item_openclose(te, data->open, false); - /* Avoid rebuild if possible. */ - if (outliner_element_needs_rebuild_on_open_change(TREESTORE(te))) { - ED_region_tag_redraw(region); - } - else { - ED_region_tag_redraw_no_rebuild(region); - } + outliner_tag_redraw_avoid_rebuild_on_open_change(space_outliner, region); } } @@ -239,13 +233,7 @@ static int outliner_item_openclose_invoke(bContext *C, wmOperator *op, const wmE (toggle_all && (outliner_flag_is_any_test(&te->subtree, TSE_CLOSED, 1))); outliner_item_openclose(te, open, toggle_all); - /* Avoid rebuild if possible. */ - if (outliner_element_needs_rebuild_on_open_change(TREESTORE(te))) { - ED_region_tag_redraw(region); - } - else { - ED_region_tag_redraw_no_rebuild(region); - } + outliner_tag_redraw_avoid_rebuild_on_open_change(space_outliner, region); /* Only toggle once for single click toggling */ if (event->type == LEFTMOUSE) { -- cgit v1.2.3