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:
authorCampbell Barton <ideasman42@gmail.com>2012-05-27 18:43:18 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-05-27 18:43:18 +0400
commitd4b6927179e3a6ac5d4d3efa4b0bb8b785dd1822 (patch)
tree4bb87a533d50e83a9012a4ddee44b8b64dd1cc92 /source/blender/editors/space_outliner/outliner_tree.c
parent8c51ecaf9051f4b64d60eaa13371a308846d4941 (diff)
remove NULL check in TREESTORE macro, the return NULL value wasny checked for by any callers (ie - it would crash later if the arg was NULL anyway)
also comment on the speed of check_persistent()
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_tree.c')
-rw-r--r--source/blender/editors/space_outliner/outliner_tree.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c
index 8a31305d65e..097823135f3 100644
--- a/source/blender/editors/space_outliner/outliner_tree.c
+++ b/source/blender/editors/space_outliner/outliner_tree.c
@@ -132,6 +132,14 @@ static void outliner_storage_cleanup(SpaceOops *soops)
}
}
+/* XXX - THIS FUNCTION IS INCREDIBLY SLOW
+ * ... it can bring blenders tools and viewport to a grinding halt becuase of searching
+ * for duplicate items every times they are added.
+ *
+ * TODO (possible speedups)
+ * - use a hash for duplicate (could even store a hash per type)
+ * - use mempool for TreeElements
+ * */
static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short type, short nr)
{
TreeStore *ts;
@@ -147,8 +155,8 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty
/* check if 'te' is in treestore */
tselem = ts->data;
for (a = 0; a < ts->usedelem; a++, tselem++) {
- if (tselem->id == id && tselem->used == 0) {
- if ((type == 0 && tselem->type == 0) || (tselem->type == type && tselem->nr == nr)) {
+ if ((tselem->used == 0) && (tselem->type == type) && (tselem->id == id)) {
+ if ((type == 0) || (tselem->nr == nr)) {
te->store_index = a;
tselem->used = 1;
return;