From 52eb61f84b564308762fdaafbd05b5193cf513c0 Mon Sep 17 00:00:00 2001 From: "Sv. Lockal" Date: Fri, 23 Aug 2013 20:35:00 +0000 Subject: Fix state losses for recursive outliner trees (e.g. datablocks editor) In previous optimization in outliner I assumed that order in treehash was not important. But testing outliner in datablocks mode revealed a problem: when user expands multiple recursive levels and then closes any element, it always closed the top level of recursion. Now it should work fine with recursive trees. Now treehash contains groups of elements indexed by (id,nr,type). Adding an element with the same (id,nr,type) results in appending it to existing group. No duplicates are possible in treehash. This commit should also make lookups a little bit faster, because searching in small arrays by "used" is faster than searching in hashtable with duplicates by "id,nr,type,used". --- source/blender/makesdna/DNA_space_types.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'source/blender/makesdna') diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 5c308083f3c..e8e5a01ca84 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -262,11 +262,8 @@ typedef struct SpaceOops { short flag, outlinevis, storeflag, search_flags; - /* search index for every element in treestore; - * It is ok for treehash to contain duplicates, because the semantics of its usage - * allows duplicates (see check_persistent) - */ - struct GHash *treehash; + /* pointers to treestore elements, grouped by (id, type, nr) in hashtable for faster searching */ + void *treehash; } SpaceOops; -- cgit v1.2.3