Blender V4.3
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.h"
10#include "BLI_string_utf8.h"
11
12#include "BLT_translation.hh"
13
14#include "UI_interface.hh"
15#include "UI_resources.hh"
16
17#include "RNA_enum_types.hh"
18
19#include "node_function_util.hh"
20
21#include "NOD_rna_define.hh"
23
25
27
29{
30 b.is_function_node();
31 b.add_input<decl::Float>("A").min(-10000.0f).max(10000.0f).translation_context(
33 b.add_input<decl::Float>("B").min(-10000.0f).max(10000.0f).translation_context(
35
36 b.add_input<decl::Int>("A", "A_INT").translation_context(BLT_I18NCONTEXT_ID_NODETREE);
37 b.add_input<decl::Int>("B", "B_INT").translation_context(BLT_I18NCONTEXT_ID_NODETREE);
38
39 b.add_input<decl::Vector>("A", "A_VEC3").translation_context(BLT_I18NCONTEXT_ID_NODETREE);
40 b.add_input<decl::Vector>("B", "B_VEC3").translation_context(BLT_I18NCONTEXT_ID_NODETREE);
41
42 b.add_input<decl::Color>("A", "A_COL").translation_context(BLT_I18NCONTEXT_ID_NODETREE);
43 b.add_input<decl::Color>("B", "B_COL").translation_context(BLT_I18NCONTEXT_ID_NODETREE);
44
45 b.add_input<decl::String>("A", "A_STR")
46 .translation_context(BLT_I18NCONTEXT_ID_NODETREE)
47 .hide_label();
48 b.add_input<decl::String>("B", "B_STR")
49 .translation_context(BLT_I18NCONTEXT_ID_NODETREE)
50 .hide_label();
51
52 b.add_input<decl::Float>("C").default_value(0.9f);
53 b.add_input<decl::Float>("Angle").default_value(0.0872665f).subtype(PROP_ANGLE);
54 b.add_input<decl::Float>("Epsilon").default_value(0.001).min(-10000.0f).max(10000.0f);
55
56 b.add_output<decl::Bool>("Result");
57}
58
59static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
60{
61 const NodeFunctionCompare &data = node_storage(*static_cast<const bNode *>(ptr->data));
62 uiItemR(layout, ptr, "data_type", UI_ITEM_NONE, "", ICON_NONE);
63 if (data.data_type == SOCK_VECTOR) {
64 uiItemR(layout, ptr, "mode", UI_ITEM_NONE, "", ICON_NONE);
65 }
66 uiItemR(layout, ptr, "operation", UI_ITEM_NONE, "", ICON_NONE);
67}
68
69static void node_update(bNodeTree *ntree, bNode *node)
70{
71 NodeFunctionCompare *data = (NodeFunctionCompare *)node->storage;
72
73 bNodeSocket *sock_comp = (bNodeSocket *)BLI_findlink(&node->inputs, 10);
74 bNodeSocket *sock_angle = (bNodeSocket *)BLI_findlink(&node->inputs, 11);
75 bNodeSocket *sock_epsilon = (bNodeSocket *)BLI_findlink(&node->inputs, 12);
76
77 LISTBASE_FOREACH (bNodeSocket *, socket, &node->inputs) {
79 ntree, socket, socket->type == (eNodeSocketDatatype)data->data_type);
80 }
81
83 ntree,
84 sock_epsilon,
86 !ELEM(data->data_type, SOCK_INT, SOCK_STRING));
87
89 sock_comp,
91 data->data_type == SOCK_VECTOR);
92
94 sock_angle,
95 ELEM(data->mode, NODE_COMPARE_MODE_DIRECTION) &&
96 data->data_type == SOCK_VECTOR);
97}
98
99static void node_init(bNodeTree * /*tree*/, bNode *node)
100{
101 NodeFunctionCompare *data = MEM_cnew<NodeFunctionCompare>(__func__);
102 data->operation = NODE_COMPARE_GREATER_THAN;
103 data->data_type = SOCK_FLOAT;
104 data->mode = NODE_COMPARE_MODE_ELEMENT;
105 node->storage = data;
106}
107
109 public:
115 {
116 bNode &node = params.add_node("FunctionNodeCompare");
117 node_storage(node).data_type = data_type;
118 node_storage(node).operation = operation;
119 node_storage(node).mode = mode;
120 params.update_and_connect_available_socket(node, socket_name);
121 }
122};
123
124static std::optional<eNodeSocketDatatype> get_compare_type_for_operation(
125 const eNodeSocketDatatype type, const NodeCompareOperation operation)
126{
127 switch (type) {
128 case SOCK_BOOLEAN:
130 return SOCK_RGBA;
131 }
132 return SOCK_INT;
133 case SOCK_INT:
134 case SOCK_FLOAT:
135 case SOCK_VECTOR:
137 return SOCK_RGBA;
138 }
139 return type;
140 case SOCK_RGBA:
141 if (!ELEM(operation,
146 {
147 return SOCK_VECTOR;
148 }
149 return type;
150 case SOCK_STRING:
152 return std::nullopt;
153 }
154 return type;
155 default:
157 return std::nullopt;
158 }
159}
160
162{
163 const eNodeSocketDatatype type = eNodeSocketDatatype(params.other_socket().type);
165 return;
166 }
167 const StringRef socket_name = params.in_out() == SOCK_IN ? "A" : "Result";
169 item->identifier != nullptr;
170 item++)
171 {
172 if (item->name != nullptr && item->identifier[0] != '\0') {
173 const NodeCompareOperation operation = NodeCompareOperation(item->value);
174 if (const std::optional<eNodeSocketDatatype> fixed_type = get_compare_type_for_operation(
175 type, operation))
176 {
177 params.add_item(IFACE_(item->name), SocketSearchOp{socket_name, *fixed_type, operation});
178 }
179 }
180 }
181
182 if (params.in_out() != SOCK_IN && type != SOCK_STRING) {
183 params.add_item(
184 IFACE_("Angle"),
187 }
188}
189
190static void node_label(const bNodeTree * /*tree*/,
191 const bNode *node,
192 char *label,
193 int label_maxncpy)
194{
195 const NodeFunctionCompare *data = (NodeFunctionCompare *)node->storage;
196 const char *name;
197 bool enum_label = RNA_enum_name(rna_enum_node_compare_operation_items, data->operation, &name);
198 if (!enum_label) {
199 name = "Unknown";
200 }
201 BLI_strncpy_utf8(label, IFACE_(name), label_maxncpy);
202}
203
205{
206 return (a.x + a.y + a.z) / 3.0f;
207}
208
210{
211 const NodeFunctionCompare *data = (NodeFunctionCompare *)node.storage;
212
213 static auto exec_preset_all = mf::build::exec_presets::AllSpanOrSingle();
214 static auto exec_preset_first_two = mf::build::exec_presets::SomeSpanOrSingle<0, 1>();
215
216 switch (data->data_type) {
217 case SOCK_FLOAT:
218 switch (data->operation) {
220 static auto fn = mf::build::SI2_SO<float, float, bool>(
221 "Less Than", [](float a, float b) { return a < b; }, exec_preset_all);
222 return &fn;
223 }
225 static auto fn = mf::build::SI2_SO<float, float, bool>(
226 "Less Equal", [](float a, float b) { return a <= b; }, exec_preset_all);
227 return &fn;
228 }
230 static auto fn = mf::build::SI2_SO<float, float, bool>(
231 "Greater Than", [](float a, float b) { return a > b; }, exec_preset_all);
232 return &fn;
233 }
235 static auto fn = mf::build::SI2_SO<float, float, bool>(
236 "Greater Equal", [](float a, float b) { return a >= b; }, exec_preset_all);
237 return &fn;
238 }
239 case NODE_COMPARE_EQUAL: {
240 static auto fn = mf::build::SI3_SO<float, float, float, bool>(
241 "Equal",
242 [](float a, float b, float epsilon) { return std::abs(a - b) <= epsilon; },
243 exec_preset_first_two);
244 return &fn;
245 }
247 static auto fn = mf::build::SI3_SO<float, float, float, bool>(
248 "Not Equal",
249 [](float a, float b, float epsilon) { return std::abs(a - b) > epsilon; },
250 exec_preset_first_two);
251 return &fn;
252 }
253 break;
254 case SOCK_INT:
255 switch (data->operation) {
257 static auto fn = mf::build::SI2_SO<int, int, bool>(
258 "Less Than", [](int a, int b) { return a < b; }, exec_preset_all);
259 return &fn;
260 }
262 static auto fn = mf::build::SI2_SO<int, int, bool>(
263 "Less Equal", [](int a, int b) { return a <= b; }, exec_preset_all);
264 return &fn;
265 }
267 static auto fn = mf::build::SI2_SO<int, int, bool>(
268 "Greater Than", [](int a, int b) { return a > b; }, exec_preset_all);
269 return &fn;
270 }
272 static auto fn = mf::build::SI2_SO<int, int, bool>(
273 "Greater Equal", [](int a, int b) { return a >= b; }, exec_preset_all);
274 return &fn;
275 }
276 case NODE_COMPARE_EQUAL: {
277 static auto fn = mf::build::SI2_SO<int, int, bool>(
278 "Equal", [](int a, int b) { return a == b; }, exec_preset_all);
279 return &fn;
280 }
282 static auto fn = mf::build::SI2_SO<int, int, bool>(
283 "Not Equal", [](int a, int b) { return a != b; }, exec_preset_all);
284 return &fn;
285 }
286 }
287 break;
288 case SOCK_VECTOR:
289 switch (data->operation) {
291 switch (data->mode) {
293 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
294 "Less Than - Average",
295 [](float3 a, float3 b) { return component_average(a) < component_average(b); },
296 exec_preset_all);
297 return &fn;
298 }
300 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
301 "Less Than - Dot Product",
302 [](float3 a, float3 b, float comp) { return math::dot(a, b) < comp; },
303 exec_preset_first_two);
304 return &fn;
305 }
307 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
308 "Less Than - Direction",
309 [](float3 a, float3 b, float angle) { return angle_v3v3(a, b) < angle; },
310 exec_preset_first_two);
311 return &fn;
312 }
314 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
315 "Less Than - Element-wise",
316 [](float3 a, float3 b) { return a.x < b.x && a.y < b.y && a.z < b.z; },
317 exec_preset_all);
318 return &fn;
319 }
321 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
322 "Less Than - Length",
323 [](float3 a, float3 b) { return math::length(a) < math::length(b); },
324 exec_preset_all);
325 return &fn;
326 }
327 }
328 break;
330 switch (data->mode) {
332 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
333 "Less Equal - Average",
334 [](float3 a, float3 b) { return component_average(a) <= component_average(b); },
335 exec_preset_all);
336 return &fn;
337 }
339 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
340 "Less Equal - Dot Product",
341 [](float3 a, float3 b, float comp) { return math::dot(a, b) <= comp; },
342 exec_preset_first_two);
343 return &fn;
344 }
346 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
347 "Less Equal - Direction",
348 [](float3 a, float3 b, float angle) { return angle_v3v3(a, b) <= angle; },
349 exec_preset_first_two);
350 return &fn;
351 }
353 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
354 "Less Equal - Element-wise",
355 [](float3 a, float3 b) { return a.x <= b.x && a.y <= b.y && a.z <= b.z; },
356 exec_preset_all);
357 return &fn;
358 }
360 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
361 "Less Equal - Length",
362 [](float3 a, float3 b) { return math::length(a) <= math::length(b); },
363 exec_preset_all);
364 return &fn;
365 }
366 }
367 break;
369 switch (data->mode) {
371 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
372 "Greater Than - Average",
373 [](float3 a, float3 b) { return component_average(a) > component_average(b); },
374 exec_preset_all);
375 return &fn;
376 }
378 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
379 "Greater Than - Dot Product",
380 [](float3 a, float3 b, float comp) { return math::dot(a, b) > comp; },
381 exec_preset_first_two);
382 return &fn;
383 }
385 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
386 "Greater Than - Direction",
387 [](float3 a, float3 b, float angle) { return angle_v3v3(a, b) > angle; },
388 exec_preset_first_two);
389 return &fn;
390 }
392 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
393 "Greater Than - Element-wise",
394 [](float3 a, float3 b) { return a.x > b.x && a.y > b.y && a.z > b.z; },
395 exec_preset_all);
396 return &fn;
397 }
399 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
400 "Greater Than - Length",
401 [](float3 a, float3 b) { return math::length(a) > math::length(b); },
402 exec_preset_all);
403 return &fn;
404 }
405 }
406 break;
408 switch (data->mode) {
410 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
411 "Greater Equal - Average",
412 [](float3 a, float3 b) { return component_average(a) >= component_average(b); },
413 exec_preset_all);
414 return &fn;
415 }
417 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
418 "Greater Equal - Dot Product",
419 [](float3 a, float3 b, float comp) { return math::dot(a, b) >= comp; },
420 exec_preset_first_two);
421 return &fn;
422 }
424 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
425 "Greater Equal - Direction",
426 [](float3 a, float3 b, float angle) { return angle_v3v3(a, b) >= angle; },
427 exec_preset_first_two);
428 return &fn;
429 }
431 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
432 "Greater Equal - Element-wise",
433 [](float3 a, float3 b) { return a.x >= b.x && a.y >= b.y && a.z >= b.z; },
434 exec_preset_all);
435 return &fn;
436 }
438 static auto fn = mf::build::SI2_SO<float3, float3, bool>(
439 "Greater Equal - Length",
440 [](float3 a, float3 b) { return math::length(a) >= math::length(b); },
441 exec_preset_all);
442 return &fn;
443 }
444 }
445 break;
447 switch (data->mode) {
449 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
450 "Equal - Average",
451 [](float3 a, float3 b, float epsilon) {
452 return abs(component_average(a) - component_average(b)) <= epsilon;
453 },
454 exec_preset_first_two);
455 return &fn;
456 }
458 static auto fn = mf::build::SI4_SO<float3, float3, float, float, bool>(
459 "Equal - Dot Product",
460 [](float3 a, float3 b, float comp, float epsilon) {
461 return abs(math::dot(a, b) - comp) <= epsilon;
462 },
463 exec_preset_first_two);
464 return &fn;
465 }
467 static auto fn = mf::build::SI4_SO<float3, float3, float, float, bool>(
468 "Equal - Direction",
469 [](float3 a, float3 b, float angle, float epsilon) {
470 return abs(angle_v3v3(a, b) - angle) <= epsilon;
471 },
472 exec_preset_first_two);
473 return &fn;
474 }
476 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
477 "Equal - Element-wise",
478 [](float3 a, float3 b, float epsilon) {
479 return abs(a.x - b.x) <= epsilon && abs(a.y - b.y) <= epsilon &&
480 abs(a.z - b.z) <= epsilon;
481 },
482 exec_preset_first_two);
483 return &fn;
484 }
486 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
487 "Equal - Length",
488 [](float3 a, float3 b, float epsilon) {
489 return abs(math::length(a) - math::length(b)) <= epsilon;
490 },
491 exec_preset_first_two);
492 return &fn;
493 }
494 }
495 break;
497 switch (data->mode) {
499 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
500 "Not Equal - Average",
501 [](float3 a, float3 b, float epsilon) {
502 return abs(component_average(a) - component_average(b)) > epsilon;
503 },
504 exec_preset_first_two);
505 return &fn;
506 }
508 static auto fn = mf::build::SI4_SO<float3, float3, float, float, bool>(
509 "Not Equal - Dot Product",
510 [](float3 a, float3 b, float comp, float epsilon) {
511 return abs(math::dot(a, b) - comp) >= epsilon;
512 },
513 exec_preset_first_two);
514 return &fn;
515 }
517 static auto fn = mf::build::SI4_SO<float3, float3, float, float, bool>(
518 "Not Equal - Direction",
519 [](float3 a, float3 b, float angle, float epsilon) {
520 return abs(angle_v3v3(a, b) - angle) > epsilon;
521 },
522 exec_preset_first_two);
523 return &fn;
524 }
526 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
527 "Not Equal - Element-wise",
528 [](float3 a, float3 b, float epsilon) {
529 return abs(a.x - b.x) > epsilon || abs(a.y - b.y) > epsilon ||
530 abs(a.z - b.z) > epsilon;
531 },
532 exec_preset_first_two);
533 return &fn;
534 }
536 static auto fn = mf::build::SI3_SO<float3, float3, float, bool>(
537 "Not Equal - Length",
538 [](float3 a, float3 b, float epsilon) {
539 return abs(math::length(a) - math::length(b)) > epsilon;
540 },
541 exec_preset_first_two);
542 return &fn;
543 }
544 }
545 break;
546 }
547 break;
548 case SOCK_RGBA:
549 switch (data->operation) {
550 case NODE_COMPARE_EQUAL: {
551 static auto fn = mf::build::SI3_SO<ColorGeometry4f, ColorGeometry4f, float, bool>(
552 "Equal",
553 [](ColorGeometry4f a, ColorGeometry4f b, float epsilon) {
554 return abs(a.r - b.r) <= epsilon && abs(a.g - b.g) <= epsilon &&
555 abs(a.b - b.b) <= epsilon;
556 },
557 exec_preset_first_two);
558 return &fn;
559 }
561 static auto fn = mf::build::SI3_SO<ColorGeometry4f, ColorGeometry4f, float, bool>(
562 "Not Equal",
563 [](ColorGeometry4f a, ColorGeometry4f b, float epsilon) {
564 return abs(a.r - b.r) > epsilon || abs(a.g - b.g) > epsilon ||
565 abs(a.b - b.b) > epsilon;
566 },
567 exec_preset_first_two);
568 return &fn;
569 }
571 static auto fn = mf::build::SI2_SO<ColorGeometry4f, ColorGeometry4f, bool>(
572 "Brighter",
575 },
576 exec_preset_all);
577 return &fn;
578 }
580 static auto fn = mf::build::SI2_SO<ColorGeometry4f, ColorGeometry4f, bool>(
581 "Darker",
584 },
585 exec_preset_all);
586 return &fn;
587 }
588 }
589 break;
590 case SOCK_STRING:
591 switch (data->operation) {
592 case NODE_COMPARE_EQUAL: {
593 static auto fn = mf::build::SI2_SO<std::string, std::string, bool>(
594 "Equal", [](std::string a, std::string b) { return a == b; });
595 return &fn;
596 }
598 static auto fn = mf::build::SI2_SO<std::string, std::string, bool>(
599 "Not Equal", [](std::string a, std::string b) { return a != b; });
600 return &fn;
601 }
602 }
603 break;
604 }
605 return nullptr;
606}
607
609{
610 const mf::MultiFunction *fn = get_multi_function(builder.node());
611 builder.set_matching_fn(fn);
612}
613
614static void data_type_update(Main *bmain, Scene *scene, PointerRNA *ptr)
615{
616 bNode *node = static_cast<bNode *>(ptr->data);
617 NodeFunctionCompare *node_storage = static_cast<NodeFunctionCompare *>(node->storage);
618
619 if (node_storage->data_type == SOCK_RGBA && !ELEM(node_storage->operation,
624 {
625 node_storage->operation = NODE_COMPARE_EQUAL;
626 }
627 else if (node_storage->data_type == SOCK_STRING &&
629 {
630 node_storage->operation = NODE_COMPARE_EQUAL;
631 }
632 else if (node_storage->data_type != SOCK_RGBA &&
634 {
635 node_storage->operation = NODE_COMPARE_EQUAL;
636 }
637
638 rna_Node_socket_update(bmain, scene, ptr);
639}
640
641static void node_rna(StructRNA *srna)
642{
643 static const EnumPropertyItem mode_items[] = {
645 "ELEMENT",
646 0,
647 "Element-Wise",
648 "Compare each element of the input vectors"},
649 {NODE_COMPARE_MODE_LENGTH, "LENGTH", 0, "Length", "Compare the length of the input vectors"},
651 "AVERAGE",
652 0,
653 "Average",
654 "Compare the average of the input vectors elements"},
656 "DOT_PRODUCT",
657 0,
658 "Dot Product",
659 "Compare the dot products of the input vectors"},
661 "DIRECTION",
662 0,
663 "Direction",
664 "Compare the direction of the input vectors"},
665 {0, nullptr, 0, nullptr, nullptr},
666 };
667
668 PropertyRNA *prop;
669
670 prop = RNA_def_node_enum(
671 srna,
672 "operation",
673 "Operation",
674 "",
678 [](bContext * /*C*/, PointerRNA *ptr, PropertyRNA * /*prop*/, bool *r_free) {
679 *r_free = true;
680 bNode *node = static_cast<bNode *>(ptr->data);
681 NodeFunctionCompare *data = static_cast<NodeFunctionCompare *>(node->storage);
682
683 if (ELEM(data->data_type, SOCK_FLOAT, SOCK_INT, SOCK_VECTOR)) {
684 return enum_items_filter(
687 });
688 }
689 else if (data->data_type == SOCK_STRING) {
690 return enum_items_filter(
693 });
694 }
695 else if (data->data_type == SOCK_RGBA) {
697 [](const EnumPropertyItem &item) {
698 return ELEM(item.value,
703 });
704 }
705 else {
707 [](const EnumPropertyItem & /*item*/) { return false; });
708 }
709 });
710
711 prop = RNA_def_node_enum(
712 srna,
713 "data_type",
714 "Input Type",
715 "",
718 std::nullopt,
719 [](bContext * /*C*/, PointerRNA * /*ptr*/, PropertyRNA * /*prop*/, bool *r_free) {
720 *r_free = true;
721 return enum_items_filter(
724 });
725 });
727
728 prop = RNA_def_node_enum(srna,
729 "mode",
730 "Mode",
731 "",
732 mode_items,
735}
736
737static void node_register()
738{
739 static blender::bke::bNodeType ntype;
740 fn_node_type_base(&ntype, FN_NODE_COMPARE, "Compare", NODE_CLASS_CONVERTER);
741 ntype.declare = node_declare;
742 ntype.labelfunc = node_label;
743 ntype.updatefunc = node_update;
744 ntype.initfunc = node_init;
746 &ntype, "NodeFunctionCompare", node_free_standard_storage, node_copy_standard_storage);
751
752 node_rna(ntype.rna_ext.srna);
753}
755
756} // namespace blender::nodes::node_fn_compare_cc
#define NODE_CLASS_CONVERTER
Definition BKE_node.hh:410
#define NODE_STORAGE_FUNCS(StorageT)
Definition BKE_node.hh:1799
#define BLI_assert_unreachable()
Definition BLI_assert.h:97
#define LISTBASE_FOREACH(type, var, list)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float rgb_to_grayscale(const float rgb[3])
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:125
#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:155
#define UI_ITEM_NONE
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
void set_matching_fn(const mf::MultiFunction *fn)
local_group_size(16, 16) .push_constant(Type b
const char * label
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void node_set_socket_availability(bNodeTree *ntree, bNodeSocket *sock, bool is_available)
Definition node.cc:3911
void node_type_storage(bNodeType *ntype, const char *storagename, void(*freefunc)(bNode *node), void(*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node))
Definition node.cc:4632
void node_register_type(bNodeType *ntype)
Definition node.cc:1708
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)
void fn_node_type_base(blender::bke::bNodeType *ntype, int type, const char *name, short nclass)
void node_free_standard_storage(bNode *node)
Definition node_util.cc:46
void node_copy_standard_storage(bNodeTree *, bNode *dest_node, const bNode *src_node)
Definition node_util.cc:58
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.c:32
const char * identifier
Definition RNA_types.hh:506
StructRNA * srna
Definition RNA_types.hh:780
void * data
Definition RNA_types.hh:42
Defines a node type.
Definition BKE_node.hh:218
void(* initfunc)(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:267
void(* labelfunc)(const bNodeTree *ntree, const bNode *node, char *label, int label_maxncpy)
Definition BKE_node.hh:249
NodeMultiFunctionBuildFunction build_multi_function
Definition BKE_node.hh:336
void(* draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr)
Definition BKE_node.hh:238
NodeGatherSocketLinkOperationsFunction gather_link_search_ops
Definition BKE_node.hh:363
NodeDeclareFunction declare
Definition BKE_node.hh:347
void(* updatefunc)(bNodeTree *ntree, bNode *node)
Definition BKE_node.hh:257
ccl_device_inline int abs(int x)
Definition util/math.h:120
PointerRNA * ptr
Definition wm_files.cc:4126