39 devirtualize_varray(b, [&](const auto b) {
40 for (const int i : range) {
41 if (index_map[i] != -1) {
42 a[i] = bke::attribute_math::mix2(factor, a[i], b[index_map[i]]);
55 if constexpr (!std::is_same_v<T, std::string>) {
56 mix_with_indices(a.typed<T>(), b.typed<T>(), index_map, factor);
64 devirtualize_varray(b, [&](const auto b) {
65 for (const int i : range) {
66 a[i] = bke::attribute_math::mix2(factor, a[i], b[i]);
75 if constexpr (!std::is_same_v<T, std::string>) {
76 mix(a.typed<T>(), b.typed<T>(), factor);
90 for (
const StringRef name : names_to_skip) {
94 for (
const StringRef name : names) {
95 const bke::GAttributeReader attribute_a = attributes_a.
lookup(name);
96 const bke::AttrDomain domain = attribute_a.
domain;
97 if (domain != mix_domain) {
100 const bke::AttrType type = bke::cpp_type_to_attribute_type(attribute_a.varray.type());
101 if (
ELEM(type, bke::AttrType::String, bke::AttrType::Bool)) {
105 const bke::GAttributeReader attribute_b = b_attributes.
lookup(name, attribute_a.domain, type);
120 mix(dst.span, attribute_b.varray, factor);
132 if (!ids_a || !ids_b) {
138 if (ids_a.
domain != id_domain || ids_b.
domain != id_domain) {
156 id_map_b(ids_span_b);
159 for (const int i : range) {
160 index_map[i] = id_map_b.index_of_try(ids_span_a[i]);
174 if (!a_ptr || !b_ptr) {
183 if (!a_bundle_ptr || !b_bundle_ptr) {
194 else if (a.
is_list() &&
b.is_list()) {
197 if (!a_list_ref || !b_list) {
200 if (a_list_ref->
cpp_type() != b_list->cpp_type()) {
207 std::variant<GMutableSpan, GMutablePointer> a_values = a_list.
values_for_write();
208 if (
auto *a_span = std::get_if<GMutableSpan>(&a_values)) {
209 const GVArray b_varray = b_list->varray();
212 else if (
auto *a_pointer = std::get_if<GMutablePointer>(&a_values)) {
213 const GVArray b_varray = b_list->varray();
229 if (a_list->cpp_type().is<std::string>()) {
246 auto *a_socket_value = std::get_if<nodes::BundleItemSocketValue>(&a.
value);
247 if (!a_socket_value) {
250 const auto *b_socket_value = std::get_if<nodes::BundleItemSocketValue>(&
b.value);
251 if (!b_socket_value) {
259 for (
const auto &[name, a_value] : a.
items()) {
271 if (
const Mesh *mesh_b =
b.get_mesh()) {
275 mesh_b->attributes(),
283 if (
const PointCloud *points_b =
b.get_pointcloud()) {
287 points_b->attributes(),
294 if (
const Curves *curves_b =
b.get_curves()) {
304 {
"curve_type",
"nurbs_order",
"knots_mode",
"handle_type_left",
"handle_type_right"});
312 instances_b->attributes(),
316 {
".reference_index"});
Low-level operations for curves.
const CPPType * type() const
const CPPType & type() const
const CPPType * type() const
const CPPType & type() const
GVArray slice(IndexRange slice) const
VArray< T > typed() const
static GVArray from_single_ref(const CPPType &type, int64_t size, const void *value)
T & ensure_mutable_inplace()
constexpr IndexRange index_range() const
bool remove_as(const ForwardKey &key)
bool remove(const Key &key)
constexpr bool is_empty() const
Set< StringRefNull > all_names() const
GAttributeReader lookup(const StringRef name) const
int domain_size(const AttrDomain domain) const
GSpanAttributeWriter lookup_for_write_span(StringRef name)
static SocketValueVariant from(T &&value)
constexpr IndexRange index_range() const
constexpr int64_t size() const
BundleItemMap::ItemIterator items() const
const CPPType & cpp_type() const
std::variant< GMutableSpan, GMutablePointer > values_for_write()
void to_static_type(const CPPType &cpp_type, Fn &&fn)
void mix_geometries(bke::GeometrySet &a, const bke::GeometrySet &b, float factor)
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)
void mix_socket_values(bke::SocketValueVariant &a, const bke::SocketValueVariant &b, const float factor)
static bool sharing_info_equal(const ImplicitSharingInfo *a, const ImplicitSharingInfo *b)
static void mix(MutableSpan< T > a, const VArray< T > &b, const float factor)
void mix_bundles(nodes::Bundle &a, const nodes::Bundle &b, float factor)
static void mix_socket_values_same_type(bke::SocketValueVariant &a, const bke::SocketValueVariant &b, const float factor)
static void mix_bundle_items(nodes::BundleItemValue &a, const nodes::BundleItemValue &b, const float factor)
ImplicitSharingPtr< Bundle > BundlePtr
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
PythonProbingStrategy<> DefaultProbingStrategy
const ImplicitSharingInfo * sharing_info
PointCloud * get_pointcloud_for_write()
Instances * get_instances_for_write()
nodes::Bundle & bundle_for_write()
Curves * get_curves_for_write()
Mesh * get_mesh_for_write()
std::variant< BundleItemSocketValue, BundleItemInternalValue > value