[Bf-blender-cvs] [b3faf5a] alembic: Explicit flags for toggling motion (from simulation) and child strands in both display and render of caches.
Lukas Tönne
noreply at git.blender.org
Fri Apr 10 11:56:20 CEST 2015
Commit: b3faf5a4ea67e89c630e92566f73ae6e4eae2dcb
Author: Lukas Tönne
Date: Fri Apr 10 11:55:09 2015 +0200
Branches: alembic
https://developer.blender.org/rBb3faf5a4ea67e89c630e92566f73ae6e4eae2dcb
Explicit flags for toggling motion (from simulation) and child strands
in both display and render of caches.
===================================================================
M release/scripts/startup/bl_ui/properties_object.py
M source/blender/blenkernel/intern/cache_library.c
M source/blender/makesdna/DNA_cache_library_types.h
M source/blender/makesrna/intern/rna_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_particles.cpp
M source/blender/pointcache/alembic/abc_particles.h
M source/blender/pointcache/alembic/alembic.cpp
M source/blender/pointcache/intern/ptc_types.h
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py
index fcff62a..471cf2c 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -339,11 +339,22 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, Panel):
layout.separator()
- col = layout.column()
- row = col.row()
- row.label("Display:")
- row.prop(cachelib, "display_mode", expand=True)
- row = col.row(align=True)
+ layout.prop(cachelib, "display_mode", expand=True)
+ row = layout.row()
+ split = row.split()
+ col = split.column()
+ col.label("Display:")
+ col.prop(cachelib, "display_motion", text="Motion")
+ col.prop(cachelib, "display_children", text="Children")
+ split = row.split()
+ col = split.column()
+ col.label("Render:")
+ col.prop(cachelib, "render_motion", text="Motion")
+ col.prop(cachelib, "render_children", text="Children")
+
+ layout.separator()
+
+ row = layout.row(align=True)
row.enabled = (cachelib.display_mode == 'RESULT')
row.prop(cachelib, "output_filepath", text="")
props = row.operator("cachelibrary.archive_info", text="", icon='QUESTION')
@@ -352,6 +363,7 @@ class OBJECT_PT_duplication(ObjectButtonsPanel, Panel):
props.use_popup = True
props.use_clipboard = True
+ col = layout.column()
col.operator("cachelibrary.bake")
col.row().prop(cachelib, "eval_mode", toggle=True, expand=True)
col.row().prop(cachelib, "data_types", icon_only=True, toggle=True)
diff --git a/source/blender/blenkernel/intern/cache_library.c b/source/blender/blenkernel/intern/cache_library.c
index f8bf982..e8f5149 100644
--- a/source/blender/blenkernel/intern/cache_library.c
+++ b/source/blender/blenkernel/intern/cache_library.c
@@ -82,6 +82,8 @@ CacheLibrary *BKE_cache_library_add(Main *bmain, const char *name)
cachelib->source_mode = CACHE_LIBRARY_SOURCE_SCENE;
cachelib->display_mode = CACHE_LIBRARY_DISPLAY_RESULT;
+ cachelib->display_flag = CACHE_LIBRARY_DISPLAY_MOTION | CACHE_LIBRARY_DISPLAY_CHILDREN;
+ cachelib->render_flag = CACHE_LIBRARY_RENDER_MOTION | CACHE_LIBRARY_RENDER_CHILDREN;
cachelib->eval_mode = CACHE_LIBRARY_EVAL_REALTIME | CACHE_LIBRARY_EVAL_RENDER;
/* cache everything by default */
@@ -331,9 +333,29 @@ static struct PTCReaderArchive *find_active_cache(Scene *scene, CacheLibrary *ca
return archive;
}
+static void cache_get_read_flags(CacheLibrary *cachelib, eCacheLibrary_EvalMode eval_mode,
+ 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;
+ }
+}
+
bool BKE_cache_read_dupli_cache(CacheLibrary *cachelib, DupliCache *dupcache,
Scene *scene, Group *dupgroup, float frame, eCacheLibrary_EvalMode eval_mode)
{
+ bool read_strands_motion, read_strands_children, read_simdebug = G.debug & G_DEBUG_SIMDATA;
struct PTCReaderArchive *archive;
struct PTCReader *reader;
@@ -351,8 +373,10 @@ 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);
// TODO duplicache reader should only overwrite data that is not sequentially generated by modifiers (simulations) ...
- reader = PTC_reader_duplicache(dupgroup->id.name, dupgroup, dupcache, G.debug & G_DEBUG_SIMDATA);
+ reader = PTC_reader_duplicache(dupgroup->id.name, dupgroup, dupcache,
+ read_strands_motion, read_strands_children, read_simdebug);
PTC_reader_init(reader, archive);
dupcache->result = BKE_cache_read_result(PTC_read_sample(reader, frame));
@@ -366,6 +390,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)
{
+ bool read_strands_motion, read_strands_children;
struct PTCReaderArchive *archive;
struct PTCReader *reader;
/*eCacheReadSampleResult result;*/ /* unused */
@@ -381,7 +406,8 @@ bool BKE_cache_read_dupli_object(CacheLibrary *cachelib, DupliObjectData *data,
PTC_reader_archive_use_render(archive, eval_mode == CACHE_LIBRARY_EVAL_RENDER);
- reader = PTC_reader_duplicache_object(ob->id.name, ob, data);
+ cache_get_read_flags(cachelib, eval_mode, &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);
/*result = */BKE_cache_read_result(PTC_read_sample(reader, frame));
diff --git a/source/blender/makesdna/DNA_cache_library_types.h b/source/blender/makesdna/DNA_cache_library_types.h
index 37366b3..84be8fd 100644
--- a/source/blender/makesdna/DNA_cache_library_types.h
+++ b/source/blender/makesdna/DNA_cache_library_types.h
@@ -75,6 +75,16 @@ typedef enum eCacheLibrary_Flag {
CACHE_LIBRARY_BAKING = (1 << 0), /* perform modifier evaluation when evaluating */
} eCacheLibrary_Flag;
+typedef enum eCacheLibrary_DisplayFlag {
+ CACHE_LIBRARY_DISPLAY_MOTION = (1 << 0), /* display motion state result from simulation, if available */
+ CACHE_LIBRARY_DISPLAY_CHILDREN = (1 << 1), /* display child strands, if available */
+} eCacheLibrary_DisplayFlag;
+
+typedef enum eCacheLibrary_RenderFlag {
+ CACHE_LIBRARY_RENDER_MOTION = (1 << 0), /* render motion state result from simulation, if available */
+ CACHE_LIBRARY_RENDER_CHILDREN = (1 << 1), /* render child strands, if available */
+} eCacheLibrary_RenderFlag;
+
typedef struct CacheLibrary {
ID id;
@@ -83,6 +93,8 @@ typedef struct CacheLibrary {
short source_mode;
short display_mode;
short pad;
+ int display_flag;
+ int render_flag;
int data_types;
char input_filepath[1024]; /* 1024 = FILE_MAX */
diff --git a/source/blender/makesrna/intern/rna_cache_library.c b/source/blender/makesrna/intern/rna_cache_library.c
index f2a3561..565a162 100644
--- a/source/blender/makesrna/intern/rna_cache_library.c
+++ b/source/blender/makesrna/intern/rna_cache_library.c
@@ -392,6 +392,26 @@ static void rna_def_cache_library(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Display Mode", "What data to display in the viewport");
RNA_def_property_update(prop, 0, "rna_CacheLibrary_update");
+ prop = RNA_def_property(srna, "display_motion", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "display_flag", CACHE_LIBRARY_DISPLAY_MOTION);
+ RNA_def_property_ui_text(prop, "Display Motion", "Display motion state result from simulation, if available");
+ RNA_def_property_update(prop, 0, "rna_CacheLibrary_update");
+
+ prop = RNA_def_property(srna, "display_children", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "display_flag", CACHE_LIBRARY_DISPLAY_CHILDREN);
+ RNA_def_property_ui_text(prop, "Display Children", "Display child strands, if available");
+ RNA_def_property_update(prop, 0, "rna_CacheLibrary_update");
+
+ prop = RNA_def_property(srna, "render_motion", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "render_flag", CACHE_LIBRARY_RENDER_MOTION);
+ RNA_def_property_ui_text(prop, "Render Motion", "Render motion state result from simulation, if available");
+ RNA_def_property_update(prop, 0, "rna_CacheLibrary_update");
+
+ prop = RNA_def_property(srna, "render_children", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "render_flag", CACHE_LIBRARY_RENDER_CHILDREN);
+ RNA_def_property_ui_text(prop, "Render Children", "Render child strands, if available");
+ RNA_def_property_update(prop, 0, "rna_CacheLibrary_update");
+
prop = RNA_def_property(srna, "eval_mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "eval_mode");
RNA_def_property_enum_items(prop, eval_mode_items);
diff --git a/source/blender/pointcache/PTC_api.cpp b/source/blender/pointcache/PTC_api.cpp
index 27b192f..82346c1 100644
--- a/source/blender/pointcache/PTC_api.cpp
+++ b/source/blender/pointcache/PTC_api.cpp
@@ -254,14 +254,17 @@ PTCWriter *PTC_writer_duplicache(const char *name, struct Group *group, struct D
return (PTCWriter *)PTC::Factory::alembic->create_writer_duplicache(name, group, dupcache, datatypes, do_sim_debug);
}
-PTCReader *PTC_reader_duplicache(const char *name, struct Group *group, struct DupliCache *dupcache, bool do_sim_debug)
+PTCReader *PTC_reader_duplicache(const char *name, struct Group *group, struct DupliCache *dupcache,
+ bool read_strands_motion, bool read_strands_children, bool read_sim_debug)
{
- return (PTCReader *)PTC::Factory::alembic->create_reader_duplicache(name, group, dupcache, do_sim_debug);
+ return (PTCReader *)PTC::Factory::alembic->create_reader_duplicache(name, group, dupcache,
+ read_strands_motion, read_strands_children, read_sim_debug);
}
-PTCReader *PTC_reader_duplicache_object(const char *name, struct Object *ob, struct DupliObjectData *data)
+PTCReader *PTC_reader_duplicache_object(const char *name, struct Object *ob, struct DupliObjectData *data,
+ bool read_strands_motion, bool read_strands_children)
{
- return (PTCReader *)PTC::Factory::alembic->create_reader_duplicache_object(name, ob, data);
+ return (PTCReader *)PTC::Factory::alembic->create_reader_duplicach
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list