Blender V5.3
node_geo_transfer_attributes.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2026 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include <fmt/format.h>
6
9
10#include "BKE_curves.hh"
11#include "BKE_grease_pencil.hh"
12#include "BKE_instances.hh"
13
14#include "DNA_curves_types.h"
16#include "DNA_mesh_types.h"
18
20#include "NOD_string_pattern.hh"
21
22#include "node_geometry_util.hh"
23
25
27{
28 b.use_custom_socket_order();
29 b.allow_any_socket_order();
30
31 auto &target_geo = b.add_input<decl::Geometry>("Target"_ustr);
32 b.add_output<decl::Geometry>("Target"_ustr).align_with_previous().propagate_all_geometry();
33 b.add_output<decl::String>("Transferred Names"_ustr)
34 .structure_type(StructureType::List)
35 .description("Attribute names that have been transferred excluding internal attributes");
36 {
37 auto &p = b.add_panel("Target IDs"_ustr).default_closed(true);
39 sockets.append(&p.add_input<decl::Int>("Target Point ID"_ustr));
40 sockets.append(&p.add_input<decl::Int>("Target Edge ID"_ustr));
41 sockets.append(&p.add_input<decl::Int>("Target Face ID"_ustr));
42 sockets.append(&p.add_input<decl::Int>("Target Corner ID"_ustr));
43 sockets.append(&p.add_input<decl::Int>("Target Curve ID"_ustr));
44 sockets.append(&p.add_input<decl::Int>("Target Instance ID"_ustr));
45
46 for (BaseSocketDeclarationBuilder *socket : sockets) {
47 socket->default_input_type(NODE_DEFAULT_INPUT_INDEX_FIELD);
48 socket->evaluated_geometry_field({target_geo.index()});
49 }
50 }
51 auto &source_geo = b.add_input<decl::Geometry>("Source"_ustr);
52 {
53 auto &p = b.add_panel("Source IDs"_ustr).default_closed(true);
55 sockets.append(&p.add_input<decl::Int>("Source Point ID"_ustr));
56 sockets.append(&p.add_input<decl::Int>("Source Edge ID"_ustr));
57 sockets.append(&p.add_input<decl::Int>("Source Face ID"_ustr));
58 sockets.append(&p.add_input<decl::Int>("Source Corner ID"_ustr));
59 sockets.append(&p.add_input<decl::Int>("Source Curve ID"_ustr));
60 sockets.append(&p.add_input<decl::Int>("Source Instance ID"_ustr));
61
62 for (BaseSocketDeclarationBuilder *socket : sockets) {
63 socket->default_input_type(NODE_DEFAULT_INPUT_INDEX_FIELD);
64 socket->evaluated_geometry_field({source_geo.index()});
65 }
66 }
67
68 b.add_input<decl::Menu>("Pattern Mode"_ustr)
69 .static_items(string_pattern_mode_items)
71 .optional_label();
72 b.add_input<decl::String>("Attribute Names"_ustr)
73 .optional_label()
74 .structure_type(StructureType::List)
75 .description(
76 "List of attribute names (not) to transfer. A wildcard (*) at the end is allowed");
77 b.add_input<decl::Bool>("Exclude Names"_ustr)
78 .default_value(false)
79 .description("Transfer all attributes except the ones matching any of the names");
80}
81
82static bool should_transfer(const Span<StringPattern> patterns,
83 const bke::AttrDomain domain,
84 const StringRef name,
85 const bool exclude_names,
86 MutableSpan<bool> r_found_attribute_using_pattern)
87{
88 switch (domain) {
90 if (ELEM(name, ".edge_verts")) {
91 return false;
92 }
93 break;
95 if (ELEM(name, ".corner_vert", ".corner_edge")) {
96 return false;
97 }
98 break;
100 if (ELEM(name, ".reference_index")) {
101 return false;
102 }
103 break;
104
105 default:
106 break;
107 }
108 bool match_found = false;
109 for (const int pattern_i : patterns.index_range()) {
110 const StringPattern &pattern = patterns[pattern_i];
111 if (pattern.match(name)) {
112 match_found = true;
113 r_found_attribute_using_pattern[pattern_i] = true;
114 }
115 }
116 if (exclude_names) {
117 return !match_found;
118 }
119 return match_found;
120}
121
127 const StringRef name,
128 const AttrDomain domain,
129 const bke::AttrType type,
131 const bool replace_existing)
132{
133 auto *sharing_info = new ImplicitSharedValue<GArray<>>(std::move(array));
134 const bke::AttributeInitShared init(sharing_info->data.data(), *sharing_info);
135 const bool success = replace_existing ? attributes.add_override(name, domain, type, init) :
136 attributes.add(name, domain, type, init);
137 sharing_info->remove_user_and_delete_if_last();
138 return success;
139}
140
142 const Span<StringPattern> patterns,
143 const bool exclude_names,
144 const bke::AttributeAccessor &src_attributes,
145 bke::MutableAttributeAccessor &dst_attributes,
146 const Map<bke::AttrDomain, Field<int>> &src_id_fields,
147 const Map<bke::AttrDomain, Field<int>> &dst_id_fields,
149 create_src_context,
151 create_dst_context,
152 VectorSet<std::string> &r_transferred_names,
153 MutableSpan<bool> r_found_attribute_using_pattern)
154{
155 struct AttrItem {
156 StringRef name;
157 AttrDomain domain;
158 bke::AttrType type;
159 };
160 struct IDs {
161 bool transfer_by_index = false;
162 Array<int> src_by_dst_index;
163 IndexMask gather_mask;
164 IndexMask default_mask;
165 };
166 Map<bke::AttrDomain, IDs> ids_by_domain;
167 Vector<AttrItem> items;
168 src_attributes.foreach_attribute([&](const bke::AttributeIter &iter) {
169 if (should_transfer(
170 patterns, iter.domain, iter.name, exclude_names, r_found_attribute_using_pattern))
171 {
172 items.append({iter.name, iter.domain, iter.data_type});
173 ids_by_domain.lookup_or_add_default(iter.domain);
174 }
175 });
176
177 ResourceScope scope;
178 for (const auto &[domain, ids] : ids_by_domain.items()) {
179 const Field<int> &src_id_field = src_id_fields.lookup(domain);
180 const Field<int> &dst_id_field = dst_id_fields.lookup(domain);
181 if (src_id_field.get_input_if<fn::IndexFieldInput>() &&
182 dst_id_field.get_input_if<fn::IndexFieldInput>())
183 {
184 ids.transfer_by_index = true;
185 continue;
186 }
187
188 const int src_size = src_attributes.domain_size(domain);
189 const int dst_size = dst_attributes.domain_size(domain);
190
191 fn::FieldContext &src_field_context = create_src_context(scope, domain);
192 fn::FieldEvaluator src_evaluator(src_field_context, src_size);
193 src_evaluator.add(src_id_field);
194 src_evaluator.evaluate();
195 const VArraySpan<int> src_ids = src_evaluator.get_evaluated<int>(0);
196
197 fn::FieldContext &dst_field_context = create_dst_context(scope, domain);
198 fn::FieldEvaluator dst_evaluator(dst_field_context, dst_size);
199 dst_evaluator.add(dst_id_field);
200 dst_evaluator.evaluate();
201 const VArraySpan<int> dst_ids = dst_evaluator.get_evaluated<int>(0);
202
203 Map<int, int> src_index_by_id;
204 for (const int i : IndexRange(src_size)) {
205 const int id = src_ids[i];
206 src_index_by_id.add(id, i);
207 }
208 ids.src_by_dst_index.reinitialize(dst_size);
209 threading::parallel_for(IndexRange(dst_size), 2048, [&](const IndexRange range) {
210 for (const int dst_i : range) {
211 const int dst_id = dst_ids[dst_i];
212 const int src_i = src_index_by_id.lookup_default(dst_id, -1);
213 ids.src_by_dst_index[dst_i] = src_i;
214 }
215 });
216 ids.gather_mask = array_utils::indices_non_negative(
217 IndexMask(dst_size), ids.src_by_dst_index, scope.allocator());
218 ids.default_mask = ids.gather_mask.complement(IndexMask(dst_size), scope.allocator());
219 }
220
221 for (const AttrItem &item : items) {
222 const bke::GAttributeReader src_attr = src_attributes.lookup(item.name);
223 const CommonVArrayInfo info = src_attr.varray.common_info();
224 const IDs &ids = ids_by_domain.lookup(item.domain);
225 const CPPType &type = src_attr.varray.type();
226
227 const int src_size = src_attr.varray.size();
228 const int dst_size = dst_attributes.domain_size(item.domain);
229
230 const std::optional<bke::AttributeMetaData> old_dst_meta = dst_attributes.lookup_meta_data(
231 item.name);
232 const bool has_matching_existing_attribute = old_dst_meta.has_value() &&
233 old_dst_meta->domain == item.domain &&
234 old_dst_meta->data_type == item.type;
235
236 if (!type.is_trivial) {
237 /* Non-trivial types are disabled for now because the behavior of the gather function
238 * regarding uninitialized data needs to be more well defined. */
239 continue;
240 }
241
242 /* When the source and destination ids are just the index field transfers can be more
243 * efficient. */
244 if (ids.transfer_by_index) {
245 /* Try to store the destination attribute as single value. */
247 if (src_size >= dst_size) {
248 if (dst_attributes.add_override(
249 item.name, item.domain, item.type, bke::AttributeInitValue({type, info.data})))
250 {
251 r_transferred_names.add(item.name);
252 continue;
253 }
254 }
255 }
256
257 /* Try to share the data with an existing attribute. */
258 if (src_attr.sharing_info && info.type == CommonVArrayInfo::Type::Span &&
259 src_size == dst_size)
260 {
261 if (dst_attributes.add_override(
262 item.name,
263 item.domain,
264 item.type,
266 {
267 r_transferred_names.add(item.name);
268 continue;
269 }
270 }
271
272 const int copy_num = std::min(src_size, dst_size);
273 const IndexRange copy_slice(copy_num);
274
275 /* Values of an existing attribute need to be kept unless they are transferred. */
276 if (old_dst_meta.has_value()) {
277 if (has_matching_existing_attribute) {
278 /* Just copy the new data to the start of the existing attribute, without changing the
279 * values at larger indices. */
280 bke::GSpanAttributeWriter dst_attr = dst_attributes.lookup_for_write_span(item.name);
281 BLI_assert(dst_attr);
282 array_utils::copy(src_attr.varray.slice(copy_slice), dst_attr.span.slice(copy_slice));
283 dst_attr.finish();
284 r_transferred_names.add(item.name);
285 continue;
286 }
287 /* Create a new array for the correct domain and type, copy the transferred values and
288 * leave the rest at the old value. */
289 const bke::GAttributeReader adapted_old_dst = dst_attributes.lookup(
290 item.name, item.domain, item.type);
291 if (!adapted_old_dst) {
292 continue;
293 }
294 GArray<> dst_data(type, dst_size, NoInitialization());
295 src_attr.varray.materialize_to_uninitialized(copy_slice, dst_data.data());
296 adapted_old_dst.varray.materialize_to_uninitialized(
297 IndexRange(dst_size).drop_front(copy_num), dst_data.data());
299 dst_attributes, item.name, item.domain, item.type, std::move(dst_data), true))
300 {
301 r_transferred_names.add(item.name);
302 }
303 continue;
304 }
305
306 /* Create a new array, copy the first few elements and fill the rest with the defaults. */
307 GArray<> dst_data(type, dst_size, NoInitialization());
308 array_utils::copy(src_attr.varray.slice(copy_slice),
309 dst_data.as_mutable_span().slice(copy_slice));
311 type.default_value(), dst_data.data(), IndexRange(dst_size).drop_front(copy_num));
313 dst_attributes, item.name, item.domain, item.type, std::move(dst_data), false))
314 {
315 r_transferred_names.add(item.name);
316 }
317 continue;
318 }
319
320 /* If all indices are transferred, the old attribute can be ignored. */
321 if (ids.gather_mask.size() == dst_size) {
322 /* The dst attribute can be a single value when the source is a single value since each
323 * element is copied from the source. */
325 if (dst_attributes.add_override(
326 item.name, item.domain, item.type, bke::AttributeInitValue({type, info.data})))
327 {
328 r_transferred_names.add(item.name);
329 continue;
330 }
331 }
332 /* Try writing into an existing attribute buffer. */
333 if (has_matching_existing_attribute) {
335 item.name, item.domain, item.type);
336 BLI_assert(dst_attr);
337 bke::attribute_math::gather(*src_attr, ids.src_by_dst_index, dst_attr.span);
338 dst_attr.finish();
339 r_transferred_names.add(item.name);
340 continue;
341 }
342 /* Create a new array for the attribute. */
343 GArray<> dst_data(type, dst_size, NoInitialization());
344 bke::attribute_math::gather(*src_attr, ids.src_by_dst_index, dst_data.as_mutable_span());
346 dst_attributes, item.name, item.domain, item.type, std::move(dst_data), true))
347 {
348 r_transferred_names.add(item.name);
349 }
350 continue;
351 }
352
353 /* A subset of the indices are transferred, first try to write them into an existing array. */
354 if (has_matching_existing_attribute) {
356 item.name, item.domain, item.type);
357 BLI_assert(dst_attr);
358 bke::attribute_math::gather(*src_attr, ids.src_by_dst_index, ids.gather_mask, dst_attr.span);
359 dst_attr.finish();
360 r_transferred_names.add(item.name);
361 continue;
362 }
363 if (!old_dst_meta) {
364 GArray<> dst_data(type, dst_size, NoInitialization());
366 *src_attr, ids.src_by_dst_index, ids.gather_mask, dst_data.as_mutable_span());
367 type.fill_construct_indices(type.default_value(), dst_data.data(), ids.default_mask);
369 dst_attributes, item.name, item.domain, item.type, std::move(dst_data), false))
370 {
371 r_transferred_names.add(item.name);
372 }
373 continue;
374 }
375 const bke::GAttributeReader adapted_old_dst = dst_attributes.lookup(
376 item.name, item.domain, item.type);
377 if (!adapted_old_dst) {
378 continue;
379 }
380 GArray<> dst_data(type, dst_size, NoInitialization());
382 src_attr.varray, ids.src_by_dst_index, ids.gather_mask, dst_data.as_mutable_span());
383 adapted_old_dst.varray.materialize_to_uninitialized(ids.default_mask, dst_data.data());
385 dst_attributes, item.name, item.domain, item.type, std::move(dst_data), true))
386 {
387 r_transferred_names.add(item.name);
388 }
389 }
390}
391
393{
394 GeometrySet dst_geo = params.extract_input<GeometrySet>("Target"_ustr);
395 GeometrySet src_geo = params.extract_input<GeometrySet>("Source"_ustr);
396 const StringPatternMode pattern_mode = params.extract_input<StringPatternMode>(
397 "Pattern Mode"_ustr);
398 const GListPtr attribute_patterns_list = params.extract_input<GListPtr>("Attribute Names"_ustr);
399 const bool exclude_names = params.extract_input<bool>("Exclude Names"_ustr);
400
401 Map<bke::AttrDomain, Field<int>> dst_id_fields = {
402 {AttrDomain::Point, params.extract_input<Field<int>>("Target Point ID"_ustr)},
403 {AttrDomain::Edge, params.extract_input<Field<int>>("Target Edge ID"_ustr)},
404 {AttrDomain::Face, params.extract_input<Field<int>>("Target Face ID"_ustr)},
405 {AttrDomain::Corner, params.extract_input<Field<int>>("Target Corner ID"_ustr)},
406 {AttrDomain::Curve, params.extract_input<Field<int>>("Target Curve ID"_ustr)},
407 {AttrDomain::Instance, params.extract_input<Field<int>>("Target Instance ID"_ustr)},
408 };
409
410 Map<bke::AttrDomain, Field<int>> src_id_fields{
411 {AttrDomain::Point, params.extract_input<Field<int>>("Source Point ID"_ustr)},
412 {AttrDomain::Edge, params.extract_input<Field<int>>("Source Edge ID"_ustr)},
413 {AttrDomain::Face, params.extract_input<Field<int>>("Source Face ID"_ustr)},
414 {AttrDomain::Corner, params.extract_input<Field<int>>("Source Corner ID"_ustr)},
415 {AttrDomain::Curve, params.extract_input<Field<int>>("Source Curve ID"_ustr)},
416 {AttrDomain::Instance, params.extract_input<Field<int>>("Source Instance ID"_ustr)},
417 };
418
419 Vector<StringPattern> patterns;
420 bool has_error = false;
421 if (attribute_patterns_list) {
422 if (attribute_patterns_list->cpp_type().is<std::string>()) {
423 attribute_patterns_list.typed<std::string>()->foreach([&](const std::string &pattern) {
424 std::string error;
425 if (std::optional<StringPattern> pattern_fn = StringPattern::from_str(
426 pattern_mode, pattern, error))
427 {
428 patterns.append(std::move(*pattern_fn));
429 }
430 else {
432 has_error = true;
433 }
434 });
435 }
436 }
437
438 if (has_error || (patterns.is_empty() && !exclude_names)) {
439 params.set_output("Target"_ustr, std::move(dst_geo));
440 params.set_output("Transferred Names"_ustr, GList::from_container(Array<std::string>()));
441 return;
442 }
443
444 VectorSet<std::string> transferred_names;
445 Array<bool> found_attribute_using_pattern(patterns.size(), false);
450 {
451 if (!dst_geo.has(type)) {
452 continue;
453 }
454 if (!src_geo.has(type)) {
455 continue;
456 }
457 const GeometryComponent &src_component = *src_geo.get_component(type);
458 GeometryComponent &dst_component = dst_geo.get_component_for_write(type);
459 const bke::AttributeAccessor src_attributes = *src_component.attributes();
460 bke::MutableAttributeAccessor dst_attributes = *dst_component.attributes_for_write();
462 patterns,
463 exclude_names,
464 src_attributes,
465 dst_attributes,
466 src_id_fields,
467 dst_id_fields,
468 [&](ResourceScope &scope, const bke::AttrDomain domain) -> fn::FieldContext & {
469 return scope.construct<bke::GeometryFieldContext>(src_component, domain);
470 },
471 [&](ResourceScope &scope, const bke::AttrDomain domain) -> fn::FieldContext & {
472 return scope.construct<bke::GeometryFieldContext>(dst_component, domain);
473 },
474 transferred_names,
475 found_attribute_using_pattern);
476 }
477
478 if (src_geo.has_grease_pencil() && dst_geo.has_grease_pencil()) {
479 using namespace bke::greasepencil;
480 const GreasePencil &src_grease_pencil = *src_geo.get_grease_pencil();
481 GreasePencil &dst_grease_pencil = *dst_geo.get_grease_pencil_for_write();
482 const int src_layer_num = src_grease_pencil.layers().size();
483 const int dst_layer_num = dst_grease_pencil.layers().size();
484 /* Could also support custom mapping of src to dst layers. */
485 const int common_layer_num = std::min(src_layer_num, dst_layer_num);
486 for (const int layer_i : IndexRange(common_layer_num)) {
487 const Layer &src_layer = src_grease_pencil.layer(layer_i);
488 const Drawing *src_drawing = src_grease_pencil.get_eval_drawing(src_layer);
489 if (!src_drawing) {
490 continue;
491 }
492 Layer &dst_layer = dst_grease_pencil.layer(layer_i);
493 Drawing *dst_drawing = dst_grease_pencil.get_eval_drawing(dst_layer);
494 if (!dst_drawing) {
495 continue;
496 }
497 const bke::CurvesGeometry &src_curves = src_drawing->strokes();
498 bke::CurvesGeometry &dst_curves = dst_drawing->strokes_for_write();
499 const bke::AttributeAccessor src_attributes = src_curves.attributes();
500 bke::MutableAttributeAccessor dst_attributes = dst_curves.attributes_for_write();
502 patterns,
503 exclude_names,
504 src_attributes,
505 dst_attributes,
506 src_id_fields,
507 dst_id_fields,
508 [&](ResourceScope &scope, const bke::AttrDomain domain) -> fn::FieldContext & {
510 src_grease_pencil, domain, layer_i);
511 },
512 [&](ResourceScope &scope, const bke::AttrDomain domain) -> fn::FieldContext & {
514 dst_grease_pencil, domain, layer_i);
515 },
516 transferred_names,
517 found_attribute_using_pattern);
518 }
519 }
520
521 transferred_names.remove_if([&](const StringRef name) { return name.startswith("."); });
522
523 if (!exclude_names) {
524 for (const int pattern_i : patterns.index_range()) {
525 const StringRef full_pattern = patterns[pattern_i].full_pattern();
526 if (full_pattern.is_empty()) {
527 continue;
528 }
529 if (found_attribute_using_pattern[pattern_i]) {
530 continue;
531 }
533 fmt::format("{} \"{}\"",
534 TIP_("No attribute found matching"),
535 patterns[pattern_i].full_pattern()));
536 }
537 }
538
539 params.set_output("Target"_ustr, std::move(dst_geo));
540 params.set_output("Transferred Names"_ustr,
541 GList::from_container(transferred_names.extract_vector()));
542}
543
544static void node_register()
545{
546 static bke::bNodeType ntype;
547
548 geo_node_type_base(&ntype, "GeometryNodeTransferAttributes"_ustr);
549 ntype.ui_name = "Transfer Attributes";
550 ntype.ui_description = "Copy attributes from one geometry to another";
553 ntype.declare = node_declare;
556}
558
559} // namespace blender::nodes::node_geo_transfer_attributes_cc
Low-level operations for curves.
Low-level operations for grease pencil.
#define NODE_CLASS_GEOMETRY
Definition BKE_node.hh:492
#define TIP_(msgid)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define ELEM(...)
void fill_construct_indices(const void *value, void *dst, const IndexMask &mask) const
const void * default_value() const
GMutableSpan as_mutable_span()
const void * data() const
GMutableSpan slice(const int64_t start, int64_t size) const
CommonVArrayInfo common_info() const
void materialize_to_uninitialized(void *dst) const
GVArray slice(IndexRange slice) const
constexpr IndexRange()=default
Value & lookup_or_add_default(const Key &key)
Definition BLI_map.hh:639
const Value & lookup(const Key &key) const
Definition BLI_map.hh:545
ItemIterator items() const &
Definition BLI_map.hh:902
T & construct(Args &&...args)
LinearAllocator & allocator()
constexpr IndexRange index_range() const
Definition BLI_span.hh:405
bool add(const Key &key)
int64_t remove_if(Predicate &&predicate)
int64_t size() const
void append(const T &value)
bool is_empty() const
IndexRange index_range() const
void foreach_attribute(const FunctionRef< void(const AttributeIter &)> fn) const
std::optional< AttributeMetaData > lookup_meta_data(StringRef name) const
GAttributeReader lookup(const StringRef name) const
int domain_size(const AttrDomain domain) const
AttributeAccessor attributes() const
MutableAttributeAccessor attributes_for_write()
virtual std::optional< AttributeAccessor > attributes() const
virtual std::optional< MutableAttributeAccessor > attributes_for_write()
bool add(const StringRef name, const AttrDomain domain, const AttrType data_type, const AttributeInit &initializer)
GSpanAttributeWriter lookup_or_add_for_write_span(StringRef name, AttrDomain domain, AttrType data_type, const AttributeInit &initializer=AttributeInitDefaultValue())
GSpanAttributeWriter lookup_or_add_for_write_only_span(StringRef name, AttrDomain domain, AttrType data_type)
bool add_override(const StringRef name, const AttrDomain domain, const AttrType data_type, const AttributeInit &initializer)
GSpanAttributeWriter lookup_for_write_span(StringRef name)
bke::CurvesGeometry & strokes_for_write()
const bke::CurvesGeometry & strokes() const
constexpr bool startswith(StringRef prefix) const
constexpr bool is_empty() const
int add(GField field, GVArray *varray_ptr)
const GVArray & get_evaluated(const int field_index) const
const InputT * get_input_if() const
Definition FN_field.hh:649
static GListPtr from_container(ContainerT &&container)
void error_message_add(const NodeWarningType type, StringRef message) const
T extract_input(const UString identifier)
void set_output(const UString identifier, T &&value)
bool match(StringRef query) const
static std::optional< StringPattern > from_str(StringPatternMode mode, StringRef pattern, std::string &r_error)
IndexMask indices_non_negative(const IndexMask &universe, Span< int > values, LinearAllocator<> &memory)
void copy(const GVArray &src, GMutableSpan dst, exec_mode::Mode mode=exec_mode::parallel)
void gather(GSpan src, Span< int > map, GMutableSpan dst)
void node_register_type(bNodeType &ntype)
Definition node.cc:2920
static bool should_transfer(const Span< StringPattern > patterns, const bke::AttrDomain domain, const StringRef name, const bool exclude_names, MutableSpan< bool > r_found_attribute_using_pattern)
static bool add_attribute_with_array(bke::MutableAttributeAccessor &attributes, const StringRef name, const AttrDomain domain, const bke::AttrType type, GArray<> array, const bool replace_existing)
static void transfer_attributes(const Span< StringPattern > patterns, const bool exclude_names, const bke::AttributeAccessor &src_attributes, bke::MutableAttributeAccessor &dst_attributes, const Map< bke::AttrDomain, Field< int > > &src_id_fields, const Map< bke::AttrDomain, Field< int > > &dst_id_fields, FunctionRef< fn::FieldContext &(ResourceScope &scope, const bke::AttrDomain domain)> create_src_context, FunctionRef< fn::FieldContext &(ResourceScope &scope, const bke::AttrDomain domain)> create_dst_context, VectorSet< std::string > &r_transferred_names, MutableSpan< bool > r_found_attribute_using_pattern)
const EnumPropertyItem string_pattern_mode_items[]
void parallel_for(const IndexRange range, const int64_t grain_size, const Function &function, const TaskSizeHints &size_hints=detail::TaskSizeHints_Static(1))
Definition BLI_task.hh:69
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
void geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
const ImplicitSharingInfo * sharing_info
GeometryComponent & get_component_for_write(GeometryComponent::Type component_type)
bool has(const GeometryComponent::Type component_type) const
GreasePencil * get_grease_pencil_for_write()
static constexpr int _160
Definition BKE_node.hh:246
Defines a node type.
Definition BKE_node.hh:265
std::string ui_description
Definition BKE_node.hh:271
NodeGeometryExecFunction geometry_node_execute
Definition BKE_node.hh:385
NodeDeclareFunction declare
Definition BKE_node.hh:393