Attributes: Integrate implicit sharing with the attribute API #107059

Merged
Jacques Lucke merged 8 commits from HooglyBoogly/blender:implicit-sharing-attribute-api into main 2023-04-19 11:21:21 +02:00
2 changed files with 10 additions and 1 deletions
Showing only changes of commit 3321664220 - Show all commits

View File

@ -161,8 +161,12 @@ static void add_instances_from_component(
bke::MutableAttributeAccessor dst_attributes = dst_component.attributes_for_write();
for (const auto item : attributes_to_propagate.items()) {
const AttributeIDRef &id = item.key;
const bke::GAttributeReader src = src_attributes.lookup(id, ATTR_DOMAIN_POINT);
if (!src) {
/* Domain interpolation can fail if the source domain is empty. */
continue;
}
const eCustomDataType type = bke::cpp_type_to_custom_data_type(src.varray.type());
if (src.varray.size() == dst_component.instances_num() && src.sharing_info) {
const bke::AttributeInitShared init(src.varray.get_internal_span().data(),

View File

@ -115,6 +115,11 @@ static void geometry_set_mesh_to_points(GeometrySet &geometry_set,
const AttributeIDRef attribute_id = entry.key;
const eCustomDataType data_type = entry.value.data_type;
const bke::GAttributeReader src = src_attributes.lookup(attribute_id, domain, data_type);
if (!src) {
/* Domain interpolation can fail if the source domain is empty. */
continue;
}
if (share_arrays && src.domain == domain && src.sharing_info) {
const bke::AttributeInitShared init(src.varray.get_internal_span().data(),
*src.sharing_info);