[Bf-blender-cvs] [bda3e21] alembic: Revert recent commits, no time to improve things now.
Lukas Tönne
noreply at git.blender.org
Thu Apr 16 15:50:45 CEST 2015
Commit: bda3e21e95eee58be91a3b6c7b8fde6930ac8f2f
Author: Lukas Tönne
Date: Thu Apr 16 15:50:06 2015 +0200
Branches: alembic
https://developer.blender.org/rBbda3e21e95eee58be91a3b6c7b8fde6930ac8f2f
Revert recent commits, no time to improve things now.
===================================================================
M source/blender/blenkernel/BKE_anim.h
M source/blender/blenkernel/intern/cache_library.c
M source/blender/blenkernel/intern/object_dupli.c
M source/blender/editors/io/io_cache_library.c
M source/blender/pointcache/PTC_api.cpp
M source/blender/pointcache/PTC_api.h
M source/blender/pointcache/alembic/abc_group.cpp
M source/blender/pointcache/alembic/abc_group.h
M source/blender/pointcache/alembic/abc_mesh.cpp
M source/blender/pointcache/alembic/abc_mesh.h
M source/blender/pointcache/alembic/abc_object.cpp
M source/blender/pointcache/alembic/abc_object.h
M source/blender/pointcache/alembic/abc_particles.cpp
M source/blender/pointcache/alembic/abc_particles.h
M source/blender/pointcache/alembic/abc_reader.cpp
M source/blender/pointcache/alembic/abc_reader.h
M source/blender/pointcache/alembic/abc_writer.cpp
M source/blender/pointcache/alembic/abc_writer.h
M source/blender/pointcache/alembic/alembic.cpp
M source/blender/pointcache/intern/ptc_types.h
M source/blender/pointcache/intern/reader.h
M source/blender/pointcache/intern/writer.h
M source/blender/pointcache/util/util_types.h
===================================================================
diff --git a/source/blender/blenkernel/BKE_anim.h b/source/blender/blenkernel/BKE_anim.h
index 04b0dd8..d14231e 100644
--- a/source/blender/blenkernel/BKE_anim.h
+++ b/source/blender/blenkernel/BKE_anim.h
@@ -102,7 +102,6 @@ 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);
-void BKE_dupli_cache_clear_data(struct DupliCache *dupcache);
struct DupliObjectData *BKE_dupli_cache_add_object(struct DupliCache *dupcache, struct Object *ob);
struct DupliObject *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, bool calc_strands_base);
diff --git a/source/blender/blenkernel/intern/cache_library.c b/source/blender/blenkernel/intern/cache_library.c
index 187ac7c..bb9cb5d 100644
--- a/source/blender/blenkernel/intern/cache_library.c
+++ b/source/blender/blenkernel/intern/cache_library.c
@@ -375,15 +375,6 @@ static void cache_get_read_flags(CacheLibrary *cachelib, eCacheLibrary_EvalMode
}
}
-static PTCPass cache_pass_from_eval_mode(eCacheLibrary_EvalMode eval_mode)
-{
- switch (eval_mode) {
- case CACHE_LIBRARY_EVAL_RENDER: return PTC_PASS_RENDER;
- case CACHE_LIBRARY_EVAL_REALTIME: return PTC_PASS_BASE;
- }
- return PTC_PASS_RENDER;
-}
-
bool BKE_cache_read_dupli_cache(CacheLibrary *cachelib, DupliCache *dupcache,
Scene *scene, Group *dupgroup, float frame, eCacheLibrary_EvalMode eval_mode, bool for_display)
{
@@ -405,7 +396,7 @@ bool BKE_cache_read_dupli_cache(CacheLibrary *cachelib, DupliCache *dupcache,
if (!archive)
return false;
- PTC_reader_archive_set_pass(archive, cache_pass_from_eval_mode(eval_mode));
+ PTC_reader_archive_use_render(archive, eval_mode == CACHE_LIBRARY_EVAL_RENDER);
cache_get_read_flags(cachelib, eval_mode, for_display, &read_strands_motion, &read_strands_children);
// TODO duplicache reader should only overwrite data that is not sequentially generated by modifiers (simulations) ...
@@ -456,7 +447,7 @@ bool BKE_cache_read_dupli_object(CacheLibrary *cachelib, DupliObjectData *data,
if (!archive)
return false;
- PTC_reader_archive_set_pass(archive, cache_pass_from_eval_mode(eval_mode));
+ PTC_reader_archive_use_render(archive, eval_mode == CACHE_LIBRARY_EVAL_RENDER);
cache_get_read_flags(cachelib, eval_mode, for_display, &read_strands_motion, &read_strands_children);
reader = PTC_reader_duplicache_object(ob->id.name, ob, data, read_strands_motion, read_strands_children);
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index 761300b..ff919e8 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -1385,7 +1385,6 @@ void BKE_dupli_object_data_clear(DupliObjectData *data)
*/
data->dm->needsFree = true;
data->dm->release(data->dm);
- data->dm = NULL;
}
for (link = data->strands.first; link; link = link->next) {
@@ -1408,10 +1407,8 @@ void BKE_dupli_object_data_set_mesh(DupliObjectData *data, DerivedMesh *dm)
}
data->dm = dm;
- if (dm) {
- /* we own this dm now and need to protect it until we free it ourselves */
- dm->needsFree = false;
- }
+ /* we own this dm now and need to protect it until we free it ourselves */
+ dm->needsFree = false;
dupli_cache_calc_boundbox(data);
}
@@ -1552,7 +1549,13 @@ void BKE_dupli_cache_free(DupliCache *dupcache)
void BKE_dupli_cache_clear(DupliCache *dupcache)
{
- BKE_dupli_cache_clear_instances(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);
}
@@ -1568,19 +1571,6 @@ void BKE_dupli_cache_clear_instances(DupliCache *dupcache)
BLI_listbase_clear(&dupcache->duplilist);
}
-void BKE_dupli_cache_clear_data(DupliCache *dupcache)
-{
- GHashIterator iter;
-
- BKE_dupli_cache_clear_instances(dupcache);
-
- BLI_ghashIterator_init(&iter, dupcache->ghash);
- for (; !BLI_ghashIterator_done(&iter); BLI_ghashIterator_step(&iter)) {
- DupliObjectData *dobdata = BLI_ghashIterator_getValue(&iter);
- BKE_dupli_object_data_clear(dobdata);
- }
-}
-
static DupliObjectData *dupli_cache_add_object_data(DupliCache *dupcache, Object *ob)
{
DupliObjectData *data = MEM_callocN(sizeof(DupliObjectData), "dupli object data");
@@ -1614,6 +1604,8 @@ void BKE_dupli_cache_from_group(Scene *scene, Group *group, CacheLibrary *cachel
{
DupliObject *dob;
+ BKE_dupli_cache_clear(dupcache);
+
if (!(group && cachelib))
return;
@@ -1626,61 +1618,62 @@ void BKE_dupli_cache_from_group(Scene *scene, Group *group, CacheLibrary *cachel
for (dob = dupcache->duplilist.first; dob; dob = dob->next) {
DupliObjectData *data = BKE_dupli_cache_find_data(dupcache, dob->ob);
- ParticleSystem *psys;
-
- if (!data)
+ if (!data) {
+ ParticleSystem *psys;
+
data = dupli_cache_add_object_data(dupcache, dob->ob);
-
- if (cachelib->data_types & CACHE_TYPE_DERIVED_MESH) {
- if (dob->ob->type == OB_MESH) {
- DerivedMesh *dm;
-
- if (eval_ctx->mode == DAG_EVAL_RENDER) {
- dm = mesh_create_derived_render(scene, dob->ob, CD_MASK_BAREMESH);
- }
- else {
- dm = mesh_create_derived_view(scene, dob->ob, CD_MASK_BAREMESH);
- }
-
- if (dm)
- BKE_dupli_object_data_set_mesh(data, dm);
- }
- }
-
- for (psys = dob->ob->particlesystem.first; psys; psys = psys->next) {
- if (cachelib->data_types & CACHE_TYPE_HAIR) {
- if (psys->part && psys->part->type == PART_HAIR) {
- int numstrands = psys->totpart;
- int numverts = count_hair_verts(psys);
- ParticleData *pa;
- HairKey *hkey;
- int p, k;
+
+ if (cachelib->data_types & CACHE_TYPE_DERIVED_MESH) {
+ if (dob->ob->type == OB_MESH) {
+ DerivedMesh *dm;
- Strands *strands = BKE_strands_new(numstrands, numverts);
- StrandsCurve *scurve = strands->curves;
- StrandsVertex *svert = strands->verts;
+ if (eval_ctx->mode == DAG_EVAL_RENDER) {
+ dm = mesh_create_derived_render(scene, dob->ob, CD_MASK_BAREMESH);
+ }
+ else {
+ dm = mesh_create_derived_view(scene, dob->ob, CD_MASK_BAREMESH);
+ }
- for (p = 0, pa = psys->particles; p < psys->totpart; ++p, ++pa) {
- float hairmat[4][4];
- psys_mat_hair_to_object(dob->ob, data->dm, psys->part->from, pa, hairmat);
+ if (dm)
+ BKE_dupli_object_data_set_mesh(data, dm);
+ }
+ }
+
+ for (psys = dob->ob->particlesystem.first; psys; psys = psys->next) {
+ if (cachelib->data_types & CACHE_TYPE_HAIR) {
+ if (psys->part && psys->part->type == PART_HAIR) {
+ int numstrands = psys->totpart;
+ int numverts = count_hair_verts(psys);
+ ParticleData *pa;
+ HairKey *hkey;
+ int p, k;
- scurve->numverts = pa->totkey;
- copy_m3_m4(scurve->root_matrix, hairmat);
+ Strands *strands = BKE_strands_new(numstrands, numverts);
+ StrandsCurve *scurve = strands->curves;
+ StrandsVertex *svert = strands->verts;
- for (k = 0, hkey = pa->hair; k < pa->totkey; ++k, ++hkey) {
- mul_v3_m4v3(svert->co, hairmat, hkey->co);
- if (calc_strands_base)
- copy_v3_v3(svert->base, svert->co);
- svert->time = hkey->time;
- svert->weight = hkey->weight;
+ for (p = 0, pa = psys->particles; p < psys->totpart; ++p, ++pa) {
+ float hairmat[4][4];
+ psys_mat_hair_to_object(dob->ob, data->dm, psys->part->from, pa, hairmat);
+
+ scurve->numverts = pa->totkey;
+ copy_m3_m4(scurve->root_matrix, hairmat);
- ++svert;
+ for (k = 0, hkey = pa->hair; k < pa->totkey; ++k, ++hkey) {
+ copy_v3_v3(svert->co, hkey->co);
+ if (calc_strands_base)
+ copy_v3_v3(svert->base, hkey->co);
+ svert->time = hkey->time;
+ svert->weight = hkey->weight;
+
+ ++svert;
+ }
+
+ ++scurve;
}
- ++scurve;
+ BKE_dupli_object_data_add_strands(data, psys->name, strands);
}
-
- BKE_dupli_object_data_add_strands(data, psys->name, strands);
}
}
}
diff --git a/source/blender/editors/io/io_cache_library.c b/source/blender/editors/io/io_cache_library.c
index 39f14f4..090d3a5 100644
--- a/source/blender/editors/io/io_cache_library.c
+++ b/source/blender/editors/io/io_cache_library.c
@@ -251,18 +251,42 @@ static void cache_library_bake_set_particle_baking(Main *bmain, bool baking)
}
}
-static void cache_library_bake_do(CacheLibraryBakeJob *data, CacheProcessData *process_data)
+static void cache_library_bake_do(CacheLibraryBakeJob *data)
{
Scene *scene = data->scene;
int frame, frame_prev, start_frame, end_frame;
+ /* === prepare === */
+
+ CacheProcessData process_data;
+
+ copy_m4_m4(process_data.mat, data->mat);
+ process_data.dupcache = BKE_dupli_cache_new();
+
if (cache_library_bake_stop(data))
return;
+ switch (data->cachelib->source_mode) {
+ case CACHE_LIBRARY_SOURCE_SCENE:
+ data->writer = PTC_writer_dupligroup(data->group->id.name, &data->eval_ctx, scene, data->group, data->cachelib);
+ break;
+ case CACHE_LIBRARY_SOURCE_CACHE:
+ data->writer = PTC_writer_duplicache(data->group->id.name, data->group, process_data.dupcache, data->cachelib->data_types, G.debug & G_DEBUG_SIMDATA);
+ break;
+ }
+ if (!data->writer)
+ return;
+
+ data->cachelib->flag |= CACHE_LIBRARY_BAKING;
+
+ PTC_writer_init(data->writer, data->archive);
+
/* XXX where to get this from? */
start_frame = scene->r.sfra;
end_frame = scene->r.efra;
+ /* === frame loop === */
+
cache_library_bake_set_progress(data, 0.0f);
for (frame = frame_prev = start_frame; frame <= end_frame; frame_prev = frame++) {
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list