diff options
Diffstat (limited to 'source/blender')
4 files changed, 13 insertions, 4 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 4efb61a7efc..a4dd2264816 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -6051,7 +6051,7 @@ static void lib_link_screen(FileData *fd, Main *main) } if (so->treehash) { /* rebuild hash table, because it depends on ids too */ - BKE_outliner_treehash_rebuild_from_treestore(so->treehash, so->treestore); + so->storeflag |= SO_TREESTORE_REBUILD; } } } @@ -6405,7 +6405,7 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc } if (so->treehash) { /* rebuild hash table, because it depends on ids too */ - BKE_outliner_treehash_rebuild_from_treestore(so->treehash, so->treestore); + so->storeflag |= SO_TREESTORE_REBUILD; } } } diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 058b8c4de5a..523584e2f2d 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -1984,7 +1984,8 @@ void ED_outliner_id_unref(SpaceOops *so, const ID *id) } if (so->treehash && changed) { /* rebuild hash table, because it depends on ids too */ - BKE_outliner_treehash_rebuild_from_treestore(so->treehash, so->treestore); + /* postpone a full rebuild because this can be called many times on-free */ + so->storeflag |= SO_TREESTORE_REBUILD; } } } diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index ad37d723d1b..728a7501d5b 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -1580,6 +1580,11 @@ void outliner_build_tree(Main *mainvar, Scene *scene, SpaceOops *soops) else soops->search_flags &= ~SO_SEARCH_RECURSIVE; + if (soops->storeflag & SO_TREESTORE_REBUILD) { + soops->storeflag &= ~SO_TREESTORE_REBUILD; + BKE_outliner_treehash_rebuild_from_treestore(soops->treehash, soops->treestore); + } + if (soops->tree.first && (soops->storeflag & SO_TREESTORE_REDRAW)) return; diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index d6785da7486..9c023628164 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -290,10 +290,13 @@ typedef enum eSpaceOutliner_Mode { /* SpaceOops->storeflag */ typedef enum eSpaceOutliner_StoreFlag { - /* rebuild tree */ + /* cleanup tree */ SO_TREESTORE_CLEANUP = (1 << 0), /* if set, it allows redraws. gets set for some allqueue events */ SO_TREESTORE_REDRAW = (1 << 1), + /* rebuild the tree, similar to cleanup, + * but defer a call to BKE_outliner_treehash_rebuild_from_treestore instead */ + SO_TREESTORE_REBUILD = (1 << 2), } eSpaceOutliner_StoreFlag; /* outliner search flags (SpaceOops->search_flags) */ |