[Bf-blender-cvs] [e0d9014] alembic: Made the duplicache clear function public.
Lukas Tönne
noreply at git.blender.org
Wed Apr 1 20:32:10 CEST 2015
Commit: e0d90141b072ca7eb4f341f7657d14580a954010
Author: Lukas Tönne
Date: Wed Apr 1 20:27:01 2015 +0200
Branches: alembic
https://developer.blender.org/rBe0d90141b072ca7eb4f341f7657d14580a954010
Made the duplicache clear function public.
It's a common operation that may be useful later, no reason to keep this
hidden.
===================================================================
M source/blender/blenkernel/BKE_anim.h
M source/blender/blenkernel/intern/object_dupli.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h
index b5c8bc6..579152d 100644
--- a/source/blender/blenkernel/BKE_anim.h
+++ b/source/blender/blenkernel/BKE_anim.h
@@ -94,6 +94,7 @@ void BKE_dupli_object_data_add_strands(struct DupliObjectData *data, struct Stra
struct DupliCache *BKE_dupli_cache_new(void);
void BKE_dupli_cache_free(struct DupliCache *dupcache);
+void BKE_dupli_cache_clear(struct DupliCache *dupcache);
struct DupliObjectData *BKE_dupli_cache_add_object(struct DupliCache *dupcache, struct Object *ob);
void BKE_dupli_cache_add_instance(struct DupliCache *dupcache, float obmat[4][4], struct DupliObjectData *data);
void BKE_dupli_cache_from_group(struct Scene *scene, struct Group *group, struct CacheLibrary *cachelib, struct DupliCache *dupcache, struct EvaluationContext *eval_ctx);
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index 6153800..ea71592 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -1408,19 +1408,6 @@ static void dupli_object_free(DupliObject *dob)
MEM_freeN(dob);
}
-static void dupli_cache_clear(DupliCache *dupcache)
-{
- DupliObject *dob, *dob_next;
- for (dob = dupcache->duplilist.first; dob; dob = dob_next) {
- dob_next = dob->next;
-
- dupli_object_free(dob);
- }
- BLI_listbase_clear(&dupcache->duplilist);
-
- BLI_ghash_clear(dupcache->ghash, NULL, (GHashValFreeFP)dupli_object_data_free);
-}
-
DupliCache *BKE_dupli_cache_new(void)
{
DupliCache *dupcache = MEM_callocN(sizeof(DupliCache), "dupli object cache");
@@ -1432,12 +1419,25 @@ DupliCache *BKE_dupli_cache_new(void)
void BKE_dupli_cache_free(DupliCache *dupcache)
{
- dupli_cache_clear(dupcache);
+ BKE_dupli_cache_clear(dupcache);
BLI_ghash_free(dupcache->ghash, NULL, (GHashValFreeFP)dupli_object_data_free);
MEM_freeN(dupcache);
}
+void BKE_dupli_cache_clear(DupliCache *dupcache)
+{
+ DupliObject *dob, *dob_next;
+ for (dob = dupcache->duplilist.first; dob; dob = dob_next) {
+ dob_next = dob->next;
+
+ dupli_object_free(dob);
+ }
+ BLI_listbase_clear(&dupcache->duplilist);
+
+ BLI_ghash_clear(dupcache->ghash, NULL, (GHashValFreeFP)dupli_object_data_free);
+}
+
static DupliObjectData *dupli_cache_add_object_data(DupliCache *dupcache, Object *ob)
{
DupliObjectData *data = MEM_callocN(sizeof(DupliObjectData), "dupli object data");
@@ -1471,7 +1471,7 @@ void BKE_dupli_cache_from_group(Scene *scene, Group *group, CacheLibrary *cachel
{
DupliObject *dob;
- dupli_cache_clear(dupcache);
+ BKE_dupli_cache_clear(dupcache);
if (!(group && cachelib))
return;
@@ -1561,7 +1561,7 @@ void BKE_object_dupli_cache_update(Scene *scene, Object *ob, EvaluationContext *
printf("Update dupli cache for object '%s'\n", ob->id.name+2);
if (ob->dup_cache) {
- dupli_cache_clear(ob->dup_cache);
+ BKE_dupli_cache_clear(ob->dup_cache);
}
else {
ob->dup_cache = BKE_dupli_cache_new();
@@ -1589,7 +1589,7 @@ void BKE_object_dupli_cache_update(Scene *scene, Object *ob, EvaluationContext *
void BKE_object_dupli_cache_clear(Object *ob)
{
if (ob->dup_cache) {
- dupli_cache_clear(ob->dup_cache);
+ BKE_dupli_cache_clear(ob->dup_cache);
}
}
More information about the Bf-blender-cvs
mailing list