[Bf-blender-cvs] [9b6a30d2cb7] blender2.8: Fix T55226: outliner glitch with item open/close, after recent optimization.

Brecht Van Lommel noreply at git.blender.org
Mon May 28 17:10:35 CEST 2018


Commit: 9b6a30d2cb781176f0c5811ee96345657b0797ac
Author: Brecht Van Lommel
Date:   Mon May 28 17:07:52 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB9b6a30d2cb781176f0c5811ee96345657b0797ac

Fix T55226: outliner glitch with item open/close, after recent optimization.

===================================================================

M	source/blender/blenkernel/BKE_outliner_treehash.h
M	source/blender/blenkernel/intern/outliner_treehash.c
M	source/blender/editors/space_outliner/outliner_intern.h
M	source/blender/editors/space_outliner/outliner_tree.c

===================================================================

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 */



More information about the Bf-blender-cvs mailing list