[Bf-blender-cvs] [da2bf12] alembic: Ignore the display/render settings of the cachelibrary when doing simulations.
Lukas Tönne
noreply at git.blender.org
Tue Apr 14 11:06:21 CEST 2015
Commit: da2bf129a4b1299e83dcdc93937e656c9e6b0a62
Author: Lukas Tönne
Date: Mon Apr 13 11:14:37 2015 +0200
Branches: alembic
https://developer.blender.org/rBda2bf129a4b1299e83dcdc93937e656c9e6b0a62
Ignore the display/render settings of the cachelibrary when doing
simulations.
Otherwise the child strands and/or motion state can be missing and lead
to incomplete output caches.
===================================================================
M source/blender/blenkernel/BKE_cache_library.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/makesrna/intern/rna_main_api.c
M source/blender/makesrna/intern/rna_object.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_cache_library.h b/source/blender/blenkernel/BKE_cache_library.h
index c27040f..0bb06c8 100644
--- a/source/blender/blenkernel/BKE_cache_library.h
+++ b/source/blender/blenkernel/BKE_cache_library.h
@@ -74,9 +74,9 @@ void BKE_cache_archive_output_path(struct CacheLibrary *cachelib, char *result,
void BKE_cache_library_dag_recalc_tag(struct EvaluationContext *eval_ctx, struct Main *bmain);
bool BKE_cache_read_dupli_cache(struct CacheLibrary *cachelib, struct DupliCache *dupcache,
- struct Scene *scene, struct Group *dupgroup, float frame, eCacheLibrary_EvalMode eval_mode);
+ struct Scene *scene, struct Group *dupgroup, float frame, eCacheLibrary_EvalMode eval_mode, bool read_all);
bool BKE_cache_read_dupli_object(struct CacheLibrary *cachelib, struct DupliObjectData *data,
- struct Scene *scene, struct Object *ob, float frame, eCacheLibrary_EvalMode eval_mode);
+ struct Scene *scene, struct Object *ob, float frame, eCacheLibrary_EvalMode eval_mode, bool read_all);
void BKE_cache_process_dupli_cache(struct CacheLibrary *cachelib, struct CacheProcessData *data,
struct Scene *scene, struct Group *dupgroup, float frame_prev, float frame, eCacheLibrary_EvalMode eval_mode);
diff --git a/source/blender/blenkernel/intern/cache_library.c b/source/blender/blenkernel/intern/cache_library.c
index 089fc90..b8b11a0 100644
--- a/source/blender/blenkernel/intern/cache_library.c
+++ b/source/blender/blenkernel/intern/cache_library.c
@@ -350,27 +350,33 @@ static struct PTCReaderArchive *find_active_cache(Scene *scene, CacheLibrary *ca
return archive;
}
-static void cache_get_read_flags(CacheLibrary *cachelib, eCacheLibrary_EvalMode eval_mode,
+static void cache_get_read_flags(CacheLibrary *cachelib, eCacheLibrary_EvalMode eval_mode, bool read_all,
bool *read_strands_motion, bool *read_strands_children)
{
- switch (eval_mode) {
- case CACHE_LIBRARY_EVAL_REALTIME:
- *read_strands_motion = cachelib->display_flag & CACHE_LIBRARY_DISPLAY_MOTION;
- *read_strands_children = cachelib->display_flag & CACHE_LIBRARY_DISPLAY_CHILDREN;
- break;
- case CACHE_LIBRARY_EVAL_RENDER:
- *read_strands_motion = cachelib->render_flag & CACHE_LIBRARY_RENDER_MOTION;
- *read_strands_children = cachelib->render_flag & CACHE_LIBRARY_RENDER_CHILDREN;
- break;
- default:
- *read_strands_motion = false;
- *read_strands_children = false;
- break;
+ if (read_all) {
+ *read_strands_motion = true;
+ *read_strands_children = true;
+ }
+ else {
+ switch (eval_mode) {
+ case CACHE_LIBRARY_EVAL_REALTIME:
+ *read_strands_motion = cachelib->display_flag & CACHE_LIBRARY_DISPLAY_MOTION;
+ *read_strands_children = cachelib->display_flag & CACHE_LIBRARY_DISPLAY_CHILDREN;
+ break;
+ case CACHE_LIBRARY_EVAL_RENDER:
+ *read_strands_motion = cachelib->render_flag & CACHE_LIBRARY_RENDER_MOTION;
+ *read_strands_children = cachelib->render_flag & CACHE_LIBRARY_RENDER_CHILDREN;
+ break;
+ default:
+ *read_strands_motion = false;
+ *read_strands_children = false;
+ break;
+ }
}
}
bool BKE_cache_read_dupli_cache(CacheLibrary *cachelib, DupliCache *dupcache,
- Scene *scene, Group *dupgroup, float frame, eCacheLibrary_EvalMode eval_mode)
+ Scene *scene, Group *dupgroup, float frame, eCacheLibrary_EvalMode eval_mode, bool read_all)
{
bool read_strands_motion, read_strands_children, read_simdebug = G.debug & G_DEBUG_SIMDATA;
struct PTCReaderArchive *archive;
@@ -390,7 +396,9 @@ bool BKE_cache_read_dupli_cache(CacheLibrary *cachelib, DupliCache *dupcache,
if (!archive)
return false;
- cache_get_read_flags(cachelib, eval_mode, &read_strands_motion, &read_strands_children);
+ PTC_reader_archive_use_render(archive, eval_mode == CACHE_LIBRARY_EVAL_RENDER);
+
+ cache_get_read_flags(cachelib, eval_mode, read_all, &read_strands_motion, &read_strands_children);
// TODO duplicache reader should only overwrite data that is not sequentially generated by modifiers (simulations) ...
reader = PTC_reader_duplicache(dupgroup->id.name, dupgroup, dupcache,
read_strands_motion, read_strands_children, read_simdebug);
@@ -405,7 +413,7 @@ bool BKE_cache_read_dupli_cache(CacheLibrary *cachelib, DupliCache *dupcache,
}
bool BKE_cache_read_dupli_object(CacheLibrary *cachelib, DupliObjectData *data,
- Scene *scene, Object *ob, float frame, eCacheLibrary_EvalMode eval_mode)
+ Scene *scene, Object *ob, float frame, eCacheLibrary_EvalMode eval_mode, bool read_all)
{
bool read_strands_motion, read_strands_children;
struct PTCReaderArchive *archive;
@@ -423,7 +431,7 @@ bool BKE_cache_read_dupli_object(CacheLibrary *cachelib, DupliObjectData *data,
PTC_reader_archive_use_render(archive, eval_mode == CACHE_LIBRARY_EVAL_RENDER);
- cache_get_read_flags(cachelib, eval_mode, &read_strands_motion, &read_strands_children);
+ cache_get_read_flags(cachelib, eval_mode, read_all, &read_strands_motion, &read_strands_children);
reader = PTC_reader_duplicache_object(ob->id.name, ob, data, read_strands_motion, read_strands_children);
PTC_reader_init(reader, archive);
diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index d13b6e6..64f60ed 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -1707,7 +1707,7 @@ void BKE_object_dupli_cache_update(Scene *scene, Object *ob, EvaluationContext *
/* skip reading when the cachelib is baking, avoids unnecessary memory allocation */
if (!(ob->cache_library->flag & CACHE_LIBRARY_BAKING)) {
/* TODO at this point we could apply animation offset */
- BKE_cache_read_dupli_cache(ob->cache_library, ob->dup_cache, scene, ob->dup_group, frame, eval_mode);
+ BKE_cache_read_dupli_cache(ob->cache_library, ob->dup_cache, scene, ob->dup_group, frame, eval_mode, false);
}
ob->dup_cache->flag &= ~DUPCACHE_FLAG_DIRTY;
diff --git a/source/blender/editors/io/io_cache_library.c b/source/blender/editors/io/io_cache_library.c
index 4d0aa07..b434d0e 100644
--- a/source/blender/editors/io/io_cache_library.c
+++ b/source/blender/editors/io/io_cache_library.c
@@ -277,7 +277,7 @@ static void cache_library_bake_do(CacheLibraryBakeJob *data)
BKE_dupli_cache_from_group(scene, data->group, data->cachelib, process_data.dupcache, &data->eval_ctx);
break;
case CACHE_LIBRARY_SOURCE_CACHE:
- BKE_cache_read_dupli_cache(data->cachelib, process_data.dupcache, scene, data->group, frame, data->cache_eval_mode);
+ BKE_cache_read_dupli_cache(data->cachelib, process_data.dupcache, scene, data->group, frame, data->cache_eval_mode, true);
break;
}
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index e634754..27a1818 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -355,7 +355,7 @@ Mesh *rna_Main_meshes_new_from_dupli(
DupliObjectData data;
memset(&data, 0, sizeof(data));
- if (BKE_cache_read_dupli_object(parent->cache_library, &data, scene, dob->ob, frame, eval_mode))
+ if (BKE_cache_read_dupli_object(parent->cache_library, &data, scene, dob->ob, frame, eval_mode, true))
mesh = BKE_mesh_new_from_dupli_data(bmain, &data, calc_tessface, calc_undeformed);
BKE_dupli_object_data_clear(&data);
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 3831602..b83a9c8 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -1552,7 +1552,7 @@ Strands *rna_DupliObject_strands_new(DupliObject *dob, ReportList *UNUSED(report
DupliObjectData data;
memset(&data, 0, sizeof(data));
- if (BKE_cache_read_dupli_object(parent->cache_library, &data, scene, dob->ob, frame, eval_mode)) {
+ if (BKE_cache_read_dupli_object(parent->cache_library, &data, scene, dob->ob, frame, eval_mode, true)) {
strands = BKE_dupli_object_data_find_strands(&data, psys->name);
BKE_dupli_object_data_acquire_strands(&data, strands);
}
@@ -1602,7 +1602,7 @@ StrandsChildren *rna_DupliObject_strands_children_new(DupliObject *dob, ReportLi
DupliObjectData data;
memset(&data, 0, sizeof(data));
- if (BKE_cache_read_dupli_object(parent->cache_library, &data, scene, dob->ob, frame, eval_mode)) {
+ if (BKE_cache_read_dupli_object(parent->cache_library, &data, scene, dob->ob, frame, eval_mode, true)) {
strands = BKE_dupli_object_data_find_strands_children(&data, psys->name);
BKE_dupli_object_data_acquire_strands_children(&data, strands);
}
More information about the Bf-blender-cvs
mailing list