[Bf-blender-cvs] [94ef02a2562] cycles_procedural_api: read face sets for all animated frames
Kévin Dietrich
noreply at git.blender.org
Sun Dec 6 06:26:30 CET 2020
Commit: 94ef02a25629bd0509a2e107ea80a94aec82394a
Author: Kévin Dietrich
Date: Sun Dec 6 02:40:35 2020 +0100
Branches: cycles_procedural_api
https://developer.blender.org/rB94ef02a25629bd0509a2e107ea80a94aec82394a
read face sets for all animated frames
===================================================================
M intern/cycles/render/alembic.cpp
M intern/cycles/render/alembic.h
===================================================================
diff --git a/intern/cycles/render/alembic.cpp b/intern/cycles/render/alembic.cpp
index ea13bb92fe2..2f96da58685 100644
--- a/intern/cycles/render/alembic.cpp
+++ b/intern/cycles/render/alembic.cpp
@@ -489,14 +489,8 @@ void AlembicObject::update_shader_attributes(const ICompoundProperty &arb_geom_p
}
template<typename SchemaType>
-void AlembicObject::read_face_sets(SchemaType &schema, array<int> &polygon_to_shader)
+void AlembicObject::read_face_sets(SchemaType &schema, array<int> &polygon_to_shader, ISampleSelector sample_sel)
{
- /* TODO(@kevindietrich) at the moment this is only supported for meshes whose topology remains
- * constant (with possible vertex animation) */
- if (schema.getTopologyVariance() == kHeterogenousTopology) {
- return;
- }
-
std::vector<std::string> face_sets;
schema.getFaceSetNames(face_sets);
@@ -531,7 +525,7 @@ void AlembicObject::read_face_sets(SchemaType &schema, array<int> &polygon_to_sh
}
const IFaceSetSchema face_schem = face_set.getSchema();
- const IFaceSetSchema::Sample face_sample = face_schem.getValue(ISampleSelector(index_t(0)));
+ const IFaceSetSchema::Sample face_sample = face_schem.getValue(sample_sel);
const Int32ArraySamplePtr group_faces = face_sample.getFaces();
const size_t num_group_faces = group_faces->size();
@@ -556,11 +550,6 @@ void AlembicObject::load_all_data(IPolyMeshSchema &schema, Progress &progress)
cached_data.triangles.set_time_sampling(*time_sampling);
cached_data.triangles_loops.set_time_sampling(*time_sampling);
- /* start by reading the face sets (per face shader), as we directly split polygons to triangles
- */
- array<int> polygon_to_shader;
- read_face_sets(schema, polygon_to_shader);
-
const IN3fGeomParam &normals = schema.getNormalsParam();
/* read topology */
@@ -584,6 +573,11 @@ void AlembicObject::load_all_data(IPolyMeshSchema &schema, Progress &progress)
* as we need valid data for each time point. This can be solved by using reference counting
* on the ccl::array and simply share the array across frames. */
if (schema.getTopologyVariance() != kHomogenousTopology || i == 0) {
+ /* start by reading the face sets (per face shader), as we directly split polygons to triangles
+ */
+ array<int> polygon_to_shader;
+ read_face_sets(schema, polygon_to_shader, iss);
+
add_triangles(
sample.getFaceCounts(), sample.getFaceIndices(), time, cached_data, polygon_to_shader);
}
@@ -638,11 +632,6 @@ void AlembicObject::load_all_data(ISubDSchema &schema, Progress &progress)
cached_data.subd_creases_edge.set_time_sampling(*time_sampling);
cached_data.subd_creases_weight.set_time_sampling(*time_sampling);
- /* start by reading the face sets (per face shader), as we directly split polygons to triangles
- */
- array<int> polygon_to_shader;
- read_face_sets(schema, polygon_to_shader);
-
/* read topology */
for (size_t i = 0; i < schema.getNumSamples(); ++i) {
if (progress.get_cancel()) {
@@ -659,6 +648,10 @@ void AlembicObject::load_all_data(ISubDSchema &schema, Progress &progress)
const Int32ArraySamplePtr face_counts = sample.getFaceCounts();
const Int32ArraySamplePtr face_indices = sample.getFaceIndices();
+ /* start by reading the face sets (per face shader) */
+ array<int> polygon_to_shader;
+ read_face_sets(schema, polygon_to_shader, iss);
+
/* read faces */
array<int> subd_start_corner;
array<int> shader;
diff --git a/intern/cycles/render/alembic.h b/intern/cycles/render/alembic.h
index 8ac9cf897a1..d7ff39c7204 100644
--- a/intern/cycles/render/alembic.h
+++ b/intern/cycles/render/alembic.h
@@ -385,7 +385,7 @@ class AlembicObject : public Node {
Progress &progress);
template<typename SchemaType>
- void read_face_sets(SchemaType &schema, array<int> &polygon_to_shader);
+ void read_face_sets(SchemaType &schema, array<int> &polygon_to_shader, Alembic::AbcGeom::ISampleSelector sample_sel);
void setup_transform_cache();
More information about the Bf-blender-cvs
mailing list