[Bf-blender-cvs] [615c57e] alembic: Clear duplilist instances when reading from a dupli cache, to avoid generating a new dupli instance on every frame.
Lukas Tönne
noreply at git.blender.org
Wed Apr 1 20:32:11 CEST 2015
Commit: 615c57ec31a2484b75303a9926c25c09e1afa681
Author: Lukas Tönne
Date: Wed Apr 1 20:31:28 2015 +0200
Branches: alembic
https://developer.blender.org/rB615c57ec31a2484b75303a9926c25c09e1afa681
Clear duplilist instances when reading from a dupli cache, to avoid
generating a new dupli instance on every frame.
===================================================================
M source/blender/blenkernel/BKE_anim.h
M source/blender/blenkernel/intern/object_dupli.c
M source/blender/pointcache/alembic/abc_group.cpp
===================================================================
diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h
index 579152d..886f494 100644
--- a/source/blender/blenkernel/BKE_anim.h
+++ b/source/blender/blenkernel/BKE_anim.h
@@ -95,6 +95,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);
+void BKE_dupli_cache_clear_instances(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 ea71592..74ce841 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -1438,6 +1438,17 @@ void BKE_dupli_cache_clear(DupliCache *dupcache)
BLI_ghash_clear(dupcache->ghash, NULL, (GHashValFreeFP)dupli_object_data_free);
}
+void BKE_dupli_cache_clear_instances(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);
+}
+
static DupliObjectData *dupli_cache_add_object_data(DupliCache *dupcache, Object *ob)
{
DupliObjectData *data = MEM_callocN(sizeof(DupliObjectData), "dupli object data");
diff --git a/source/blender/pointcache/alembic/abc_group.cpp b/source/blender/pointcache/alembic/abc_group.cpp
index 98874c1..14fbc39 100644
--- a/source/blender/pointcache/alembic/abc_group.cpp
+++ b/source/blender/pointcache/alembic/abc_group.cpp
@@ -431,6 +431,8 @@ PTCReadSampleResult AbcDupliCacheReader::read_sample(float frame)
read_dupligroup_object(abc_top.getChild(i), frame);
}
+ BKE_dupli_cache_clear_instances(dupli_cache);
+
/* now generate dupli instances for the group */
read_dupligroup_group(abc_group, ss);
More information about the Bf-blender-cvs
mailing list