[Bf-blender-cvs] [ea189ce] alembic: Don't write dupli instances to caches in the Render pass.
Lukas Tönne
noreply at git.blender.org
Thu Apr 16 14:24:02 CEST 2015
Commit: ea189ce26e3f2c6102ce53394658cb8d0b36156e
Author: Lukas Tönne
Date: Thu Apr 16 12:52:42 2015 +0200
Branches: alembic
https://developer.blender.org/rBea189ce26e3f2c6102ce53394658cb8d0b36156e
Don't write dupli instances to caches in the Render pass.
Duplilists are always generated for viewport/realtime settings, render
settings only affect the mesh geometry but not the duplis.
===================================================================
M source/blender/blenkernel/intern/cache_library.c
M source/blender/editors/io/io_cache_library.c
M source/blender/pointcache/alembic/abc_group.cpp
M source/blender/pointcache/alembic/abc_writer.h
M source/blender/pointcache/intern/writer.h
M source/blender/pointcache/util/util_types.h
===================================================================
diff --git a/source/blender/blenkernel/intern/cache_library.c b/source/blender/blenkernel/intern/cache_library.c
index 0c9c24f..187ac7c 100644
--- a/source/blender/blenkernel/intern/cache_library.c
+++ b/source/blender/blenkernel/intern/cache_library.c
@@ -379,7 +379,7 @@ 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_REALTIME;
+ case CACHE_LIBRARY_EVAL_REALTIME: return PTC_PASS_BASE;
}
return PTC_PASS_RENDER;
}
diff --git a/source/blender/editors/io/io_cache_library.c b/source/blender/editors/io/io_cache_library.c
index ab10293..39f14f4 100644
--- a/source/blender/editors/io/io_cache_library.c
+++ b/source/blender/editors/io/io_cache_library.c
@@ -332,7 +332,7 @@ static void cache_library_bake_startjob(void *customdata, short *stop, short *do
if (data->cachelib->eval_mode & CACHE_LIBRARY_EVAL_REALTIME) {
data->cache_eval_mode = CACHE_LIBRARY_EVAL_REALTIME;
data->eval_ctx.mode = DAG_EVAL_VIEWPORT;
- PTC_writer_archive_set_pass(data->archive, PTC_PASS_REALTIME);
+ PTC_writer_archive_set_pass(data->archive, PTC_PASS_BASE);
cache_library_bake_do(data, &process_data);
}
diff --git a/source/blender/pointcache/alembic/abc_group.cpp b/source/blender/pointcache/alembic/abc_group.cpp
index 5121eda..085441b 100644
--- a/source/blender/pointcache/alembic/abc_group.cpp
+++ b/source/blender/pointcache/alembic/abc_group.cpp
@@ -49,15 +49,6 @@ namespace PTC {
using namespace Abc;
using namespace AbcGeom;
-static bool object_visible(Object *ob, PTCPass pass)
-{
- switch (pass) {
- case PTC_PASS_RENDER: return !(ob->restrictflag & OB_RESTRICT_RENDER);
- case PTC_PASS_REALTIME: return !(ob->restrictflag & OB_RESTRICT_VIEW);
- }
- return true;
-}
-
AbcDupliCacheWriter::AbcDupliCacheWriter(const std::string &name, Group *group, DupliCache *dupcache, int data_types, bool do_sim_debug) :
GroupWriter(group, name),
m_dupcache(dupcache),
@@ -145,8 +136,7 @@ void AbcDupliCacheWriter::write_sample_dupli(DupliObject *dob, int index)
prop_matrix.set(M44f(dob->mat));
- bool visible = object_visible(dob->ob, abc_archive()->get_pass()) && (!dob->no_draw);
- prop_visible.set(visible);
+ prop_visible.set(!dob->no_draw);
}
void AbcDupliCacheWriter::write_sample()
@@ -165,13 +155,15 @@ void AbcDupliCacheWriter::write_sample()
}
BKE_dupli_cache_iter_free(iter);
- /* write dupli instances */
- for (dob = (DupliObject *)m_dupcache->duplilist.first, i = 0; dob; dob = dob->next, ++i) {
- write_sample_dupli(dob, i);
- }
-
- if (m_simdebug_writer) {
- m_simdebug_writer->write_sample();
+ if (pass() == PTC_PASS_BASE) {
+ /* write dupli instances */
+ for (dob = (DupliObject *)m_dupcache->duplilist.first, i = 0; dob; dob = dob->next, ++i) {
+ write_sample_dupli(dob, i);
+ }
+
+ if (m_simdebug_writer) {
+ m_simdebug_writer->write_sample();
+ }
}
}
@@ -398,7 +390,17 @@ void AbcDupliCacheReader::build_object_map_add_group(Group *group)
}
}
-/* ------------------------------------------------------------------------- */
+
+/* ========================================================================= */
+
+static bool object_visible(Object *ob, PTCPass pass)
+{
+ switch (pass) {
+ case PTC_PASS_RENDER: return !(ob->restrictflag & OB_RESTRICT_RENDER);
+ case PTC_PASS_BASE: return !(ob->restrictflag & OB_RESTRICT_VIEW);
+ }
+ return true;
+}
AbcDupliObjectWriter::AbcDupliObjectWriter(const std::string &name, DupliObjectData *dupdata, bool do_mesh, bool do_strands) :
ObjectWriter(dupdata->ob, name),
diff --git a/source/blender/pointcache/alembic/abc_writer.h b/source/blender/pointcache/alembic/abc_writer.h
index 4f289d1..43ce83e 100644
--- a/source/blender/pointcache/alembic/abc_writer.h
+++ b/source/blender/pointcache/alembic/abc_writer.h
@@ -87,6 +87,8 @@ public:
AbcWriterArchive *abc_archive() const { return m_abc_archive; }
+ PTCPass pass() const { return m_abc_archive->pass(); }
+
private:
AbcWriterArchive *m_abc_archive;
};
diff --git a/source/blender/pointcache/intern/writer.h b/source/blender/pointcache/intern/writer.h
index 292bdbc..14eea82 100644
--- a/source/blender/pointcache/intern/writer.h
+++ b/source/blender/pointcache/intern/writer.h
@@ -32,7 +32,7 @@ public:
virtual ~WriterArchive() {}
void set_pass(PTCPass pass) { m_pass = pass; }
- PTCPass get_pass() const { return m_pass; }
+ PTCPass pass() const { return m_pass; }
private:
PTCPass m_pass;
diff --git a/source/blender/pointcache/util/util_types.h b/source/blender/pointcache/util/util_types.h
index a78e7bd..1ecc0e0 100644
--- a/source/blender/pointcache/util/util_types.h
+++ b/source/blender/pointcache/util/util_types.h
@@ -33,8 +33,8 @@ typedef enum PTCErrorLevel {
typedef void (*PTCErrorCallback)(void *userdata, PTCErrorLevel level, const char *message);
typedef enum PTCPass {
- PTC_PASS_RENDER = 0,
- PTC_PASS_REALTIME,
+ PTC_PASS_BASE = 0,
+ PTC_PASS_RENDER,
} PTCPass;
typedef enum PTCReadSampleResult {
More information about the Bf-blender-cvs
mailing list