Blender V5.3
node_geo_evaluate_closure.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2025 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include <fmt/format.h>
6
7#include "DNA_userdef_types.h"
8
10#include "UI_resources.hh"
11
12#include "NOD_geo_closure.hh"
19#include "NOD_sync_sockets.hh"
20
23#include "BKE_idprop.hh"
26
27#include "BLO_read_write.hh"
28
29#include "COM_closure.hh"
31#include "COM_node_operation.hh"
32#include "COM_utilities.hh"
34
35#include "node_geometry_util.hh"
37
38namespace blender {
39
41
43
45{
48 rl::RelationsInNode &relations = b.get_reference_lifetime_relations();
49 const NodeDeclaration &node_decl = b.declaration();
50 for (const SocketDeclaration *input : node_decl.inputs) {
51 if (can_contain_reference(input->socket_type)) {
52 for (const SocketDeclaration *other_input : node_decl.inputs) {
53 if (can_contain_referenced_data(other_input->socket_type)) {
54 relations.use_relations.append({input->index, other_input->index});
55 }
56 }
57 for (const SocketDeclaration *output : node_decl.outputs) {
58 if (can_contain_reference(output->socket_type)) {
59 relations.reference_propagations.append({input->index, output->index});
60 }
61 }
62 }
63 if (can_contain_referenced_data(input->socket_type)) {
64 for (const SocketDeclaration *output : node_decl.outputs) {
65 if (can_contain_referenced_data(output->socket_type)) {
66 relations.data_propagations.append({input->index, output->index});
67 }
68 }
69 }
70 }
71 for (const SocketDeclaration *output : node_decl.outputs) {
72 if (can_contain_reference(output->socket_type)) {
73 for (const SocketDeclaration *other_output : node_decl.outputs) {
74 if (can_contain_referenced_data(other_output->socket_type)) {
75 relations.available_relations.append({output->index, other_output->index});
76 }
77 }
78 }
79 }
80}
81
83{
84 b.use_custom_socket_order();
85 b.allow_any_socket_order();
86
87 b.add_input<decl::Closure>("Closure"_ustr).create_signature([](const bNode &node) {
88 const auto &storage = node_storage(node);
91 });
92
93 const bNode *node = b.node_or_null();
94 const bNodeTree *tree = b.tree_or_null();
95 auto &panel = b.add_panel("Interface"_ustr);
96 if (node) {
97 const auto &storage = node_storage(*node);
98 for (const int i : IndexRange(storage.output_items.items_num)) {
99 const NodeEvaluateClosureOutputItem &item = storage.output_items.items[i];
100 const eNodeSocketDatatype socket_type = item.socket_type;
101 const UString identifier(
103 auto &decl = panel.add_output(socket_type, UString(item.name), identifier);
104 decl.socket_name_ptr(
105 &tree->id, *EvaluateClosureOutputItemsAccessor::item_srna, &item, "name");
107 decl.structure_type(StructureType(item.structure_type));
108 }
109 else {
110 decl.structure_type(StructureType::Dynamic);
111 }
112 }
113 panel.add_output<decl::Extend>(""_ustr, "__extend__"_ustr)
114 .custom_draw(
115 socket_items::ui::draw_extend_socket_fn<EvaluateClosureOutputItemsAccessor>());
116 for (const int i : IndexRange(storage.input_items.items_num)) {
117 const NodeEvaluateClosureInputItem &item = storage.input_items.items[i];
118 const eNodeSocketDatatype socket_type = item.socket_type;
119 const UString identifier(
121 auto &decl = panel.add_input(socket_type, UString(item.name), identifier);
122 decl.socket_name_ptr(
123 &tree->id, *EvaluateClosureInputItemsAccessor::item_srna, &item, "name");
125 decl.structure_type(StructureType(item.structure_type));
126 }
127 else {
128 decl.structure_type(StructureType::Dynamic);
129 }
130 decl.compositor_realization_mode(CompositorInputRealizationMode::None);
131 }
132 panel.add_input<decl::Extend>(""_ustr, "__extend__"_ustr)
133 .custom_draw(socket_items::ui::draw_extend_socket_fn<EvaluateClosureInputItemsAccessor>());
134
135 /* This creates all possible reference lifetime relations because the closure could do
136 * anything. */
138 }
139}
140
141static void node_init(bNodeTree * /*tree*/, bNode *node)
142{
143 auto *storage = MEM_new<NodeEvaluateClosure>(__func__);
144 node->storage = storage;
145}
146
147static void node_copy_storage(bNodeTree * /*tree*/, bNode *dst_node, const bNode *src_node)
148{
149 const NodeEvaluateClosure &src_storage = node_storage(*src_node);
150 auto *dst_storage = MEM_new<NodeEvaluateClosure>(__func__, dna::shallow_copy(src_storage));
151 dst_node->storage = dst_storage;
152
155}
156
163
165{
166 if (params.C && params.link.tosock == params.node.inputs.first_ &&
167 params.link.fromsock->type == SOCK_CLOSURE)
168 {
169 const NodeEvaluateClosure &storage = node_storage(params.node);
170 if (storage.input_items.items_num == 0 && storage.output_items.items_num == 0) {
171 SpaceNode *snode = CTX_wm_space_node(params.C);
172 if (snode && snode->edittree == &params.ntree) {
173 sync_sockets_evaluate_closure(*snode, params.node, nullptr, params.link.fromsock);
174 }
175 }
176 return true;
177 }
178 if (params.link.tonode == &params.node) {
180 params.ntree, params.node, params.node, params.link);
181 }
183 params.ntree, params.node, params.node, params.link);
184}
185
186static void node_layout_ex(ui::Layout &layout, bContext *C, PointerRNA *ptr)
187{
188 bNodeTree &tree = *reinterpret_cast<bNodeTree *>(ptr->owner_id);
189 bNode &node = *static_cast<bNode *>(ptr->data);
190
191 layout.use_property_split_set(true);
192 layout.use_property_decorate_set(false);
193
194 layout.op("node.sockets_sync", IFACE_("Sync"), ICON_FILE_REFRESH);
195 layout.prop(ptr, "define_signature", UI_ITEM_NONE, std::nullopt, ICON_NONE);
196
197 if (ui::Layout *panel = layout.panel(C, "input_items", false, IFACE_("Input Items"))) {
198 socket_items::ui::draw_items_list_with_operators<EvaluateClosureInputItemsAccessor>(
199 C, panel, tree, node);
200 socket_items::ui::draw_active_item_props<EvaluateClosureInputItemsAccessor>(
201 tree, node, [&](PointerRNA *item_ptr) {
202 panel->use_property_split_set(true);
203 panel->use_property_decorate_set(false);
204 panel->prop(item_ptr, "socket_type", UI_ITEM_NONE, std::nullopt, ICON_NONE);
205 panel->prop(item_ptr, "structure_type", UI_ITEM_NONE, IFACE_("Shape"), ICON_NONE);
206 });
207 }
208 if (ui::Layout *panel = layout.panel(C, "output_items", false, IFACE_("Output Items"))) {
209 socket_items::ui::draw_items_list_with_operators<EvaluateClosureOutputItemsAccessor>(
210 C, panel, tree, node);
211 socket_items::ui::draw_active_item_props<EvaluateClosureOutputItemsAccessor>(
212 tree, node, [&](PointerRNA *item_ptr) {
213 panel->use_property_split_set(true);
214 panel->use_property_decorate_set(false);
215 panel->prop(item_ptr, "socket_type", UI_ITEM_NONE, std::nullopt, ICON_NONE);
216 panel->prop(item_ptr, "structure_type", UI_ITEM_NONE, IFACE_("Shape"), ICON_NONE);
217 });
218 }
219}
220
222 const bNode & /*node*/,
223 const bNodeSocket &output_socket)
224{
226}
227
229{
230 const bNodeSocket &other_socket = params.other_socket();
231 if (other_socket.in_out == SOCK_IN) {
232 params.add_item(IFACE_("Item"), [](LinkSearchOpParams &params) {
233 bNode &node = params.add_node("NodeEvaluateClosure"_ustr);
234 const auto *item =
236 params.node_tree, node, params.socket.typeinfo->type, params.socket.name);
238 });
239 return;
240 }
241 if (other_socket.type == SOCK_CLOSURE) {
242 params.add_item(IFACE_("Closure"), [](LinkSearchOpParams &params) {
243 bNode &node = params.add_node("NodeEvaluateClosure"_ustr);
244 params.connect_available_socket(node, "Closure"_ustr);
245
246 SpaceNode &snode = *CTX_wm_space_node(&params.C);
247 sync_sockets_evaluate_closure(snode, node, nullptr);
248 });
249 }
251 params.node_tree().type))
252 {
253 params.add_item(
254 IFACE_("Item"),
255 [](LinkSearchOpParams &params) {
256 bNode &node = params.add_node("NodeEvaluateClosure"_ustr);
257 const auto *item =
259 params.node_tree, node, params.socket.typeinfo->type, params.socket.name);
263 },
264 other_socket.type == SOCK_CLOSURE ? -1 : 0);
265 }
266}
267
273
279
285
286using namespace blender::compositor;
287
289 public:
291
292 void execute() override
293 {
294 const compositor::ClosurePtr closure =
295 this->get_input("Closure").get_single_value<compositor::ClosurePtr>();
296 if (!closure) {
297 this->write_default_outputs();
298 return;
299 }
300
301 if (this->get_compute_context().parents_num() >= U.nodes_stack_limit) {
303 TIP_("Stack limit reached. Closure becomes pass-through."));
304 this->write_default_outputs();
305 return;
306 }
307
308 const ClosureSourceLocation closure_source_location{&closure->zone.output_node()->owner_tree(),
309 closure->zone.output_node()->identifier,
310 closure->compute_context.hash(),
311 &closure->compute_context};
312 const bke::EvaluateClosureComputeContext &evaluate_closure_context =
313 this->context().compute_context_cache().for_evaluate_closure(&this->get_compute_context(),
314 this->node().identifier,
315 &this->node().owner_tree(),
316 closure_source_location);
317 ZoneTreeOperation zone_tree_operation = ZoneTreeOperation(
318 this->context(), closure->zone, evaluate_closure_context);
319 this->set_reference_counts(zone_tree_operation, closure);
320 Vector<std::unique_ptr<Result>> inputs = this->map_inputs(zone_tree_operation, closure);
322 zone_tree_operation, closure);
323 zone_tree_operation.evaluate();
324 this->write_outputs(zone_tree_operation, closure);
326 }
327
328 /* Write a default value for each of the needed outputs, if an input with the same name and type
329 * as the output exists, the output shares the value of that input, otherwise, the output is
330 * default initialized. */
332 {
333 for (const bNodeSocket *output : this->node().output_sockets()) {
335 continue;
336 }
337
338 Result &result = this->get_result(output->identifier);
339 if (!result.should_compute()) {
340 continue;
341 }
342
343 const bNodeSocket *matching_input = bke::node_find_enabled_input_socket(
344 const_cast<bNode &>(this->node()), output->name);
345 if (!matching_input) {
346 continue;
347 }
348
349 Result &input = this->get_input(matching_input->identifier);
350 if (input.type() != result.type()) {
351 continue;
352 }
353
354 result.share_data(input);
355 }
356
358 }
359
360 /* Setup the reference count of each of the outputs of the given zone tree operation of the given
361 * closure. This is either 0 or 1 depending on whether a corresponding output with the same name
362 * exists in the evaluate node and is needed. If no corresponding output exists, the zone output
363 * will not be used. */
364 void set_reference_counts(ZoneTreeOperation &zone_tree_operation,
365 const compositor::ClosurePtr &closure)
366 {
367 for (const bNodeSocket *zone_output : closure->zone.output_node()->input_sockets()) {
368 if (!is_socket_available(zone_output)) {
369 continue;
370 }
371
372 Result &zone_result = zone_tree_operation.get_result(zone_output->identifier);
373 const bNodeSocket *evaluate_node_output = bke::node_find_enabled_output_socket(
374 const_cast<bNode &>(this->node()), zone_output->name);
375 if (!evaluate_node_output) {
376 zone_result.set_reference_count(0);
377 continue;
378 }
379
380 Result &evaluate_node_result = this->get_result(evaluate_node_output->identifier);
381 zone_result.set_reference_count(evaluate_node_result.should_compute() ? 1 : 0);
382 }
383 }
384
385 /* Map each input of the zone tree operation for the given closure to the input we get from the
386 * evaluate node. If no input corresponding input with the same name in the evaluate node is
387 * found, a default value is mapped. The mapped inputs are returned. */
389 const compositor::ClosurePtr &closure)
390 {
391 Vector<std::unique_ptr<Result>> temporary_inputs;
392 for (const bNodeSocket *zone_input : closure->zone.input_node()->output_sockets()) {
393 if (!is_socket_available(zone_input)) {
394 continue;
395 }
396
397 const bNodeSocket *evaluate_node_input = bke::node_find_enabled_input_socket(
398 const_cast<bNode &>(this->node()), zone_input->name);
399 if (!evaluate_node_input) {
400 const ResultType zone_input_type = get_node_socket_result_type(zone_input);
401 std::unique_ptr<Result> temporary_input = std::make_unique<Result>(
402 this->context().create_result(zone_input_type));
403 temporary_input->allocate_invalid();
404 temporary_inputs.append(std::move(temporary_input));
405 zone_tree_operation.map_input_to_result(zone_input->identifier,
406 temporary_inputs.last().get());
407 continue;
408 }
409
410 const Result &input_result = this->get_input(evaluate_node_input->identifier);
411 std::unique_ptr<Result> temporary_input = std::make_unique<Result>(
412 this->context().create_result(input_result.type(), input_result.precision()));
413 temporary_input->share_data(input_result);
414 temporary_inputs.append(std::move(temporary_input));
415 zone_tree_operation.map_input_to_result(zone_input->identifier,
416 temporary_inputs.last().get());
417 }
418 return temporary_inputs;
419 }
420
421 /* Map each captured value from the closure to its corresponding input of the zone tree
422 * operation. The mapped captured inputs are returned. */
424 const compositor::ClosurePtr &closure)
425 {
426 Vector<std::unique_ptr<Result>> temporary_inputs;
427 for (const auto &item : closure->captured_values.items()) {
428 const std::string &identifier = item.key;
429 const Result *value = item.value;
430 std::unique_ptr<Result> temporary_input = std::make_unique<Result>(
431 this->context().create_result(value->type(), value->precision()));
432 temporary_input->share_data(*value);
433 temporary_inputs.append(std::move(temporary_input));
434 zone_tree_operation.map_input_to_result(identifier, temporary_inputs.last().get());
435 }
436 return temporary_inputs;
437 }
438
439 /* Writes the output results of the zone tree operation to this evaluate node operation outputs
440 * by sharing its data and freeing the results. */
441 void write_outputs(ZoneTreeOperation &zone_tree_operation, const compositor::ClosurePtr &closure)
442 {
443 for (const bNodeSocket *zone_output : closure->zone.output_node()->input_sockets()) {
444 if (!is_socket_available(zone_output)) {
445 continue;
446 }
447
448 const bNodeSocket *evaluate_node_output = bke::node_find_enabled_output_socket(
449 const_cast<bNode &>(this->node()), zone_output->name);
450 if (!evaluate_node_output) {
451 continue;
452 }
453
454 Result &evaluate_node_result = this->get_result(evaluate_node_output->identifier);
455 if (!evaluate_node_result.should_compute()) {
456 continue;
457 }
458
459 Result &zone_tree_result = zone_tree_operation.get_result(zone_output->identifier);
461 if (zone_tree_result.type() != evaluate_node_result.type()) {
462 if (!conversions.is_convertible(zone_tree_result.get_cpp_type(),
463 evaluate_node_result.get_cpp_type()))
464 {
465 zone_tree_result.release();
466 this->add_warning(
468 fmt::format("{}: {} \"{}\" ({} " BLI_STR_UTF8_BLACK_RIGHT_POINTING_SMALL_TRIANGLE
469 " {})",
470 TIP_("Conversion not supported when evaluating closure"),
471 TIP_("Output"),
472 zone_output->name,
473 TIP_(Result::type_name(zone_tree_result.type())),
474 TIP_(Result::type_name(evaluate_node_result.type()))));
475 continue;
476 }
477 ConversionOperation conversion_operation(
478 this->context(), zone_tree_result.type(), evaluate_node_result.type());
479 conversion_operation.map_input_to_result(&zone_tree_result);
480 conversion_operation.evaluate();
481 evaluate_node_result.share_data(conversion_operation.get_result());
482 conversion_operation.get_result().release();
483 this->add_warning(
485 fmt::format("{}: {} \"{}\" ({} " BLI_STR_UTF8_BLACK_RIGHT_POINTING_SMALL_TRIANGLE
486 " {})",
487 TIP_("Implicit type conversion when evaluating closure"),
488 TIP_("Output"),
489 zone_output->name,
490 TIP_(Result::type_name(zone_tree_result.type())),
491 TIP_(Result::type_name(evaluate_node_result.type()))));
492 continue;
493 }
494
495 evaluate_node_result.share_data(zone_tree_result);
496 zone_tree_result.release();
497 }
498
500 }
501
502 /* Adds an error for each input/output in the evaluate node that does not match a corresponding
503 * one in the provided closure. */
505 {
506 for (const bNodeSocket *output : this->node().output_sockets()) {
508 continue;
509 }
510
511 const bNodeSocket *closure_output = bke::node_find_enabled_input_socket(
512 const_cast<bNode &>(*closure->zone.output_node()), output->name);
513 if (closure_output) {
514 continue;
515 }
516 this->add_warning(
518 fmt::format(fmt::runtime(TIP_("Closure not have output: \"{}\"")), output->name));
519 }
520 for (const bNodeSocket *input : this->node().input_sockets()) {
521 if (!is_socket_available(input)) {
522 continue;
523 }
524
525 if (input->identifier_ustr() == "Closure"_ustr) {
526 continue;
527 }
528
530 const_cast<bNode &>(*closure->zone.input_node()), input->name);
531 if (closure_input) {
532 continue;
533 }
534 this->add_warning(
536 fmt::format(fmt::runtime(TIP_("Closure not have input: \"{}\"")), input->name));
537 }
538 }
539};
540
542{
543 return new EvaluateClosureOperation(context, node);
544}
545
546static void node_register()
547{
548 static bke::bNodeType ntype;
549
550 sh_geo_node_type_base(&ntype, "NodeEvaluateClosure"_ustr, NODE_EVALUATE_CLOSURE);
551 ntype.ui_name = "Evaluate Closure";
552 ntype.ui_description = "Execute a given closure";
554 ntype.declare = node_declare;
555 ntype.initfunc = node_init;
564 bke::node_type_storage(ntype, "NodeEvaluateClosure", node_free_storage, node_copy_storage);
566}
567NOD_REGISTER_NODE(node_register)
568
569} // namespace nodes::node_geo_evaluate_closure_cc
570
571namespace nodes {
572
573StructRNA **EvaluateClosureInputItemsAccessor::item_srna = &RNA_NodeEvaluateClosureInputItem;
574
576{
577 writer->write_string(item.name);
578}
579
584
585StructRNA **EvaluateClosureOutputItemsAccessor::item_srna = &RNA_NodeEvaluateClosureOutputItem;
586
588{
589 writer->write_string(item.name);
590}
591
596
598{
599 const bNode &node = output_socket.owner_node();
600 const bNodeTree &tree = node.owner_tree();
601 BLI_assert(node.is_type("NodeEvaluateClosure"_ustr));
602 const auto &storage = *static_cast<const NodeEvaluateClosure *>(node.storage);
603 if (output_socket.index() >= storage.output_items.items_num) {
604 return nullptr;
605 }
606 const NodeEvaluateClosureOutputItem &output_item =
607 storage.output_items.items[output_socket.index()];
608 const StringRef output_key = output_item.name;
609 for (const int i : IndexRange(storage.input_items.items_num)) {
610 const NodeEvaluateClosureInputItem &input_item = storage.input_items.items[i];
611 const StringRef input_key = input_item.name;
612 if (output_key == input_key) {
613 if (!tree.typeinfo->validate_link ||
614 tree.typeinfo->validate_link(input_item.socket_type, output_item.socket_type))
615 {
616 return &node.input_socket(i + 1);
617 }
618 }
619 }
620 return nullptr;
621}
622
623} // namespace nodes
624} // namespace blender
#define NODE_CLASS_CONVERTER
Definition BKE_node.hh:484
#define NODE_STORAGE_FUNCS(StorageT)
Definition BKE_node.hh:1353
#define NODE_EVALUATE_CLOSURE
#define BLI_STR_UTF8_BLACK_RIGHT_POINTING_SMALL_TRIANGLE
#define TIP_(msgid)
#define IFACE_(msgid)
#define NOD_REGISTER_NODE(REGISTER_FUNC)
#define C
Definition RandGen.cpp:29
#define UI_ITEM_NONE
#define output
bool is_convertible(const CPPType &from_type, const CPPType &to_type) const
NodeOperation(Context &context, const bNode &node)
void add_warning(nodes::NodeWarningType type, std::string message)
const ComputeContext & get_compute_context() const
Result & get_result(StringRef identifier)
Definition operation.cc:40
Context & context() const
Definition operation.cc:57
Result & get_input(StringRef identifier) const
Definition operation.cc:35
void map_input_to_result(StringRef identifier, Result *result)
Definition operation.cc:45
void share_data(const Result &source)
Definition result.cc:996
const CPPType & get_cpp_type() const
Definition result.cc:482
bool should_compute() const
Definition result.cc:1124
static const char * type_name(const ResultType type)
Definition result.cc:424
static ResultType type(gpu::TextureFormat format)
Definition result.cc:337
static ResultPrecision precision(gpu::TextureFormat format)
Definition result.cc:307
void set_reference_count(int count)
Definition result.cc:1079
static ClosureSignature from_evaluate_closure_node(const bNode &node, bool allow_auto_structure_type)
Span< const bke::SocketValueVariant * > captured_values() const
void add_item(std::string socket_name, SocketLinkOperation::LinkSocketFn fn, int weight=0)
void connect_available_socket_by_identifier(bNode &new_node, UString socket_identifier)
void update_and_connect_available_socket(bNode &new_node, UString socket_name)
void connect_available_socket(bNode &new_node, UString socket_name)
Vector< SocketDeclaration * > inputs
void write_outputs(ZoneTreeOperation &zone_tree_operation, const compositor::ClosurePtr &closure)
void set_reference_counts(ZoneTreeOperation &zone_tree_operation, const compositor::ClosurePtr &closure)
Vector< std::unique_ptr< Result > > map_inputs(ZoneTreeOperation &zone_tree_operation, const compositor::ClosurePtr &closure)
Vector< std::unique_ptr< Result > > map_captured_values(ZoneTreeOperation &zone_tree_operation, const compositor::ClosurePtr &closure)
#define storage(slot, qualifiers)
bool can_contain_reference(eNodeSocketDatatype socket_type)
bool can_contain_referenced_data(eNodeSocketDatatype socket_type)
bNodeSocket * node_find_enabled_input_socket(bNode &node, StringRef name)
Definition node.cc:3068
const DataTypeConversions & get_implicit_type_conversions()
void node_register_type(bNodeType &ntype)
Definition node.cc:2920
bNodeSocket * node_find_enabled_output_socket(bNode &node, StringRef name)
Definition node.cc:3073
void node_type_storage(bNodeType &ntype, std::optional< StringRefNull > storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
Definition node.cc:6166
ImplicitSharingPtr< Closure > ClosurePtr
ResultType get_node_socket_result_type(const bNodeSocket *socket)
Definition utilities.cc:103
bool is_socket_available(const bNodeSocket *socket)
Definition utilities.cc:26
internal::ShallowDataConstRef< T > shallow_copy(const T &other)
Definition DNA_defs.h:147
static void node_layout_ex(ui::Layout &layout, bContext *C, PointerRNA *ptr)
static void node_declare(NodeDeclarationBuilder &b)
static void node_blend_read(bNodeTree &, bNode &node, BlendDataReader &reader)
static const bNodeSocket * node_internally_linked_input(const bNodeTree &, const bNode &, const bNodeSocket &output_socket)
static void create_all_reference_lifetime_relations(NodeDeclarationBuilder &b)
static void node_copy_storage(bNodeTree *, bNode *dst_node, const bNode *src_node)
static void node_init(bNodeTree *, bNode *node)
static bool node_insert_link(bke::NodeInsertLinkParams &params)
static NodeOperation * get_compositor_operation(Context &context, const bNode &node)
static void node_gather_link_searches(GatherLinkSearchOpParams &params)
static void node_blend_write(const bNodeTree &, const bNode &node, BlendWriter &writer)
void blend_write(BlendWriter *writer, const bNode &node)
void blend_read_data(BlendDataReader *reader, bNode &node)
void copy_array(const bNode &src_node, bNode &dst_node)
Accessor::ItemT * add_item_with_socket_type_and_name(bNodeTree &ntree, bNode &node, const eNodeSocketDatatype socket_type, const char *name, std::optional< int > dimensions=std::nullopt)
bool try_add_item_via_any_extend_socket(bNodeTree &ntree, bNode &extend_node, bNode &storage_node, bNodeLink &link, const std::optional< StringRef > socket_identifier=std::nullopt, typename Accessor::ItemT **r_new_item=nullptr)
void sync_sockets_evaluate_closure(SpaceNode &snode, bNode &evaluate_closure_node, ReportList *reports, const bNodeSocket *src_closure_socket)
void update_node_declaration_and_sockets(bNodeTree &ntree, bNode &node, Main *bmain)
const bNodeSocket * evaluate_closure_node_internally_linked_input(const bNodeSocket &output_socket)
BMesh Iterators.
UserDef U
Definition blender.cc:58
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
@ NODE_EVALUATE_CLOSURE_FLAG_DEFINE_SIGNATURE
void sh_geo_node_type_base(bke::bNodeType *ntype, UString idname, const std::optional< int16_t > legacy_type)
SpaceNode * CTX_wm_space_node(const bContext *C)
void BLO_read_string(BlendDataReader *reader, char **ptr_p)
Definition readfile.cc:6653
void write_string(const char *data)
NodeSocketInterfaceStructureType structure_type
NodeSocketInterfaceStructureType structure_type
struct bNodeTree * edittree
bke::bNodeSocketType * typeinfo
eNodeSocketDatatype type
eNodeSocketInOut in_out
bke::bNodeTreeType * typeinfo
eNodeTree_Type type
ListBaseT< bNodeSocket > inputs
eNodeSocketDatatype type
Definition BKE_node.hh:198
bool(*) validate_link(eNodeSocketDatatype from, eNodeSocketDatatype to)
Definition BKE_node.hh:566
Defines a node type.
Definition BKE_node.hh:265
NodeInternallyLinkedInputFunction internally_linked_input
Definition BKE_node.hh:415
NodeBlendWriteFunction blend_write_storage_content
Definition BKE_node.hh:421
void(*) register_operators()
Definition BKE_node.hh:448
std::string ui_description
Definition BKE_node.hh:271
NodeBlendDataReadFunction blend_data_read_storage_content
Definition BKE_node.hh:422
NodeGetCompositorOperationFunction get_compositor_operation
Definition BKE_node.hh:379
void(*) draw_buttons_ex(ui::Layout &, bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:292
void(*) initfunc(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:320
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
Definition BKE_node.hh:409
NodeDeclareFunction declare
Definition BKE_node.hh:393
bool(*) insert_link(NodeInsertLinkParams &params)
Definition BKE_node.hh:364
static void blend_read_data_item(BlendDataReader *reader, ItemT &item)
static bool supports_socket_type(const eNodeSocketDatatype socket_type, const int ntree_type)
static std::string socket_identifier_for_item(const ItemT &item)
static void blend_write_item(BlendWriter *writer, const ItemT &item)
static void blend_read_data_item(BlendDataReader *reader, ItemT &item)
static void blend_write_item(BlendWriter *writer, const ItemT &item)
static std::string socket_identifier_for_item(const ItemT &item)
void use_property_decorate_set(bool is_decorate)
void use_property_split_set(bool is_sep)
PointerRNA op(wmOperatorType *ot, std::optional< StringRef > name, int icon, wm::OpCallContext context, eUI_Item_Flag flag)
PanelLayout panel(const bContext *C, StringRef idname, bool default_closed)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)