diff options
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/render/alembic_read.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/intern/cycles/render/alembic_read.cpp b/intern/cycles/render/alembic_read.cpp index 33ce3502879..c53ec668938 100644 --- a/intern/cycles/render/alembic_read.cpp +++ b/intern/cycles/render/alembic_read.cpp @@ -736,13 +736,14 @@ static void process_uvs(CachedData &cache, const IV2fGeomParam::Sample &sample, double time) { - if (scope != kFacevaryingScope) { + if (scope != kFacevaryingScope && scope != kVaryingScope && scope != kVertexScope) { return; } const array<int> *uv_loops = cache.uv_loops.data_for_time_no_check(time).get_data_or_null(); - if (!uv_loops) { + /* It's ok to not have loop indices, as long as the scope is not face-varying. */ + if (!uv_loops && scope == kFacevaryingScope) { return; } @@ -766,9 +767,27 @@ static void process_uvs(CachedData &cache, const uint32_t *indices = sample.getIndices()->get(); const V2f *values = sample.getVals()->get(); - for (const int uv_loop_index : *uv_loops) { - const uint32_t index = indices[uv_loop_index]; - *data_float2++ = make_float2(values[index][0], values[index][1]); + if (scope == kFacevaryingScope) { + for (const int uv_loop_index : *uv_loops) { + const uint32_t index = indices[uv_loop_index]; + *data_float2++ = make_float2(values[index][0], values[index][1]); + } + } + else if (scope == kVaryingScope || scope == kVertexScope) { + if (triangles) { + for (size_t i = 0; i < triangles->size(); i++) { + const int3 t = (*triangles)[i]; + *data_float2++ = make_float2(values[t.x][0], values[t.x][1]); + *data_float2++ = make_float2(values[t.y][0], values[t.y][1]); + *data_float2++ = make_float2(values[t.z][0], values[t.z][1]); + } + } + else if (corners) { + for (size_t i = 0; i < corners->size(); i++) { + const int c = (*corners)[i]; + *data_float2++ = make_float2(values[c][0], values[c][1]); + } + } } attribute.data.add_data(data, time); |