forked from bartvdbraak/blender
Outliner: postpone rebuilding the tree
On existing Blender could rebuild tree many times (on freeing each ID). Use a flag instead of immediately rebuilding.
This commit is contained in:
parent
f4bae1f6d6
commit
3141870c96
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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) */
|
||||
|
Loading…
Reference in New Issue
Block a user