diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/blender/object.cpp | 11 | ||||
-rw-r--r-- | intern/cycles/scene/alembic.cpp | 17 | ||||
-rw-r--r-- | intern/cycles/scene/alembic.h | 4 |
3 files changed, 30 insertions, 2 deletions
diff --git a/intern/cycles/blender/object.cpp b/intern/cycles/blender/object.cpp index 86314d3b196..65a04a39660 100644 --- a/intern/cycles/blender/object.cpp +++ b/intern/cycles/blender/object.cpp @@ -529,6 +529,17 @@ void BlenderSync::sync_procedural(BL::Object &b_ob, string absolute_path = blender_absolute_path(b_data, b_ob, b_mesh_cache.cache_file().filepath()); procedural->set_filepath(ustring(absolute_path)); + array<ustring> layers; + for (BL::CacheFileLayer &layer : cache_file.layers) { + if (layer.hide_layer()) { + continue; + } + + absolute_path = blender_absolute_path(b_data, b_ob, layer.filepath()); + layers.push_back_slow(ustring(absolute_path)); + } + procedural->set_layers(layers); + procedural->set_scale(cache_file.scale()); procedural->set_use_prefetch(cache_file.use_prefetch()); diff --git a/intern/cycles/scene/alembic.cpp b/intern/cycles/scene/alembic.cpp index 71fa1863b8b..7780b13eecb 100644 --- a/intern/cycles/scene/alembic.cpp +++ b/intern/cycles/scene/alembic.cpp @@ -742,6 +742,7 @@ NODE_DEFINE(AlembicProcedural) NodeType *type = NodeType::add("alembic", create); SOCKET_STRING(filepath, "Filename", ustring()); + SOCKET_STRING_ARRAY(layers, "Layers", array<ustring>()); SOCKET_FLOAT(frame, "Frame", 1.0f); SOCKET_FLOAT(start_frame, "Start Frame", 1.0f); SOCKET_FLOAT(end_frame, "End Frame", 1.0f); @@ -839,14 +840,26 @@ void AlembicProcedural::generate(Scene *scene, Progress &progress) return; } - if (!archive.valid()) { + if (!archive.valid() || filepath_is_modified() || layers_is_modified()) { Alembic::AbcCoreFactory::IFactory factory; factory.setPolicy(Alembic::Abc::ErrorHandler::kQuietNoopPolicy); - archive = factory.getArchive(filepath.c_str()); + + std::vector<std::string> filenames; + filenames.push_back(filepath.c_str()); + + for (const ustring &layer : layers) { + filenames.push_back(layer.c_str()); + } + + /* We need to reverse the order as overriding archives should come first. */ + std::reverse(filenames.begin(), filenames.end()); + + archive = factory.getArchive(filenames); if (!archive.valid()) { /* avoid potential infinite update loops in viewport synchronization */ filepath.clear(); + layers.clear(); clear_modified(); return; } diff --git a/intern/cycles/scene/alembic.h b/intern/cycles/scene/alembic.h index 3a4d37da3ff..6068ea3ef03 100644 --- a/intern/cycles/scene/alembic.h +++ b/intern/cycles/scene/alembic.h @@ -479,6 +479,10 @@ class AlembicProcedural : public Procedural { /* The file path to the Alembic archive */ NODE_SOCKET_API(ustring, filepath) + /* Layers for the Alembic archive. Layers are in the order in which they override data, with the + * latter elements overriding the former ones. */ + NODE_SOCKET_API_ARRAY(array<ustring>, layers) + /* The current frame to render. */ NODE_SOCKET_API(float, frame) |