32 devirtualize_varray(b, [&](const auto b) {
33 for (const int i : range) {
34 if (index_map[i] != -1) {
35 a[i] = bke::attribute_math::mix2(factor, a[i], b[index_map[i]]);
48 using T = decltype(dummy);
49 mix_with_indices(a.typed<T>(), b.typed<T>(), index_map, factor);
56 devirtualize_varray(b, [&](const auto b) {
57 for (const int i : range) {
58 a[i] = bke::attribute_math::mix2(factor, a[i], b[i]);
67 using T = decltype(dummy);
68 mix(a.typed<T>(), b.typed<T>(), factor);
86 const bke::GAttributeReader attribute_a = attributes_a.
lookup(
id);
87 const bke::AttrDomain domain = attribute_a.
domain;
88 if (domain != mix_domain) {
91 const bke::AttrType type = bke::cpp_type_to_attribute_type(attribute_a.varray.type());
92 if (
ELEM(type, bke::AttrType::String, bke::AttrType::Bool)) {
96 const bke::GAttributeReader attribute_b = b_attributes.
lookup(
id, attribute_a.domain, type);
111 mix(dst.span, attribute_b.varray, factor);
122 map.
add(values[
i],
i);
133 if (!ids_a || !ids_b) {
139 if (ids_a.
domain != id_domain || ids_b.
domain != id_domain) {
152 for (const int i : range) {
153 index_map[i] = id_map_b.lookup_default(ids_span_a[i], -1);
162 if (
const Mesh *mesh_b =
b.get_mesh()) {
166 mesh_b->attributes(),
174 if (
const PointCloud *points_b =
b.get_pointcloud()) {
178 points_b->attributes(),
185 if (
const Curves *curves_b =
b.get_curves()) {
195 {
"curve_type",
"nurbs_order",
"knots_mode",
"handle_type_left",
"handle_type_right"});
203 instances_b->attributes(),
207 {
".reference_index"});
Low-level operations for curves.
const CPPType & type() const
const CPPType & type() const
VArray< T > typed() const
bool add(const Key &key, const Value &value)
constexpr IndexRange index_range() const
bool remove_as(const ForwardKey &key)
bool remove(const Key &key)
constexpr int64_t size() const
constexpr IndexRange index_range() const
constexpr bool is_empty() const
GAttributeReader lookup(const StringRef attribute_id) const
Set< StringRefNull > all_ids() const
int domain_size(const AttrDomain domain) const
GSpanAttributeWriter lookup_for_write_span(StringRef attribute_id)
void convert_to_static_type(const CPPType &cpp_type, const Func &func)
static void mix_attributes(bke::MutableAttributeAccessor attributes_a, const bke::AttributeAccessor b_attributes, const Span< int > index_map, const bke::AttrDomain mix_domain, const float factor, const Set< std::string > &names_to_skip={})
void mix_with_indices(MutableSpan< T > a, const VArray< T > &b, const Span< int > index_map, const float factor)
static Array< int > create_id_index_map(const bke::AttributeAccessor attributes_a, const bke::AttributeAccessor b_attributes, const bke::AttrDomain id_domain)
static bool sharing_info_equal(const ImplicitSharingInfo *a, const ImplicitSharingInfo *b)
bke::GeometrySet mix_geometries(bke::GeometrySet a, const bke::GeometrySet &b, float factor)
static Map< int, int > create_value_to_first_index_map(const Span< int > values)
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
const ImplicitSharingInfo * sharing_info
PointCloud * get_pointcloud_for_write()
Instances * get_instances_for_write()
Curves * get_curves_for_write()
Mesh * get_mesh_for_write()