[Bf-blender-cvs] [b9d246d640e] cycles_procedural_api: prefer using AttributeElement over AttributeStandard
Kévin Dietrich
noreply at git.blender.org
Sat Oct 3 04:18:22 CEST 2020
Commit: b9d246d640e86eeed943b2cfa93bc0d7af656190
Author: Kévin Dietrich
Date: Mon Sep 28 14:49:54 2020 +0200
Branches: cycles_procedural_api
https://developer.blender.org/rBb9d246d640e86eeed943b2cfa93bc0d7af656190
prefer using AttributeElement over AttributeStandard
===================================================================
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 63ebd1adcc0..1b5c7983363 100644
--- a/intern/cycles/render/alembic.cpp
+++ b/intern/cycles/render/alembic.cpp
@@ -269,10 +269,12 @@ void AlembicObject::read_attribute(const ICompoundProperty &arb_geom_params, con
C3fArraySamplePtr values = sample.getVals();
AttributeData &attribute = data_cache.attributes.emplace_back();
+ attribute.std = ATTR_STD_NONE;
attribute.name = attr_name;
if (param.getScope() == kVaryingScope) {
- attribute.std = ATTR_STD_VERTEX_COLOR;
+ attribute.element = ATTR_ELEMENT_CORNER_BYTE;
+ attribute.type_desc = TypeDesc::TypeColor;
attribute.data.resize(data_cache.triangles.size() * 3 * sizeof(uchar4));
uchar4 *data_uchar4 = reinterpret_cast<uchar4 *>(attribute.data.data());
@@ -512,8 +514,16 @@ void AlembicProcedural::read_mesh(Scene *scene,
}
for (const AlembicObject::AttributeData &attribute : data.attributes) {
- Attribute *attr = mesh->attributes.add(attribute.std, attribute.name);
- memcpy(attr->data_uchar4(), attribute.data.data(), attribute.data.size());
+ Attribute *attr = nullptr;
+ if (attribute.std != ATTR_STD_NONE) {
+ attr = mesh->attributes.add(attribute.std, attribute.name);
+ }
+ else {
+ attr = mesh->attributes.add(attribute.name, attribute.type_desc, attribute.element);
+ }
+ assert(attr);
+
+ memcpy(attr->data(), attribute.data.data(), attribute.data.size());
}
if (mesh->is_modified()) {
diff --git a/intern/cycles/render/alembic.h b/intern/cycles/render/alembic.h
index 4bb5d5960ec..fe9d45b4f16 100644
--- a/intern/cycles/render/alembic.h
+++ b/intern/cycles/render/alembic.h
@@ -57,6 +57,8 @@ class AlembicObject : public Node {
struct AttributeData {
AttributeStandard std;
+ AttributeElement element;
+ TypeDesc type_desc;
ustring name;
array<char> data;
};
More information about the Bf-blender-cvs
mailing list