diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-08-19 15:34:01 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-08-19 15:40:51 +0300 |
commit | 51862c8445c8d5f573d1c86780db9e0972ef14dd (patch) | |
tree | 5dbcf975fde4b4ef9a348b8695bcc5aa9a09abab /source/blender/makesrna | |
parent | 5b97c00e9fc4e1e5d6cdfa7130eab5aada0e068e (diff) |
Cycles: experimental integration of Alembic procedural in viewport rendering
This patch exposes the Cycles Alembic Procedural through the MeshSequenceCache
modifier in order to use and test it from Blender.
To enable it, one has to switch the render feature set to experimental and
activate the Procedural in the modifier. An Alembic Procedural is then
created for each CacheFile from Blender set to use the Procedural, and each
Blender object having a MeshSequenceCache modifier is added to list of objects
of the right procedural.
The procedural's parameters derive from the CacheFile's properties which are
already exposed in the UI through the modifier, although more Cycles specific
options might be added in the future.
As there is currently no cache controls and since we load all the data at the
beginning of the render session, the procedural is only available during
viewport renders at the moment. When an Alembic procedural is rendered, data
from the archive are not read on the Blender side.
If a Cycles render is not active and the CacheFile is set to use the Cycles Procedural,
bounding boxes are used to display the objects in the scene as a signal that the
objects are not processed by Blender anymore. This is standard in other DCCs.
However this does not reduce the memory usage from Blender as the Alembic data
was already loaded either during an import or during a .blend file read.
This is mostly a hack to test the Cycles Alembic procedural until we have a
better Blender side mechanism for letting renderers load their own geometry,
which will be based on import and export settings on Collections (T68933).
Ref T79174, D3089
Reviewed By: brecht, sybren
Maniphest Tasks: T79174
Differential Revision: https://developer.blender.org/D10197
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r-- | source/blender/makesrna/intern/rna_cachefile.c | 17 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_render.c | 6 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene.c | 10 |
3 files changed, 33 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_cachefile.c b/source/blender/makesrna/intern/rna_cachefile.c index b93f494072c..cb0a490417d 100644 --- a/source/blender/makesrna/intern/rna_cachefile.c +++ b/source/blender/makesrna/intern/rna_cachefile.c @@ -37,6 +37,7 @@ # include "BKE_cachefile.h" # include "DEG_depsgraph.h" +# include "DEG_depsgraph_build.h" # include "WM_api.h" # include "WM_types.h" @@ -53,6 +54,12 @@ static void rna_CacheFile_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poin WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL); } +static void rna_CacheFile_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr) +{ + rna_CacheFile_update(bmain, scene, ptr); + DEG_relations_tag_update(bmain); +} + static void rna_CacheFile_object_paths_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { CacheFile *cache_file = (CacheFile *)ptr->data; @@ -105,6 +112,16 @@ static void rna_def_cachefile(BlenderRNA *brna) prop, "Sequence", "Whether the cache is separated in a series of files"); RNA_def_property_update(prop, 0, "rna_CacheFile_update"); + prop = RNA_def_property(srna, "use_render_procedural", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text( + prop, + "Use Render Engine Procedural", + "Display boxes in the viewport as placeholders for the objects, Cycles will use a " + "procedural to load the objects during viewport rendering in experimental mode, " + "other render engines will also receive a placeholder and should take care of loading the " + "Alembic data themselves if possible"); + RNA_def_property_update(prop, 0, "rna_CacheFile_dependency_update"); + /* ----------------- For Scene time ------------------- */ prop = RNA_def_property(srna, "override_frame", PROP_BOOLEAN, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 73924c45d52..4400d198b4a 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -896,6 +896,12 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); RNA_def_property_ui_text(prop, "Use Stereo Viewport", "Support rendering stereo 3D viewport"); + prop = RNA_def_property(srna, "bl_use_alembic_procedural", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_ALEMBIC_PROCEDURAL); + RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); + RNA_def_property_ui_text( + prop, "Use Alembic Procedural", "Support loading Alembic data at render time"); + RNA_define_verify_sdna(1); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index f0a1508fb5f..9d158761a21 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -616,6 +616,7 @@ const EnumPropertyItem rna_enum_transform_orientation_items[] = { # include "BLI_string_utils.h" # include "DNA_anim_types.h" +# include "DNA_cachefile_types.h" # include "DNA_color_types.h" # include "DNA_mesh_types.h" # include "DNA_node_types.h" @@ -1619,6 +1620,11 @@ static void rna_RenderSettings_engine_update(Main *bmain, ED_render_engine_changed(bmain, true); } +static void rna_Scene_update_render_engine(Main *bmain) +{ + ED_render_engine_changed(bmain, true); +} + static bool rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr)) { return (BLI_listbase_count(&R_engines) > 1); @@ -7836,6 +7842,10 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_update(prop, NC_SCENE, NULL); RNA_def_property_update(prop, NC_SCENE, "rna_Scene_volume_update"); + func = RNA_def_function(srna, "update_render_engine", "rna_Scene_update_render_engine"); + RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_MAIN); + RNA_def_function_ui_description(func, "Trigger a render engine update"); + /* Statistics */ func = RNA_def_function(srna, "statistics", "rna_Scene_statistics_string_get"); RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS); |