Cleanup: rename treehash -> outliner_treehash
authorCampbell Barton <ideasman42@gmail.com>
Tue, 7 Apr 2015 01:01:47 +0000 (11:01 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 7 Apr 2015 01:01:47 +0000 (11:01 +1000)
This is an API specifically for the outliner,
not some generic hierarchical hash structure.

source/blender/blenkernel/BKE_outliner_treehash.h [moved from source/blender/blenkernel/BKE_treehash.h with 66% similarity]
source/blender/blenkernel/CMakeLists.txt
source/blender/blenkernel/intern/outliner_treehash.c [moved from source/blender/blenkernel/intern/treehash.c with 81% similarity]
source/blender/blenloader/intern/readfile.c
source/blender/editors/space_outliner/outliner_tree.c
source/blender/editors/space_outliner/space_outliner.c

similarity index 66%
rename from source/blender/blenkernel/BKE_treehash.h
rename to source/blender/blenkernel/BKE_outliner_treehash.h
index 16ab02c09651019a9ba8dfec3e67c59b7309f670..454edb40c4e6a76eaa1f3580e9a1119b14b5cebc 100644 (file)
  *
  * ***** END GPL LICENSE BLOCK *****
  */
-#ifndef __BKE_TREEHASH_H__
-#define __BKE_TREEHASH_H__
+#ifndef __BKE_OUTLINER_TREEHASH_H__
+#define __BKE_OUTLINER_TREEHASH_H__
 
-/** \file BKE_treehash.h
+/** \file BKE_outliner_treehash.h
  *  \ingroup bke
  */
 
@@ -31,21 +31,21 @@ struct BLI_mempool;
 struct TreeStoreElem;
 
 /* create and fill hashtable with treestore elements */
-void *BKE_treehash_create_from_treestore(struct BLI_mempool *treestore);
+void *BKE_outliner_treehash_create_from_treestore(struct BLI_mempool *treestore);
 
 /* full rebuild for already allocated hashtable */
-void *BKE_treehash_rebuild_from_treestore(void *treehash, struct BLI_mempool *treestore);
+void *BKE_outliner_treehash_rebuild_from_treestore(void *treehash, struct BLI_mempool *treestore);
 
 /* full rebuild for already allocated hashtable */
-void BKE_treehash_add_element(void *treehash, struct TreeStoreElem *elem);
+void BKE_outliner_treehash_add_element(void *treehash, struct TreeStoreElem *elem);
 
 /* find first unused element with specific type, nr and id */
-struct TreeStoreElem *BKE_treehash_lookup_unused(void *treehash, short type, short nr, struct ID *id);
+struct TreeStoreElem *BKE_outliner_treehash_lookup_unused(void *treehash, short type, short nr, struct ID *id);
 
 /* find user or unused element with specific type, nr and id */
-struct TreeStoreElem *BKE_treehash_lookup_any(void *treehash, short type, short nr, struct ID *id);
+struct TreeStoreElem *BKE_outliner_treehash_lookup_any(void *treehash, short type, short nr, struct ID *id);
 
 /* free treehash structure */
-void BKE_treehash_free(void *treehash);
+void BKE_outliner_treehash_free(void *treehash);
 
 #endif
index f19c1066766ebd23b56db5f28d0be176b780d70a..67c8f0fc558b9be19973f0864f7b06947f098726 100644 (file)
@@ -135,6 +135,7 @@ set(SRC
        intern/object_deform.c
        intern/object_dupli.c
        intern/ocean.c
+       intern/outliner_treehash.c
        intern/packedFile.c
        intern/paint.c
        intern/particle.c
@@ -172,7 +173,6 @@ set(SRC
        intern/tracking_solver.c
        intern/tracking_stabilize.c
        intern/tracking_util.c
-       intern/treehash.c
        intern/unit.c
        intern/world.c
        intern/writeavi.c
@@ -211,6 +211,8 @@ set(SRC
        BKE_depsgraph.h
        BKE_displist.h
        BKE_dynamicpaint.h
+       BKE_editmesh.h
+       BKE_editmesh_bvh.h
        BKE_effect.h
        BKE_fcurve.h
        BKE_fluidsim.h
@@ -246,6 +248,7 @@ set(SRC
        BKE_object.h
        BKE_object_deform.h
        BKE_ocean.h
+       BKE_outliner_treehash.h
        BKE_packedFile.h
        BKE_paint.h
        BKE_particle.h
@@ -266,12 +269,9 @@ set(SRC
        BKE_speaker.h
        BKE_subsurf.h
        BKE_suggestions.h
-       BKE_editmesh.h
-       BKE_editmesh_bvh.h
        BKE_text.h
        BKE_texture.h
        BKE_tracking.h
-       BKE_treehash.h
        BKE_unit.h
        BKE_utildefines.h
        BKE_world.h
similarity index 81%
rename from source/blender/blenkernel/intern/treehash.c
rename to source/blender/blenkernel/intern/outliner_treehash.c
index 43eeae7329e30a6014ef75fdc3e142dda5ec8ffb..1cce61561e0d1ec973b92f872d26c608102b92bf 100644 (file)
@@ -20,7 +20,7 @@
  * ***** END GPL LICENSE BLOCK *****
  */
 
-/** \file treehash.c
+/** \file outliner_treehash.c
  *  \ingroup bke
  *
  * Tree hash for the outliner space.
@@ -28,7 +28,7 @@
 
 #include <stdlib.h>
 
-#include "BKE_treehash.h"
+#include "BKE_outliner_treehash.h"
 
 #include "BLI_utildefines.h"
 #include "BLI_ghash.h"
@@ -104,11 +104,11 @@ static void fill_treehash(void *treehash, BLI_mempool *treestore)
        BLI_mempool_iter iter;
        BLI_mempool_iternew(treestore, &iter);
        while ((tselem = BLI_mempool_iterstep(&iter))) {
-               BKE_treehash_add_element(treehash, tselem);
+               BKE_outliner_treehash_add_element(treehash, tselem);
        }
 }
 
-void *BKE_treehash_create_from_treestore(BLI_mempool *treestore)
+void *BKE_outliner_treehash_create_from_treestore(BLI_mempool *treestore)
 {
        GHash *treehash = BLI_ghash_new_ex(tse_hash, tse_cmp, "treehash", BLI_mempool_count(treestore));
        fill_treehash(treehash, treestore);
@@ -120,14 +120,14 @@ static void free_treehash_group(void *key)
        tse_group_free(key);
 }
 
-void *BKE_treehash_rebuild_from_treestore(void *treehash, BLI_mempool *treestore)
+void *BKE_outliner_treehash_rebuild_from_treestore(void *treehash, BLI_mempool *treestore)
 {
        BLI_ghash_clear_ex(treehash, NULL, free_treehash_group, BLI_mempool_count(treestore));
        fill_treehash(treehash, treestore);
        return treehash;
 }
 
-void BKE_treehash_add_element(void *treehash, TreeStoreElem *elem)
+void BKE_outliner_treehash_add_element(void *treehash, TreeStoreElem *elem)
 {
        TseGroup *group;
        void **val_p;
@@ -139,7 +139,7 @@ void BKE_treehash_add_element(void *treehash, TreeStoreElem *elem)
        tse_group_add(group, elem);
 }
 
-static TseGroup *BKE_treehash_lookup_group(GHash *th, short type, short nr, struct ID *id)
+static TseGroup *BKE_outliner_treehash_lookup_group(GHash *th, short type, short nr, struct ID *id)
 {
        TreeStoreElem tse_template;
        tse_template.type = type;
@@ -148,9 +148,9 @@ static TseGroup *BKE_treehash_lookup_group(GHash *th, short type, short nr, stru
        return BLI_ghash_lookup(th, &tse_template);
 }
 
-TreeStoreElem *BKE_treehash_lookup_unused(void *treehash, short type, short nr, struct ID *id)
+TreeStoreElem *BKE_outliner_treehash_lookup_unused(void *treehash, short type, short nr, struct ID *id)
 {
-       TseGroup *group = BKE_treehash_lookup_group(treehash, type, nr, id);
+       TseGroup *group = BKE_outliner_treehash_lookup_group(treehash, type, nr, id);
        if (group) {
                int i;
                for (i = 0; i < group->size; i++) {
@@ -162,13 +162,13 @@ TreeStoreElem *BKE_treehash_lookup_unused(void *treehash, short type, short nr,
        return NULL;
 }
 
-TreeStoreElem *BKE_treehash_lookup_any(void *treehash, short type, short nr, struct ID *id)
+TreeStoreElem *BKE_outliner_treehash_lookup_any(void *treehash, short type, short nr, struct ID *id)
 {
-       TseGroup *group = BKE_treehash_lookup_group(treehash, type, nr, id);
+       TseGroup *group = BKE_outliner_treehash_lookup_group(treehash, type, nr, id);
        return group ? group->elems[0] : NULL;
 }
 
-void BKE_treehash_free(void *treehash)
+void BKE_outliner_treehash_free(void *treehash)
 {
        BLI_ghash_free(treehash, NULL, free_treehash_group);
 }
index 4eb7413adc1e7359b40a251826833d2437264177..9a269cad7565aea193e27cf114e4cb88474110c7 100644 (file)
 #include "BKE_scene.h"
 #include "BKE_screen.h"
 #include "BKE_sequencer.h"
-#include "BKE_treehash.h"
+#include "BKE_outliner_treehash.h"
 #include "BKE_sound.h"
 
 
@@ -6041,7 +6041,7 @@ static void lib_link_screen(FileData *fd, Main *main)
                                                        }
                                                        if (so->treehash) {
                                                                /* rebuild hash table, because it depends on ids too */
-                                                               BKE_treehash_rebuild_from_treestore(so->treehash, so->treestore);
+                                                               BKE_outliner_treehash_rebuild_from_treestore(so->treehash, so->treestore);
                                                        }
                                                }
                                        }
@@ -6392,7 +6392,7 @@ void blo_lib_link_screen_restore(Main *newmain, bScreen *curscreen, Scene *cursc
                                                }
                                                if (so->treehash) {
                                                        /* rebuild hash table, because it depends on ids too */
-                                                       BKE_treehash_rebuild_from_treestore(so->treehash, so->treestore);
+                                                       BKE_outliner_treehash_rebuild_from_treestore(so->treehash, so->treestore);
                                                }
                                        }
                                }
index 9239d9cb27ea3473e02d8971227dc69075d12105..17a6e952ee1371e535b8bf5b570a1caa160ea058 100644 (file)
@@ -66,7 +66,7 @@
 #include "BKE_modifier.h"
 #include "BKE_sequencer.h"
 #include "BKE_idcode.h"
-#include "BKE_treehash.h"
+#include "BKE_outliner_treehash.h"
 
 #include "ED_armature.h"
 #include "ED_screen.h"
@@ -114,7 +114,7 @@ static void outliner_storage_cleanup(SpaceOops *soops)
                                        BLI_mempool_destroy(ts);
                                        soops->treestore = NULL;
                                        if (soops->treehash) {
-                                               BKE_treehash_free(soops->treehash);
+                                               BKE_outliner_treehash_free(soops->treehash);
                                                soops->treehash = NULL;
                                        }
                                }
@@ -133,7 +133,7 @@ static void outliner_storage_cleanup(SpaceOops *soops)
                                        soops->treestore = new_ts;
                                        if (soops->treehash) {
                                                /* update hash table to fix broken pointers */
-                                               BKE_treehash_rebuild_from_treestore(soops->treehash, soops->treestore);
+                                               BKE_outliner_treehash_rebuild_from_treestore(soops->treehash, soops->treestore);
                                        }
                                }
                        }
@@ -151,12 +151,12 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty
                
        }
        if (soops->treehash == NULL) {
-               soops->treehash = BKE_treehash_create_from_treestore(soops->treestore);
+               soops->treehash = BKE_outliner_treehash_create_from_treestore(soops->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 = BKE_treehash_lookup_unused(soops->treehash, type, nr, id);
+       tselem = BKE_outliner_treehash_lookup_unused(soops->treehash, type, nr, id);
        if (tselem) {
                te->store_elem = tselem;
                tselem->used = 1;
@@ -171,7 +171,7 @@ static void check_persistent(SpaceOops *soops, TreeElement *te, ID *id, short ty
        tselem->used = 0;
        tselem->flag = TSE_CLOSED;
        te->store_elem = tselem;
-       BKE_treehash_add_element(soops->treehash, tselem);
+       BKE_outliner_treehash_add_element(soops->treehash, tselem);
 }
 
 /* ********************************************************* */
@@ -216,7 +216,7 @@ TreeElement *outliner_find_tse(SpaceOops *soops, TreeStoreElem *tse)
        if (tse->id == NULL) return NULL;
        
        /* check if 'tse' is in treestore */
-       tselem = BKE_treehash_lookup_any(soops->treehash, tse->type, tse->nr, tse->id);
+       tselem = BKE_outliner_treehash_lookup_any(soops->treehash, tse->type, tse->nr, tse->id);
        if (tselem) 
                return outliner_find_tree_element(&soops->tree, tselem);
        
index e1aea8892b55e779002a10c2995d00c88878092d..7b1ec174a6b087084b375cc98556658c636bc823 100644 (file)
@@ -41,7 +41,7 @@
 #include "BKE_context.h"
 #include "BKE_screen.h"
 #include "BKE_scene.h"
-#include "BKE_treehash.h"
+#include "BKE_outliner_treehash.h"
 
 #include "ED_space_api.h"
 #include "ED_screen.h"
@@ -464,7 +464,7 @@ static void outliner_free(SpaceLink *sl)
                BLI_mempool_destroy(soutliner->treestore);
        }
        if (soutliner->treehash) {
-               BKE_treehash_free(soutliner->treehash);
+               BKE_outliner_treehash_free(soutliner->treehash);
        }
 }