Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/attribute_access.cc
| Show First 20 Lines • Show All 1,005 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| GAttributeWriter attribute = this->lookup_or_add_for_write(attribute_id, domain, data_type); | GAttributeWriter attribute = this->lookup_or_add_for_write(attribute_id, domain, data_type); | ||||
| if (attribute) { | if (attribute) { | ||||
| return GSpanAttributeWriter{std::move(attribute), false}; | return GSpanAttributeWriter{std::move(attribute), false}; | ||||
| } | } | ||||
| return {}; | return {}; | ||||
| } | } | ||||
| Vector<AttributeTransferData> retrieve_attributes_for_transfer( | |||||
| const bke::AttributeAccessor &src_attributes, | |||||
| bke::MutableAttributeAccessor &dst_attributes, | |||||
| const eAttrDomainMask domain_mask, | |||||
| const Set<std::string> &skip) | |||||
| { | |||||
| Vector<AttributeTransferData> attributes; | |||||
| src_attributes.for_all( | |||||
| [&](const bke::AttributeIDRef &id, const bke::AttributeMetaData meta_data) { | |||||
| if (!(ATTR_DOMAIN_AS_MASK(meta_data.domain) & domain_mask)) { | |||||
| return true; | |||||
| } | |||||
| if (id.is_named() && skip.contains(id.name())) { | |||||
| return true; | |||||
| } | |||||
| if (!id.should_be_kept()) { | |||||
| return true; | |||||
| } | |||||
| GVArray src = src_attributes.lookup(id, meta_data.domain); | |||||
JacquesLucke: Using `ATTR_DOMAIN_POINT` here seems wrong.
Generally, I'm not sure if this function is a… | |||||
Done Inline ActionsOh, thanks for catching. Yeah, I'm not convinced by it either, which is why my instinct was to keep it curve-specific. But something like this would improve a fair number of places, so maybe it's an okay first step HooglyBoogly: Oh, thanks for catching. Yeah, I'm not convinced by it either, which is why my instinct was to… | |||||
| BLI_assert(src); | |||||
| bke::GSpanAttributeWriter dst = dst_attributes.lookup_or_add_for_write_only_span( | |||||
| id, meta_data.domain, meta_data.data_type); | |||||
| BLI_assert(dst); | |||||
| attributes.append({std::move(src), meta_data, std::move(dst)}); | |||||
| return true; | |||||
| }); | |||||
| return attributes; | |||||
| } | |||||
| } // namespace blender::bke | } // namespace blender::bke | ||||
| /** \} */ | /** \} */ | ||||
Using ATTR_DOMAIN_POINT here seems wrong.
Generally, I'm not sure if this function is a great abstraction. I was thinking about how we could standardize gathering attributes to propagate a bit better, but didn't come to a conclusion yet. For now this is fine.