From 9b6a30d2cb781176f0c5811ee96345657b0797ac Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 28 May 2018 17:07:52 +0200 Subject: Fix T55226: outliner glitch with item open/close, after recent optimization. --- source/blender/blenkernel/BKE_outliner_treehash.h | 3 +++ source/blender/blenkernel/intern/outliner_treehash.c | 11 +++++++++++ source/blender/editors/space_outliner/outliner_intern.h | 1 - source/blender/editors/space_outliner/outliner_tree.c | 12 +++--------- 4 files changed, 17 insertions(+), 10 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_outliner_treehash.h b/source/blender/blenkernel/BKE_outliner_treehash.h index b82bc692402..8a14f8fb041 100644 --- a/source/blender/blenkernel/BKE_outliner_treehash.h +++ b/source/blender/blenkernel/BKE_outliner_treehash.h @@ -36,6 +36,9 @@ void *BKE_outliner_treehash_create_from_treestore(struct BLI_mempool *treestore) /* full rebuild for already allocated hashtable */ void *BKE_outliner_treehash_rebuild_from_treestore(void *treehash, struct BLI_mempool *treestore); +/* clear element usage flags */ +void BKE_outliner_treehash_clear_used(void *treehash); + /* Add/remove hashtable elements */ void BKE_outliner_treehash_add_element(void *treehash, struct TreeStoreElem *elem); void BKE_outliner_treehash_remove_element(void *treehash, struct TreeStoreElem *elem); diff --git a/source/blender/blenkernel/intern/outliner_treehash.c b/source/blender/blenkernel/intern/outliner_treehash.c index 8ec81da8f83..fb62645ef43 100644 --- a/source/blender/blenkernel/intern/outliner_treehash.c +++ b/source/blender/blenkernel/intern/outliner_treehash.c @@ -145,6 +145,16 @@ static void free_treehash_group(void *key) tse_group_free(key); } +void BKE_outliner_treehash_clear_used(void *treehash) +{ + GHashIterator gh_iter; + + GHASH_ITER(gh_iter, treehash) { + TseGroup *group = BLI_ghashIterator_getValue(&gh_iter); + group->lastused = 0; + } +} + void *BKE_outliner_treehash_rebuild_from_treestore(void *treehash, BLI_mempool *treestore) { BLI_assert(treehash); @@ -163,6 +173,7 @@ void BKE_outliner_treehash_add_element(void *treehash, TreeStoreElem *elem) *val_p = tse_group_create(); } group = *val_p; + group->lastused = 0; tse_group_add_element(group, elem); } diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 73494b890ed..7ca1bc9cc9b 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -191,7 +191,6 @@ typedef enum { void outliner_free_tree(ListBase *tree); void outliner_cleanup_tree(struct SpaceOops *soops); void outliner_free_tree_element(TreeElement *element, ListBase *parent_subtree); -void outliner_remove_treestore_element(struct SpaceOops *soops, TreeStoreElem *tselem); void outliner_build_tree( struct Main *mainvar, diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 45c19ed4ff7..d865896e524 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -153,6 +153,9 @@ static void outliner_storage_cleanup(SpaceOops *soops) } } } + else if (soops->treehash) { + BKE_outliner_treehash_clear_used(soops->treehash); + } } } @@ -1185,15 +1188,6 @@ static TreeElement *outliner_add_element(SpaceOops *soops, ListBase *lb, void *i return te; } -/** - * \note Really only removes \a tselem, not it's TreeElement instance or any children. - */ -void outliner_remove_treestore_element(SpaceOops *soops, TreeStoreElem *tselem) -{ - BKE_outliner_treehash_remove_element(soops->treehash, tselem); - BLI_mempool_free(soops->treestore, tselem); -} - /* ======================================================= */ /* Sequencer mode tree building */ -- cgit v1.2.3