Alembic Procedural: only subdivide if subsurf modifier is present
As subdivision objects are first class citizens in Alembic, to differentiate them with non-subdivided polygon meshes, the Alembic Procedural automatically sets up subdivision properties on the generated Cycles Mesh. However, for real-time playback subdivision is far too slow, so this modifies the detection of a MeshSeqCache modifier used to activate the procedural to allow for a Subsurf modifier right after the cache one. If present, the procedural will tag the object for subdivision, if absent, the object will be treated as a regular mesh. This is a temporary measure for until subdivision surface settings are part of the Mesh datablock (see T68891). Reviewed By: brecht Differential Revision: https://developer.blender.org/D11162
This commit is contained in:
@@ -485,7 +485,9 @@ bool BlenderSync::sync_object_attributes(BL::DepsgraphObjectInstance &b_instance
|
||||
|
||||
/* Object Loop */
|
||||
|
||||
void BlenderSync::sync_procedural(BL::Object &b_ob, BL::MeshSequenceCacheModifier &b_mesh_cache)
|
||||
void BlenderSync::sync_procedural(BL::Object &b_ob,
|
||||
BL::MeshSequenceCacheModifier &b_mesh_cache,
|
||||
bool has_subdivision_modifier)
|
||||
{
|
||||
#ifdef WITH_ALEMBIC
|
||||
BL::CacheFile cache_file = b_mesh_cache.cache_file();
|
||||
@@ -534,6 +536,8 @@ void BlenderSync::sync_procedural(BL::Object &b_ob, BL::MeshSequenceCacheModifie
|
||||
abc_object->set_subd_dicing_rate(subd_dicing_rate);
|
||||
abc_object->set_subd_max_level(max_subdivisions);
|
||||
|
||||
abc_object->set_ignore_subdivision(!has_subdivision_modifier);
|
||||
|
||||
if (abc_object->is_modified() || procedural->is_modified()) {
|
||||
procedural->tag_update(scene);
|
||||
}
|
||||
@@ -601,13 +605,14 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
|
||||
if (b_instance.show_self()) {
|
||||
#ifdef WITH_ALEMBIC
|
||||
bool use_procedural = false;
|
||||
bool has_subdivision_modifier = false;
|
||||
BL::MeshSequenceCacheModifier b_mesh_cache(PointerRNA_NULL);
|
||||
|
||||
/* Experimental as Blender does not have good support for procedurals at the moment, also
|
||||
* only available in preview renders since currently do not have a good cache policy, the
|
||||
* data being loaded at once for all the frames. */
|
||||
if (experimental && b_v3d) {
|
||||
b_mesh_cache = object_mesh_cache_find(b_ob, false);
|
||||
b_mesh_cache = object_mesh_cache_find(b_ob, false, &has_subdivision_modifier);
|
||||
use_procedural = b_mesh_cache && b_mesh_cache.cache_file().use_render_procedural();
|
||||
}
|
||||
|
||||
@@ -615,7 +620,7 @@ void BlenderSync::sync_objects(BL::Depsgraph &b_depsgraph,
|
||||
/* Skip in the motion case, as generating motion blur data will be handled in the
|
||||
* procedural. */
|
||||
if (!motion) {
|
||||
sync_procedural(b_ob, b_mesh_cache);
|
||||
sync_procedural(b_ob, b_mesh_cache, has_subdivision_modifier);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user