Blender V5.0
node_fn_compare.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#include <cmath>
6
7#include "BLI_listbase.h"
8#include "BLI_math_vector.h"
9#include "BLI_string_utf8.h"
10
11#include "BLT_translation.hh"
12
14#include "UI_resources.hh"
15
17
18#include "RNA_enum_types.hh"
19
20#include "node_function_util.hh"
21
22#include "NOD_rna_define.hh"
24
26
28
30{
31 b.is_function_node();
32 b.add_input<decl::Float>("A").min(-10000.0f).max(10000.0f).translation_context(
34 b.add_input<decl::Float>("B").min(-10000.0f).max(10000.0f).translation_context(
36
39
42
45
46 b.add_input<decl::String>("A", "A_STR")
48 .optional_label();
49 b.add_input<decl::String>("B", "B_STR")
51 .optional_label();
52
53 b.add_input<decl::Float>("C").default_value(0.9f);
54 b.add_input<decl::Float>("Angle").default_value(0.0872665f).subtype(PROP_ANGLE);
55 b.add_input<decl::Float>("Epsilon").default_value(0.001).min(-10000.0f).max(10000.0f);
56
57 b.add_output<decl::Bool>("Result");
58}
59
60static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
61{
62 const NodeFunctionCompare &data = node_storage(*static_cast<const bNode *>(ptr->data));
63 layout->prop(ptr, "data_type", UI_ITEM_NONE, "", ICON_NONE);
64 if (data.data_type == SOCK_VECTOR) {
65 layout->prop(ptr, "mode", UI_ITEM_NONE, "", ICON_NONE);
66 }
67 layout->prop(ptr, "operation", UI_ITEM_NONE, "", ICON_NONE);
68}
69
70static void node_update(bNodeTree *ntree, bNode *node)
71{
73
74 bNodeSocket *sock_comp = (bNodeSocket *)BLI_findlink(&node->inputs, 10);
75 bNodeSocket *sock_angle = (bNodeSocket *)BLI_findlink(&node->inputs, 11);
76 bNodeSocket *sock_epsilon = (bNodeSocket *)BLI_findlink(&node->inputs, 12);
77
78 LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) {
80 *ntree, *socket, socket->type == eNodeSocketDatatype(data->data_type));
81 }
82
84 *ntree,
85 *sock_epsilon,
87 !ELEM(data->data_type, SOCK_INT, SOCK_STRING));
88
90 *sock_comp,
92 data->data_type == SOCK_VECTOR);
93
95 *sock_angle,
97 data->data_type == SOCK_VECTOR);
98}
99
100static void node_init(bNodeTree * /*tree*/, bNode *node)
101{
103 data->operation = NODE_COMPARE_GREATER_THAN;
104 data->data_type = SOCK_FLOAT;
106 node->storage = data;
107}
108
110 public:
116 {
117 bNode &node = params.add_node("FunctionNodeCompare");
118 node_storage(node).data_type = data_type;
119 node_storage(node).operation = operation;
120 node_storage(node).mode = mode;
121 params.update_and_connect_available_socket(node, socket_name);
122 }
123};
124
125static std::optional<eNodeSocketDatatype> get_compare_type_for_operation(
126 const eNodeSocketDatatype type, const NodeCompareOperation operation)
127{
128 switch (type) {
129 case SOCK_BOOLEAN:
131 return SOCK_RGBA;
132 }
133 return SOCK_INT;
134 case SOCK_INT:
135 case SOCK_FLOAT:
136 case SOCK_VECTOR:
138 return SOCK_RGBA;
139 }
140 return type;
141 case SOCK_RGBA:
142 if (!ELEM(operation,
147 {
148 return SOCK_VECTOR;
149 }
150 return type;
151 case SOCK_STRING:
153 return std::nullopt;
154 }
155 return type;
156 default:
158 return std::nullopt;
159 }
160}
161
163{
164 const eNodeSocketDatatype type = eNodeSocketDatatype(params.other_socket().type);
166 return;
167 }
168 const StringRef socket_name = params.in_out() == SOCK_IN ? "A" : "Result";
170 item->identifier != nullptr;
171 item++)
172 {
173 if (item->name != nullptr && item->identifier[0] != '\0') {
174 const NodeCompareOperation operation = NodeCompareOperation(item->value);
175 if (const std::optional<eNodeSocketDatatype> fixed_type = get_compare_type_for_operation(
176 type, operation))
177 {
178 params.add_item(IFACE_(item->name), SocketSearchOp{socket_name, *fixed_type, operation});
179 }
180 }
181 }
182
183 if (params.in_out() != SOCK_IN && type != SOCK_STRING) {
184 params.add_item(
185 IFACE_("Angle"),
188 }
189}
190
191static void node_label(const bNodeTree * /*tree*/,
192 const bNode *node,
193 char *label,
194 int label_maxncpy)
195{
197 const char *name;
198 bool enum_label = RNA_enum_name(rna_enum_node_compare_operation_items, data->operation, &name);
199 if (!enum_label) {
200 name = N_("Unknown");
201 }
202 BLI_strncpy_utf8(label, IFACE_(name), label_maxncpy);
203}
204
206{
207 return (a.x + a.y + a.z) / 3.0f;
208}
209
210static const mf::MultiFunction *get_multi_function(const bNode &node)
211{
213
214 static auto exec_preset_all = mf::build::exec_presets::AllSpanOrSingle();
215 static auto exec_preset_first_two = mf::build::exec_presets::SomeSpanOrSingle<0, 1>();
216
217 switch (data->data_type) {
218 case SOCK_FLOAT:
219 switch (data->operation) {
221 static auto fn = mf::build::SI2_SO<float, float, bool>(
222 "Less Than", [](float a, float b) { return a < b; }, exec_preset_all);
223 return &fn;
224 }
226 static auto fn = mf::build::SI2_SO<float, float, bool>(
227 "Less Equal", [](float a, float b) { return a <= b; }, exec_preset_all);
228 return &fn;
229 }
231 static auto fn = mf::build::SI2_SO<float, float, bool>(
232 "Greater Than", [](float a, float b) { return a > b; }, exec_preset_all);
233 return &fn;
234 }
236 static auto fn = mf::build::SI2_SO<float, float, bool>(
237 "Greater Equal", [](float a, float b) { return a >= b; }, exec_preset_all);
238 return &fn;
239 }
240 case NODE_COMPARE_EQUAL: {
241 static auto fn = mf::build::SI3_SO<float, float, float, bool>(
242 "Equal",
243 [](float a, float b, float epsilon) { return std::abs(a - b) <= epsilon; },
244 exec_preset_first_two);
245 return &fn;
246 }
248 static auto fn = mf::build::SI3_SO<float, float, float, bool>(
249 "Not Equal",
250 [](float a, float b, float epsilon) { return std::abs(a - b) > epsilon; },
251 exec_preset_first_two);
252 return &fn;
253 }
254 break;
255 case SOCK_INT:
256 switch (data->operation) {
258 static auto fn = mf::build::SI2_SO<int, int, bool>(
259 "Less Than", [](int a, int b) { return a < b; }, exec_preset_all);
260 return &fn;
261 }
263 static auto fn = mf::build::SI2_SO<int, int, bool>(
264 "Less Equal", [](int a, int b) { return a <= b; }, exec_preset_all);
265 return &fn;
266 }
268 static auto fn = mf::build::SI2_SO<int, int, bool>(
269 "Greater Than", [](int a, int b) { return a > b; }, exec_preset_all);
270 return &fn;
271 }
273 static auto fn = mf::build::SI2_SO<int, int, bool>(
274 "Greater Equal", [](int a, int b) { return a >= b; }, exec_preset_all);
275 return &fn;
276 }
277 case NODE_COMPARE_EQUAL: {
278 static auto fn = mf::build::SI2_SO<int, int, bool>(
279 "Equal", [](int a, int b) { return a == b; }, exec_preset_all);
280 return &fn;
281 }
283 static auto fn = mf::build::SI2_SO<int, int, bool>(
284 "Not Equal", [](int a, int b) { return a != b; }, exec_preset_all);
285 return &fn;
286 }
287 }
288 break;
289 case SOCK_VECTOR:
290 switch (data->operation) {
292 switch (data->mode) {
294 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
295 "Less Than - Average",
296 [](float3 a, float3 b) { return component_average(a) < component_average(b); },
297 exec_preset_all);
298 return &fn;
299 }
301 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
302 "Less Than - Dot Product",
303 [](float3 a, float3 b, float comp) { return math::dot(a, b) < comp; },
304 exec_preset_first_two);
305 return &fn;
306 }
308 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
309 "Less Than - Direction",
310 [](float3 a, float3 b, float angle) { return angle_v3v3(a, b) < angle; },
311 exec_preset_first_two);
312 return &fn;
313 }
315 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
316 "Less Than - Element-wise",
317 [](float3 a, float3 b) { return a.x < b.x && a.y < b.y && a.z < b.z; },
318 exec_preset_all);
319 return &fn;
320 }
322 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
323 "Less Than - Length",
324 [](float3 a, float3 b) { return math::length(a) < math::length(b); },
325 exec_preset_all);
326 return &fn;
327 }
328 }
329 break;
331 switch (data->mode) {
333 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
334 "Less Equal - Average",
335 [](float3 a, float3 b) { return component_average(a) <= component_average(b); },
336 exec_preset_all);
337 return &fn;
338 }
340 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
341 "Less Equal - Dot Product",
342 [](float3 a, float3 b, float comp) { return math::dot(a, b) <= comp; },
343 exec_preset_first_two);
344 return &fn;
345 }
347 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
348 "Less Equal - Direction",
349 [](float3 a, float3 b, float angle) { return angle_v3v3(a, b) <= angle; },
350 exec_preset_first_two);
351 return &fn;
352 }
354 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
355 "Less Equal - Element-wise",
356 [](float3 a, float3 b) { return a.x <= b.x && a.y <= b.y && a.z <= b.z; },
357 exec_preset_all);
358 return &fn;
359 }
361 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
362 "Less Equal - Length",
363 [](float3 a, float3 b) { return math::length(a) <= math::length(b); },
364 exec_preset_all);
365 return &fn;
366 }
367 }
368 break;
370 switch (data->mode) {
372 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
373 "Greater Than - Average",
374 [](float3 a, float3 b) { return component_average(a) > component_average(b); },
375 exec_preset_all);
376 return &fn;
377 }
379 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
380 "Greater Than - Dot Product",
381 [](float3 a, float3 b, float comp) { return math::dot(a, b) > comp; },
382 exec_preset_first_two);
383 return &fn;
384 }
386 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
387 "Greater Than - Direction",
388 [](float3 a, float3 b, float angle) { return angle_v3v3(a, b) > angle; },
389 exec_preset_first_two);
390 return &fn;
391 }
393 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
394 "Greater Than - Element-wise",
395 [](float3 a, float3 b) { return a.x > b.x && a.y > b.y && a.z > b.z; },
396 exec_preset_all);
397 return &fn;
398 }
400 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
401 "Greater Than - Length",
402 [](float3 a, float3 b) { return math::length(a) > math::length(b); },
403 exec_preset_all);
404 return &fn;
405 }
406 }
407 break;
409 switch (data->mode) {
411 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
412 "Greater Equal - Average",
413 [](float3 a, float3 b) { return component_average(a) >= component_average(b); },
414 exec_preset_all);
415 return &fn;
416 }
418 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
419 "Greater Equal - Dot Product",
420 [](float3 a, float3 b, float comp) { return math::dot(a, b) >= comp; },
421 exec_preset_first_two);
422 return &fn;
423 }
425 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
426 "Greater Equal - Direction",
427 [](float3 a, float3 b, float angle) { return angle_v3v3(a, b) >= angle; },
428 exec_preset_first_two);
429 return &fn;
430 }
432 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
433 "Greater Equal - Element-wise",
434 [](float3 a, float3 b) { return a.x >= b.x && a.y >= b.y && a.z >= b.z; },
435 exec_preset_all);
436 return &fn;
437 }
439 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
440 "Greater Equal - Length",
441 [](float3 a, float3 b) { return math::length(a) >= math::length(b); },
442 exec_preset_all);
443 return &fn;
444 }
445 }
446 break;
448 switch (data->mode) {
450 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
451 "Equal - Average",
452 [](float3 a, float3 b, float epsilon) {
453 return abs(component_average(a) - component_average(b)) <= epsilon;
454 },
455 exec_preset_first_two);
456 return &fn;
457 }
459 static auto fn = mf::build::SI4_SO<float3, float3, float, float, bool>(
460 "Equal - Dot Product",
461 [](float3 a, float3 b, float comp, float epsilon) {
462 return abs(math::dot(a, b) - comp) <= epsilon;
463 },
464 exec_preset_first_two);
465 return &fn;
466 }
468 static auto fn = mf::build::SI4_SO<float3, float3, float, float, bool>(
469 "Equal - Direction",
470 [](float3 a, float3 b, float angle, float epsilon) {
471 return abs(angle_v3v3(a, b) - angle) <= epsilon;
472 },
473 exec_preset_first_two);
474 return &fn;
475 }
477 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
478 "Equal - Element-wise",
479 [](float3 a, float3 b, float epsilon) {
480 return abs(a.x - b.x) <= epsilon && abs(a.y - b.y) <= epsilon &&
481 abs(a.z - b.z) <= epsilon;
482 },
483 exec_preset_first_two);
484 return &fn;
485 }
487 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
488 "Equal - Length",
489 [](float3 a, float3 b, float epsilon) {
490 return abs(math::length(a) - math::length(b)) <= epsilon;
491 },
492 exec_preset_first_two);
493 return &fn;
494 }
495 }
496 break;
498 switch (data->mode) {
500 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
501 "Not Equal - Average",
502 [](float3 a, float3 b, float epsilon) {
503 return abs(component_average(a) - component_average(b)) > epsilon;
504 },
505 exec_preset_first_two);
506 return &fn;
507 }
509 static auto fn = mf::build::SI4_SO<float3, float3, float, float, bool>(
510 "Not Equal - Dot Product",
511 [](float3 a, float3 b, float comp, float epsilon) {
512 return abs(math::dot(a, b) - comp) >= epsilon;
513 },
514 exec_preset_first_two);
515 return &fn;
516 }
518 static auto fn = mf::build::SI4_SO<float3, float3, float, float, bool>(
519 "Not Equal - Direction",
520 [](float3 a, float3 b, float angle, float epsilon) {
521 return abs(angle_v3v3(a, b) - angle) > epsilon;
522 },
523 exec_preset_first_two);
524 return &fn;
525 }
527 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
528 "Not Equal - Element-wise",
529 [](float3 a, float3 b, float epsilon) {
530 return abs(a.x - b.x) > epsilon || abs(a.y - b.y) > epsilon ||
531 abs(a.z - b.z) > epsilon;
532 },
533 exec_preset_first_two);
534 return &fn;
535 }
537 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
538 "Not Equal - Length",
539 [](float3 a, float3 b, float epsilon) {
540 return abs(math::length(a) - math::length(b)) > epsilon;
541 },
542 exec_preset_first_two);
543 return &fn;
544 }
545 }
546 break;
547 }
548 break;
549 case SOCK_RGBA:
550 switch (data->operation) {
551 case NODE_COMPARE_EQUAL: {
552 static auto fn = mf::build::SI3_SO<ColorGeometry4f, ColorGeometry4f, float, bool>(
553 "Equal",
554 [](ColorGeometry4f a, ColorGeometry4f b, float epsilon) {
555 return abs(a.r - b.r) <= epsilon && abs(a.g - b.g) <= epsilon &&
556 abs(a.b - b.b) <= epsilon;
557 },
558 exec_preset_first_two);
559 return &fn;
560 }
562 static auto fn = mf::build::SI3_SO<ColorGeometry4f, ColorGeometry4f, float, bool>(
563 "Not Equal",
564 [](ColorGeometry4f a, ColorGeometry4f b, float epsilon) {
565 return abs(a.r - b.r) > epsilon || abs(a.g - b.g) > epsilon ||
566 abs(a.b - b.b) > epsilon;
567 },
568 exec_preset_first_two);
569 return &fn;
570 }
572 static auto fn = mf::build::SI2_SO<ColorGeometry4f, ColorGeometry4f, bool>(
573 "Brighter",
576 },
577 exec_preset_all);
578 return &fn;
579 }
581 static auto fn = mf::build::SI2_SO<ColorGeometry4f, ColorGeometry4f, bool>(
582 "Darker",
585 },
586 exec_preset_all);
587 return &fn;
588 }
589 }
590 break;
591 case SOCK_STRING:
592 switch (data->operation) {
593 case NODE_COMPARE_EQUAL: {
594 static auto fn = mf::build::SI2_SO<std::string, std::string, bool>(
595 "Equal", [](std::string a, std::string b) { return a == b; });
596 return &fn;
597 }
599 static auto fn = mf::build::SI2_SO<std::string, std::string, bool>(
600 "Not Equal", [](std::string a, std::string b) { return a != b; });
601 return &fn;
602 }
603 }
604 break;
605 }
606 return nullptr;
607}
608
610{
611 const mf::MultiFunction *fn = get_multi_function(builder.node());
612 builder.set_matching_fn(fn);
613}
614
615static void data_type_update(Main *bmain, Scene *scene, PointerRNA *ptr)
616{
617 bNode *node = static_cast<bNode *>(ptr->data);
618 NodeFunctionCompare *node_storage = static_cast<NodeFunctionCompare *>(node->storage);
619
620 if (node_storage->data_type == SOCK_RGBA && !ELEM(node_storage->operation,
625 {
626 node_storage->operation = NODE_COMPARE_EQUAL;
627 }
628 else if (node_storage->data_type == SOCK_STRING &&
630 {
631 node_storage->operation = NODE_COMPARE_EQUAL;
632 }
633 else if (node_storage->data_type != SOCK_RGBA &&
635 {
636 node_storage->operation = NODE_COMPARE_EQUAL;
637 }
638
639 rna_Node_socket_update(bmain, scene, ptr);
640}
641
642static void node_rna(StructRNA *srna)
643{
644 static const EnumPropertyItem mode_items[] = {
646 "ELEMENT",
647 0,
648 "Element-Wise",
649 "Compare each element of the input vectors"},
650 {NODE_COMPARE_MODE_LENGTH, "LENGTH", 0, "Length", "Compare the length of the input vectors"},
652 "AVERAGE",
653 0,
654 "Average",
655 "Compare the average of the input vectors elements"},
657 "DOT_PRODUCT",
658 0,
659 "Dot Product",
660 "Compare the dot products of the input vectors"},
662 "DIRECTION",
663 0,
664 "Direction",
665 "Compare the direction of the input vectors"},
666 {0, nullptr, 0, nullptr, nullptr},
667 };
668
669 PropertyRNA *prop;
670
671 prop = RNA_def_node_enum(
672 srna,
673 "operation",
674 "Operation",
675 "",
679 [](bContext * /*C*/, PointerRNA *ptr, PropertyRNA * /*prop*/, bool *r_free) {
680 *r_free = true;
681 bNode *node = static_cast<bNode *>(ptr->data);
682 NodeFunctionCompare *data = static_cast<NodeFunctionCompare *>(node->storage);
683
684 if (ELEM(data->data_type, SOCK_FLOAT, SOCK_INT, SOCK_VECTOR)) {
685 return enum_items_filter(
688 });
689 }
690 if (data->data_type == SOCK_STRING) {
691 return enum_items_filter(
694 });
695 }
696 if (data->data_type == SOCK_RGBA) {
698 [](const EnumPropertyItem &item) {
699 return ELEM(item.value,
704 });
705 }
707 [](const EnumPropertyItem & /*item*/) { return false; });
708 });
709
710 prop = RNA_def_node_enum(
711 srna,
712 "data_type",
713 "Input Type",
714 "",
717 std::nullopt,
718 [](bContext * /*C*/, PointerRNA * /*ptr*/, PropertyRNA * /*prop*/, bool *r_free) {
719 *r_free = true;
720 return enum_items_filter(
723 });
724 });
726
727 prop = RNA_def_node_enum(srna,
728 "mode",
729 "Mode",
730 "",
731 mode_items,
734}
735
736static void node_register()
737{
738 static blender::bke::bNodeType ntype;
739 fn_node_type_base(&ntype, "FunctionNodeCompare", FN_NODE_COMPARE);
740 ntype.ui_name = "Compare";
741 ntype.ui_description = "Perform a comparison operation on the two given inputs";
742 ntype.enum_name_legacy = "COMPARE";
744 ntype.declare = node_declare;
745 ntype.labelfunc = node_label;
746 ntype.updatefunc = node_update;
747 ntype.initfunc = node_init;
749 ntype, "NodeFunctionCompare", node_free_standard_storage, node_copy_standard_storage);
754
755 node_rna(ntype.rna_ext.srna);
756}
758
759} // namespace blender::nodes::node_fn_compare_cc
#define NODE_CLASS_CONVERTER
Definition BKE_node.hh:453
#define NODE_STORAGE_FUNCS(StorageT)
Definition BKE_node.hh:1240
#define FN_NODE_COMPARE
#define BLI_assert_unreachable()
Definition BLI_assert.h:93
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
Definition listbase.cc:534
#define LISTBASE_FOREACH(type, var, list)
float angle_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define ELEM(...)
#define BLT_I18NCONTEXT_ID_NODETREE
#define IFACE_(msgid)
@ SOCK_IN
eNodeSocketDatatype
@ SOCK_INT
@ SOCK_VECTOR
@ SOCK_BOOLEAN
@ SOCK_FLOAT
@ SOCK_STRING
@ SOCK_RGBA
NodeCompareMode
@ NODE_COMPARE_MODE_ELEMENT
@ NODE_COMPARE_MODE_LENGTH
@ NODE_COMPARE_MODE_DOT_PRODUCT
@ NODE_COMPARE_MODE_AVERAGE
@ NODE_COMPARE_MODE_DIRECTION
NodeCompareOperation
@ NODE_COMPARE_NOT_EQUAL
@ NODE_COMPARE_LESS_EQUAL
@ NODE_COMPARE_COLOR_BRIGHTER
@ NODE_COMPARE_EQUAL
@ NODE_COMPARE_GREATER_EQUAL
@ NODE_COMPARE_GREATER_THAN
@ NODE_COMPARE_COLOR_DARKER
@ NODE_COMPARE_LESS_THAN
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Definition IK_Math.h:117
BLI_INLINE float IMB_colormanagement_get_luminance(const float rgb[3])
#define NOD_REGISTER_NODE(REGISTER_FUNC)
void rna_Node_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
#define NOD_storage_enum_accessors(member)
@ PROP_ANGLE
Definition RNA_types.hh:252
#define UI_ITEM_NONE
BMesh const char void * data
ChannelStorageType r
ChannelStorageType g
ChannelStorageType b
void set_matching_fn(const mf::MultiFunction *fn)
std::optional< std::string > translation_context
#define abs
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void * MEM_callocN(size_t len, const char *str)
Definition mallocn.cc:118
void node_register_type(bNodeType &ntype)
Definition node.cc:2416
void node_set_socket_availability(bNodeTree &ntree, bNodeSocket &sock, bool is_available)
Definition node.cc:4739
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:5414
T length(const VecBase< T, Size > &a)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
static const mf::MultiFunction * get_multi_function(const bNode &node)
static void node_init(bNodeTree *, bNode *node)
static void node_layout(uiLayout *layout, bContext *, PointerRNA *ptr)
static void node_build_multi_function(NodeMultiFunctionBuilder &builder)
static void node_rna(StructRNA *srna)
static void node_gather_link_searches(GatherLinkSearchOpParams &params)
static void node_label(const bNodeTree *, const bNode *node, char *label, int label_maxncpy)
static std::optional< eNodeSocketDatatype > get_compare_type_for_operation(const eNodeSocketDatatype type, const NodeCompareOperation operation)
static void node_declare(NodeDeclarationBuilder &b)
static void data_type_update(Main *bmain, Scene *scene, PointerRNA *ptr)
static float component_average(float3 a)
static void node_update(bNodeTree *ntree, bNode *node)
PropertyRNA * RNA_def_node_enum(StructRNA *srna, const char *identifier, const char *ui_name, const char *ui_description, const EnumPropertyItem *static_items, const EnumRNAAccessors accessors, std::optional< int > default_value, const EnumPropertyItemFunc item_func, const bool allow_animation)
const EnumPropertyItem * enum_items_filter(const EnumPropertyItem *original_item_array, FunctionRef< bool(const EnumPropertyItem &item)> fn)
ColorSceneLinear4f< eAlpha::Premultiplied > ColorGeometry4f
VecBase< float, 3 > float3
void fn_node_type_base(blender::bke::bNodeType *ntype, std::string idname, const std::optional< int16_t > legacy_type)
void node_free_standard_storage(bNode *node)
Definition node_util.cc:42
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
Definition node_util.cc:54
const char * name
bool RNA_enum_name(const EnumPropertyItem *item, const int value, const char **r_name)
void RNA_def_property_update_runtime(PropertyRNA *prop, RNAPropertyUpdateFunc func)
const EnumPropertyItem rna_enum_node_socket_data_type_items[]
const EnumPropertyItem rna_enum_node_compare_operation_items[]
#define min(a, b)
Definition sort.cc:36
StructRNA * srna
ListBase inputs
void * storage
Defines a node type.
Definition BKE_node.hh:238
std::string ui_description
Definition BKE_node.hh:244
void(* initfunc)(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:289
void(* labelfunc)(const bNodeTree *ntree, const bNode *node, char *label, int label_maxncpy)
Definition BKE_node.hh:270
NodeMultiFunctionBuildFunction build_multi_function
Definition BKE_node.hh:351
const char * enum_name_legacy
Definition BKE_node.hh:247
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:259
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
Definition BKE_node.hh:378
NodeDeclareFunction declare
Definition BKE_node.hh:362
void(* updatefunc)(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:281
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)
max
Definition text_draw.cc:251
#define N_(msgid)
PointerRNA * ptr
Definition wm_files.cc:4238