Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSv. Lockal <lockalsash@gmail.com>2013-08-19 00:07:49 +0400
committerSv. Lockal <lockalsash@gmail.com>2013-08-19 00:07:49 +0400
commit49b0dbd3a30805d924ff4d5b219666cd8b1f7c67 (patch)
treefecfa9b6712f315ecb24dedea09039c93ffbd758 /source/blender/editors/space_outliner
parent6fe983ddf51ff60156d3be21ca5fb73f629867e9 (diff)
Add comments for outliner's treestore and treehash (no functional changes)
Diffstat (limited to 'source/blender/editors/space_outliner')
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 404821900df..2a6320b83b1 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -151,7 +151,8 @@ static void outliner_storage_cleanup(SpaceOops *soops)
}
/* This function hashes only by type, nr and id, while cmp function also compares 'used' flag;
- * This is done to skip full treehash rebuild in outliner_storage_cleanup */
+ * This is done to skip full treehash rebuild in outliner_storage_cleanup;
+ * In general hashing by type, nr and id should be enough to distribute elements in buckets uniformly */
static unsigned int tse_hash(const void *ptr)
{
const TreeStoreElem *tse = (const TreeStoreElem *)ptr;
@@ -194,6 +195,8 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty
}
if (soops->treehash == NULL) {
soops->treehash = BLI_ghash_new(tse_hash, tse_cmp, "treehash");
+
+ /* treehash elements are not required to be unique; see soops->treehash comment */
BLI_ghash_flag_set(soops->treehash, GHASH_FLAG_ALLOW_DUPES);
}
@@ -205,7 +208,8 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty
}
}
- /* check for unused tree elements is in treestore */
+ /* find any unused tree element in treestore and mark it as used
+ * (note that there may be multiple unused elements in case of linked objects) */
tselem = lookup_treehash(soops->treehash, type, nr, 0, id);
if (tselem) {
te->store_elem = tselem;