Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Dietrich <kevin.dietrich@mailoo.org>2021-03-12 03:57:41 +0300
committerKévin Dietrich <kevin.dietrich@mailoo.org>2021-03-12 03:57:41 +0300
commit8922d177c1019cc846928a3d5344991e000eeaa4 (patch)
tree2f52c520623cbfd48a3390b3ee4e0ad032289479 /intern/cycles/render/alembic.cpp
parentd72fc36ec5c632cafa2f9e2c8897ce81fc83a372 (diff)
Alembic procedural: specific result type for cache lookups
This type, CacheLookupResult, holds the data for the current time, or an explanation as to why no data is available (already loaded, or simply nothing available). This is useful to document the behavior of the code but also, in future changes, to respond appropriately for missing data.
Diffstat (limited to 'intern/cycles/render/alembic.cpp')
-rw-r--r--intern/cycles/render/alembic.cpp29
1 files changed, 18 insertions, 11 deletions
diff --git a/intern/cycles/render/alembic.cpp b/intern/cycles/render/alembic.cpp
index 59454eac8a5..0841a3c09cd 100644
--- a/intern/cycles/render/alembic.cpp
+++ b/intern/cycles/render/alembic.cpp
@@ -408,8 +408,10 @@ static void add_uvs(AlembicProcedural *proc,
continue;
}
- const array<int3> *triangles = cached_data.triangles.data_for_time_no_check(time);
- const array<int3> *triangles_loops = cached_data.triangles_loops.data_for_time_no_check(time);
+ const array<int3> *triangles =
+ cached_data.triangles.data_for_time_no_check(time).get_data_or_null();
+ const array<int3> *triangles_loops =
+ cached_data.triangles_loops.data_for_time_no_check(time).get_data_or_null();
if (!triangles || !triangles_loops) {
continue;
@@ -456,7 +458,8 @@ static void add_normals(const Int32ArraySamplePtr face_indices,
*normals.getTimeSampling());
attr.std = ATTR_STD_VERTEX_NORMAL;
- const array<float3> *vertices = cached_data.vertices.data_for_time_no_check(time);
+ const array<float3> *vertices =
+ cached_data.vertices.data_for_time_no_check(time).get_data_or_null();
if (!vertices) {
return;
@@ -491,7 +494,8 @@ static void add_normals(const Int32ArraySamplePtr face_indices,
*normals.getTimeSampling());
attr.std = ATTR_STD_VERTEX_NORMAL;
- const array<float3> *vertices = cached_data.vertices.data_for_time_no_check(time);
+ const array<float3> *vertices =
+ cached_data.vertices.data_for_time_no_check(time).get_data_or_null();
if (!vertices) {
return;
@@ -1109,9 +1113,10 @@ void AlembicObject::read_attribute(const ICompoundProperty &arb_geom_params,
attribute.element = ATTR_ELEMENT_CORNER;
attribute.type_desc = TypeFloat2;
- const array<int3> *triangles = cached_data.triangles.data_for_time_no_check(time);
- const array<int3> *triangles_loops = cached_data.triangles_loops.data_for_time_no_check(
- time);
+ const array<int3> *triangles =
+ cached_data.triangles.data_for_time_no_check(time).get_data_or_null();
+ const array<int3> *triangles_loops =
+ cached_data.triangles_loops.data_for_time_no_check(time).get_data_or_null();
if (!triangles || !triangles_loops) {
return;
@@ -1164,7 +1169,8 @@ void AlembicObject::read_attribute(const ICompoundProperty &arb_geom_params,
attribute.element = ATTR_ELEMENT_CORNER_BYTE;
attribute.type_desc = TypeRGBA;
- const array<int3> *triangles = cached_data.triangles.data_for_time_no_check(time);
+ const array<int3> *triangles =
+ cached_data.triangles.data_for_time_no_check(time).get_data_or_null();
if (!triangles) {
return;
@@ -1220,7 +1226,8 @@ void AlembicObject::read_attribute(const ICompoundProperty &arb_geom_params,
attribute.element = ATTR_ELEMENT_CORNER_BYTE;
attribute.type_desc = TypeRGBA;
- const array<int3> *triangles = cached_data.triangles.data_for_time_no_check(time);
+ const array<int3> *triangles =
+ cached_data.triangles.data_for_time_no_check(time).get_data_or_null();
if (!triangles) {
return;
@@ -1259,7 +1266,7 @@ static void update_attributes(AttributeSet &attributes, CachedData &cached_data,
set<Attribute *> cached_attributes;
for (CachedData::CachedAttribute &attribute : cached_data.attributes) {
- const array<char> *attr_data = attribute.data.data_for_time(frame_time);
+ const array<char> *attr_data = attribute.data.data_for_time(frame_time).get_data_or_null();
Attribute *attr = nullptr;
if (attribute.std != ATTR_STD_NONE) {
@@ -1558,7 +1565,7 @@ void AlembicProcedural::read_mesh(AlembicObject *abc_object, Abc::chrono_t frame
cached_data.shader.copy_to_socket(frame_time, mesh, mesh->get_shader_socket());
- array<int3> *triangle_data = cached_data.triangles.data_for_time(frame_time);
+ array<int3> *triangle_data = cached_data.triangles.data_for_time(frame_time).get_data_or_null();
if (triangle_data) {
array<int> triangles;
array<bool> smooth;