38#include "RNA_prototypes.hh"
96 if (link_to_pick.
tosock->is_multi_input()) {
100 nldrag.
links.append(link);
102 snode.
edittree->ensure_topology_cache();
127 const float cursor_link_touch_distance = 12.5f *
UI_SCALE_FAC;
131 for (
bNodeLink *link : socket->directly_linked_links()) {
133 std::array<float2, NODE_LINK_RESOL + 1> coords;
136 for (
const int i :
IndexRange(coords.size() - 1)) {
138 if (
distance < cursor_link_touch_distance) {
150 if (last_picked_link) {
151 link_to_pick = last_picked_link;
168 ntree->ensure_topology_cache();
169 if (!sock->is_visible()) {
186 const bool allow_multiple)
206 if (sock.
type == sock_target->
type) {
220 if (sock.
type == sock_target->
type) {
227 ntree->ensure_topology_cache();
228 if (
STREQ(sock_target->
idname,
"NodeSocketVirtual")) {
230 if (!
output.is_icon_visible()) {
236 bool is_output_linked_to_target_node =
false;
237 for (
bNodeSocket *socket : directly_linked_sockets) {
238 if (&socket->owner_node() == &sock_target->owner_node()) {
239 is_output_linked_to_target_node =
true;
245 if (is_output_linked_to_target_node) {
255 if (
node->is_reroute()) {
256 return node->outputs.first();
268 const bool only_unlinked)
277 std::ranges::sort(inputs,
329 for (
bNodeLink *link : socket.directly_linked_links()) {
331 socket_location, link->multi_input_sort_id, link->tosock->runtime->total_inputs);
332 links.
append({link, location});
335 links.
append({&drag_link, cursor});
342 links[i].link->multi_input_sort_id = i;
349 if (!socket->is_multi_input()) {
358 links[i]->multi_input_sort_id = i;
365 const bool allow_multiple,
372 std::ranges::sort(sorted_nodes, [](
const bNode *a,
const bNode *
b) {
377 for (
const int i : sorted_nodes.
as_mutable_span().drop_back(1).index_range()) {
378 bool has_selected_inputs =
false;
380 bNode *node_fr = sorted_nodes[i];
381 bNode *node_to = sorted_nodes[i + 1];
383 if (node_to->
inputs.is_empty() || node_fr->
outputs.is_empty()) {
384 std::swap(node_fr, node_to);
390 has_selected_inputs =
true;
408 if (!has_selected_inputs) {
437 if (!socket.is_icon_visible()) {
463 std::optional<int> existing_geometry_index;
467 existing_geometry_index = i;
471 if (existing_geometry_index) {
487 ntree, viewer_node, socket_type,
IFACE_(
"Value"));
491 storage.items[0].socket_type = socket_type;
496 ntree, viewer_node, socket_type,
IFACE_(
"Value"));
502 storage.items[1].socket_type = socket_type;
505 std::optional<int> existing_geometry_index;
508 existing_geometry_index = i;
512 if (existing_geometry_index) {
514 storage.items[1].socket_type = socket_type;
515 MEM_SAFE_DELETE(
storage.items[1].name);
519 storage.items[0].socket_type = socket_type;
520 MEM_SAFE_DELETE(
storage.items[0].name);
528 if (
node.is_reroute()) {
530 if (!reroute_input.is_logically_linked()) {
533 return reroute_input.logically_linked_sockets()[0]->
name;
546 return viewer_node.
inputs.first();
569 viewer_node, item, name.c_str());
587 return socket.index() == 0;
607 if (link.tonode == &viewer_node) {
617 int last_linked_data_socket_index = -1;
618 bool has_linked_geometry_socket =
false;
623 for (
bNodeLink *link : socket->directly_linked_links()) {
625 bNode &target_node = *link->tonode;
632 has_linked_geometry_socket =
true;
635 last_linked_data_socket_index = socket->index();
641 if (last_linked_data_socket_index == -1 && !has_linked_geometry_socket) {
654 const int tot_outputs =
node_to_view.output_sockets().size();
655 for (
const int offset :
IndexRange(1, tot_outputs)) {
656 const int index = (last_linked_data_socket_index + offset) % tot_outputs;
663 already_viewed_socket = &output_socket;
667 bool is_currently_viewed =
false;
668 for (
const bNodeLink *link : output_socket.directly_linked_links()) {
670 bNode &target_node = *link->tonode;
674 if (link->is_muted()) {
680 is_currently_viewed =
true;
683 if (is_currently_viewed) {
684 already_viewed_socket = &output_socket;
687 return &output_socket;
689 return already_viewed_socket;
705 std::optional<int> item_identifier;
718 if (
node->is_type(
"CompositorNodeViewer"_ustr) &&
node != &viewer_node) {
731 for (
const bNode *
node : tree.all_nodes()) {
732 if (
node->is_frame()) {
750 const float step_distance,
751 const float max_distance)
754 const float y_scale = 0.5f;
757 candidates.
append(initial);
760 const int checks = std::max<int>(2,
ceilf(
arc_length / step_distance));
763 const float candidate_x = initial.x +
distance * std::sin(
angle);
764 const float candidate_y = initial.y +
distance * std::cos(
angle) * y_scale;
765 candidates.
append({candidate_x, candidate_y});
785 tree.ensure_topology_cache();
789 region_rect.
xmin = 0;
791 region_rect.
ymin = 0;
800 viewer_node.
ui_order = tree.all_nodes().size();
804 if (!is_new_viewer_node &&
813 const float default_padding_x =
U.node_margin;
814 const float default_padding_y = 10;
815 const float viewer_width = is_new_viewer_node ?
818 const float viewer_height = is_new_viewer_node ?
822 const float2 main_candidate{
node_to_view.runtime->draw_bounds.xmax + default_padding_x,
823 node_to_view.runtime->draw_bounds.ymax + viewer_height +
826 std::optional<float2> new_viewer_position;
830 for (
const float2 &candidate_pos : position_candidates) {
832 candidate.
xmin = candidate_pos.x;
833 candidate.
xmax = candidate_pos.x + viewer_width;
834 candidate.
ymin = candidate_pos.y - viewer_height;
835 candidate.
ymax = candidate_pos.y;
842 rctf padded_candidate = candidate;
843 BLI_rctf_pad(&padded_candidate, default_padding_x - 1, default_padding_y - 1);
847 if (!overlapping_node) {
848 new_viewer_position = candidate_pos;
853 if (!new_viewer_position) {
854 new_viewer_position = main_candidate;
859 viewer_node.
parent =
nullptr;
865 bNode &bnode_to_view,
868 bNode *viewer_node =
nullptr;
880 for (
bNodeLink *link : bsocket_to_view.directly_linked_links()) {
882 bNode &target_node = *link->tonode;
890 if (viewer_node ==
nullptr) {
898 if (viewer_node ==
nullptr) {
907 if (viewer_bsocket ==
nullptr) {
914 if (link.tosock == viewer_bsocket) {
919 if (viewer_link ==
nullptr) {
921 btree, bnode_to_view, bsocket_to_view, *viewer_node, *viewer_bsocket);
924 viewer_link->
fromnode = &bnode_to_view;
925 viewer_link->
fromsock = &bsocket_to_view;
937 btree->ensure_topology_cache();
939 if (bsocket_to_view ==
nullptr) {
943 if (bsocket_to_view ==
nullptr) {
951 return view_socket(
C, snode, *btree, bnode_to_view, *bsocket_to_view);
976 socket_to_view = &socket;
1012 ot->
name =
"Link to Viewer Node";
1014 ot->
idname =
"NODE_OT_link_viewer";
1103 const int icon = !swap_links ? ICON_ADD : (new_link ? ICON_ANIM : ICON_UV_SYNC_SELECT);
1141 node->outputs.first();
1144 while (socket != socket_to_match) {
1145 if (socket->is_visible()) {
1146 const bool sockets_are_compatible = socket->
typeinfo == socket_to_match->
typeinfo;
1147 if (sockets_are_compatible) {
1150 if (socket_has_capacity) {
1157 socket = socket->
next ? socket->
next : first_socket;
1169 if (linked_socket->is_input()) {
1170 BLI_assert(!linked_socket->is_multi_input());
1171 ntree->ensure_topology_cache();
1173 if (linked_socket->directly_linked_links().is_empty()) {
1176 bNodeLink *displaced_link = linked_socket->directly_linked_links().first();
1178 if (!replacement_socket) {
1183 displaced_link->
tosock = replacement_socket;
1185 if (replacement_socket->is_multi_input()) {
1202 if (link.fromsock == linked_socket) {
1203 if (replacement_socket) {
1204 link.fromsock = replacement_socket;
1235 if (linked_socket.is_input()) {
1237 if (link.tosock != &linked_socket) {
1240 if (link.fromnode == start_node) {
1246 link.tosock = start_socket;
1247 link.tonode = start_node;
1252 if (link.fromsock != &linked_socket) {
1255 if (link.tonode == start_node) {
1260 link.fromsock = start_socket;
1261 link.fromnode = start_node;
1276 ntree.ensure_topology_cache();
1280 if (linked_socket.is_input()) {
1283 if (duplicate_link) {
1284 links_to_remove.
add(link);
1291 const bool duplicate_link = link->
tosock == dragged_link.
tosock;
1292 if (duplicate_link) {
1293 links_to_remove.
add(link);
1301 const bool link_limit_exceeded = !(link_count < link_limit);
1302 if (link_limit_exceeded) {
1303 if (links_to_remove.
add(link)) {
1309 for (
bNodeLink *link : links_to_remove) {
1324 const bool connecting_to_multi_input = linked_socket->is_multi_input() ||
1326 if (nldrag.
swap_links && !connecting_to_multi_input) {
1347 bNodeLink *new_link = MEM_new<bNodeLink>(__func__, link);
1351 MEM_delete(new_link);
1358 MEM_delete(new_link);
1392 bNode *fromnode =
nullptr, *tonode =
nullptr;
1393 bNodeSocket *fromsock =
nullptr, *tosock =
nullptr;
1410 if (
ELEM(
nullptr, fromnode, fromsock, tonode, tosock)) {
1419 ntree.ensure_topology_cache();
1424 for (
bNodeLink *other_link : tosock->directly_linked_links()) {
1425 if (other_link == &link_restored) {
1429 other_link->multi_input_sort_id += 1;
1452 view2d_edge_pan_cancel(
C, &nldrag->
pan_data);
1468 bNode &tnode = tsock->owner_node();
1476 bNodeLink *existing_link_connected_to_fromsock =
nullptr;
1479 existing_link_connected_to_fromsock = &existing_link;
1488 if (existing_link_connected_to_fromsock) {
1492 if (tsock && tsock->is_multi_input()) {
1552 {0,
nullptr, 0,
nullptr,
nullptr},
1575 view2d_edge_pan_apply_event(
C, &nldrag.
pan_data, event);
1579 nldrag.
cursor[0] =
event->mval[0];
1580 nldrag.
cursor[1] =
event->mval[1];
1583 switch (event->
val) {
1637 tree.ensure_topology_cache();
1640 if (!link->is_available()) {
1653 snode.
edittree->ensure_topology_cache();
1656 std::unique_ptr<bNodeLinkDrag> nldrag = std::make_unique<bNodeLinkDrag>();
1657 nldrag->start_node = &
node;
1658 nldrag->start_socket = sock;
1661 if (nldrag->start_link_count > 0 && (nldrag->start_link_count >= link_limit || detach)) {
1666 if (link.fromsock == sock) {
1668 oplink.
next = oplink.
prev =
nullptr;
1671 nldrag->links.append(oplink);
1686 snode.
edittree->ensure_topology_cache();
1688 std::unique_ptr<bNodeLinkDrag> nldrag = std::make_unique<bNodeLinkDrag>();
1689 nldrag->last_node_hovered_while_dragging_a_link = &
node;
1690 nldrag->start_node = &
node;
1691 nldrag->start_socket = sock;
1694 if (nldrag->start_link_count > 0) {
1700 if (link.tosock == sock) {
1701 link_to_pick = &link;
1705 if (link_to_pick !=
nullptr && !nldrag->start_socket->is_multi_input()) {
1707 oplink.
next = oplink.
prev =
nullptr;
1710 nldrag->links.append(oplink);
1745 std::unique_ptr<bNodeLinkDrag> nldrag =
node_link_init(region, snode, cursor, detach);
1750 view2d_edge_pan_operator_init(
C, &nldrag->pan_data, op);
1767 ot->
name =
"Link Nodes";
1768 ot->
idname =
"NODE_OT_link";
1769 ot->
description =
"Use the mouse to create a link between two nodes";
1780 RNA_def_boolean(ot->
srna,
"detach",
false,
"Detach",
"Detach and redirect existing links");
1788 "The position of the mouse cursor at the start of the operation",
1831 ot->
name =
"Make Links";
1832 ot->
description =
"Make a link between selected output and input sockets";
1833 ot->
idname =
"NODE_OT_link_make";
1844 ot->
srna,
"replace",
false,
"Replace",
"Replace socket connections with the new links");
1866 if (path.
size() >= 256) {
1881 node_tree.ensure_topology_cache();
1896 links_to_remove.
add(&link);
1901 for (
bNodeLink *link : links_to_remove) {
1904 affected_nodes.
add(to_node);
1907 node_tree.ensure_topology_cache();
1922 ot->
name =
"Cut Links";
1923 ot->
idname =
"NODE_OT_links_cut";
1924 ot->
description =
"Use the mouse to cut (remove) some links";
1953 for (
const bNodeLink *link : socket.directly_linked_links()) {
1975 if (path.
size() >= 256) {
1987 ntree.ensure_topology_cache();
1997 affected_links.
add(&link);
2006 for (
bNodeLink *link : affected_links) {
2011 if (link->
tonode->is_reroute()) {
2017 if (!link->
tonode->is_reroute()) {
2024 if (link->
fromnode->is_reroute()) {
2031 if (!link->
fromnode->is_reroute()) {
2048 ot->
name =
"Mute Links";
2049 ot->
idname =
"NODE_OT_links_mute";
2085 if (
node->is_selected()) {
2096 ot->
name =
"Detach Links";
2097 ot->
idname =
"NODE_OT_links_detach";
2099 "Remove all links to selected nodes, and try to connect neighbor nodes together";
2119 if (!frame || !frame->is_frame()) {
2124 if (
node == frame) {
2127 if (
node->is_selected()) {
2142 ot->
name =
"Make Parent";
2144 ot->
idname =
"NODE_OT_parent_set";
2171 join_states[
node->index()].done =
true;
2173 if (
node == frame) {
2174 join_states[
node->index()].descendent =
true;
2176 else if (
node->parent) {
2178 if (!join_states[
node->parent->index()].done) {
2183 if (join_states[
node->parent->index()].descendent) {
2184 join_states[
node->index()].descendent =
true;
2190 join_states[
node->index()].descendent =
true;
2195 join_states[
node->index()].descendent =
true;
2202 for (
bNode *parent =
node.parent; parent; parent = parent->parent) {
2206 std::reverse(parents.
begin(), parents.
end());
2212 if (
nodes.is_empty()) {
2223 if (candidates[i] != parents[i]) {
2235 return candidates.
last();
2250 ntree.ensure_topology_cache();
2255 if (!join_states[
node->index()].done) {
2290 ot->
name =
"Join Nodes in Frame";
2291 ot->
description =
"Attach selected nodes to a new common frame";
2292 ot->
idname =
"NODE_OT_join";
2311 bNode *main_node =
nullptr;
2312 if (group_inputs.
contains(active_node)) {
2313 main_node = active_node;
2316 main_node = group_inputs[0];
2319 for (
const bNode *
node : group_inputs) {
2320 location +=
node->location;
2322 location /=
float(group_inputs.size());
2325 tree.ensure_topology_cache();
2329 old_link_map.
add_multiple(socket, socket->directly_linked_links());
2333 for (
bNodeSocket *socket : main_node->output_sockets()) {
2334 used_link_targets.
add_multiple(socket, socket->directly_linked_sockets());
2337 if (
node == main_node) {
2340 bool keep_node =
false;
2343 for (
const int group_input_i :
node->runtime->outputs.index_range().drop_back(1)) {
2349 if (used_link_targets.
lookup(&new_socket).contains(&to_socket)) {
2354 used_link_targets.
add(&new_socket, &to_socket);
2355 link->fromsock = &new_socket;
2356 link->fromnode = main_node;
2381 if (selected_nodes.
size() <= 1) {
2385 if (std::all_of(selected_nodes.
begin(),
2386 selected_nodes.
end(),
2387 [](
const bNode *
node) { return node->is_group_input(); }))
2404 ot->
name =
"Join Nodes";
2405 ot->
description =
"Merge selected group input nodes into one if possible";
2406 ot->
idname =
"NODE_OT_join_nodes";
2428 if (!frame->is_frame() || frame->is_selected()) {
2445 if (
node.parent ==
nullptr) {
2448 if (
node.parent == &frame) {
2453 if (!share_parent) {
2465 if (frame ==
nullptr) {
2470 bool changed =
false;
2473 if (!
node->is_selected()) {
2494 ot->
name =
"Attach Nodes";
2495 ot->
description =
"Attach active node to a frame";
2496 ot->
idname =
"NODE_OT_attach";
2519 detach_states[
node->index()].done =
true;
2523 if (!detach_states[
node->parent->index()].done) {
2528 if (detach_states[
node->parent->index()].descendent) {
2529 detach_states[
node->index()].descendent =
true;
2531 else if (
node->is_selected()) {
2534 detach_states[
node->index()].descendent =
true;
2537 else if (
node->is_selected()) {
2538 detach_states[
node->index()].descendent =
true;
2552 if (!detach_states[
node->index()].done) {
2566 ot->
name =
"Detach Nodes";
2567 ot->
description =
"Detach selected nodes from parents";
2568 ot->
idname =
"NODE_OT_detach";
2586 bNode *selected_node =
nullptr;
2587 int selected_node_count = 0;
2588 for (
bNode *
node : node_tree.all_nodes()) {
2589 if (
node->is_selected()) {
2590 selected_node =
node;
2591 selected_node_count++;
2593 if (selected_node_count > 1) {
2597 if (!selected_node) {
2600 if (selected_node->input_sockets().is_empty() || selected_node->output_sockets().is_empty()) {
2603 return selected_node;
2610 if (
ELEM(
nullptr, main_input, main_output)) {
2613 if (
node.is_reroute()) {
2630 const bool attach_enabled,
2631 const bool is_new_node)
2634 node_tree.ensure_topology_cache();
2639 if (!node_to_insert) {
2643 for (
bNodeSocket *socket : node_to_insert->input_sockets()) {
2644 already_linked_sockets.
extend(socket->directly_linked_sockets());
2646 for (
bNodeSocket *socket : node_to_insert->output_sockets()) {
2647 already_linked_sockets.
extend(socket->directly_linked_sockets());
2649 if (!is_new_node && !already_linked_sockets.
is_empty()) {
2664 if (is_new_node && !already_linked_sockets.
is_empty()) {
2667 bool is_linked_to_linked =
false;
2668 for (
const bNodeSocket *socket : already_linked_sockets) {
2670 is_linked_to_linked =
true;
2674 if (!is_linked_to_linked) {
2679 std::array<float2, NODE_LINK_RESOL + 1> coords;
2700 if (dist < dist_best) {
2718 snode.
edittree->ensure_topology_cache();
2724 if (!
node->is_selected()) {
2751 ntree.ensure_topology_cache();
2753 if (!node_to_insert) {
2768 if (old_link ==
nullptr) {
2774 for (
bNodeSocket *socket : node_to_insert->input_sockets()) {
2775 if (!socket->directly_linked_sockets().is_empty()) {
2776 best_input = socket;
2786 for (
bNodeSocket *socket : node_to_insert->output_sockets()) {
2787 if (!socket->directly_linked_sockets().is_empty()) {
2788 best_output = socket;
2797 if (!node_to_insert->is_reroute()) {
2802 best_input =
nullptr;
2807 best_output =
nullptr;
2815 const bool best_input_is_linked = best_input && best_input->is_directly_linked();
2816 const bool old_link_muted = old_link->is_muted();
2818 if (best_output !=
nullptr) {
2820 old_link->
fromnode = node_to_insert;
2828 if (best_input !=
nullptr) {
2830 if (!best_input_is_linked) {
2833 ntree, *from_node, *from_socket, *node_to_insert, *best_input);
2841 auto iofsd = std::make_unique<NodeInsertOfsData>();
2843 iofsd->insert = node_to_insert;
2844 iofsd->
prev = from_node;
2845 iofsd->
next = to_node;
2861 switch (socket->
type) {
2901 ListBaseT<bNodeSocket> *sockets = (in_out ==
SOCK_IN) ? &
node.inputs : &
node.outputs;
2906 if (node_decl !=
nullptr) {
2910 if (!socket_decl->is_default_link_socket) {
2914 if (socket && socket->is_visible()) {
2921 int maxpriority = -1;
2930 for (
int priority = maxpriority; priority >= 0; priority--) {
2942 const bool left_to_right,
2947 node->output_sockets();
2948 bool &node_value = mask_to_propagate[
node->index()];
2950 for (
const bNodeLink *link : socket->directly_linked_links()) {
2951 if (!(link->tosock->is_visible() && link->fromsock->is_visible())) {
2958 const bNodeSocket *other_socket = left_to_right ? link->fromsock : link->tosock;
2959 const bNode &other_node = other_socket->owner_node();
2960 node_value |= mask_to_propagate[other_node.index()];
2973 const bNode &start_node,
2974 const bool left_to_right,
2981 tree.toposort_right_to_left();
2982 shift_mask[start_node.index()] =
true;
2986 for (
const int index :
nodes.index_range()) {
2987 if (shift_mask[
index]) {
3000 ntree.ensure_topology_cache();
3007 const float gap_left = totr_insert.
xmin - prev.runtime->draw_bounds.xmax;
3009 const float front_gap = right_alignment ? gap_right : gap_left;
3010 const float back_gap = right_alignment ? gap_left : gap_right;
3013 const bool need_offset_side = (back_gap + front_gap) < min_margin * 2;
3014 const bool need_front_offset_insert = back_gap < min_margin;
3015 const bool need_back_offset_insert = !need_offset_side && front_gap < min_margin;
3017 if (!(need_front_offset_insert || need_back_offset_insert || need_offset_side)) {
3021 const float front_offset = (min_margin - back_gap) *
float(need_front_offset_insert);
3022 const float back_offset = (front_gap - min_margin) *
float(need_back_offset_insert);
3023 const float insert_node_offset = need_front_offset_insert ? front_offset : back_offset;
3024 const float side_offset = min_margin - front_gap + front_offset;
3026 const float shift_sign = right_alignment ? 1.0f : -1.0f;
3028 if (need_offset_side) {
3030 right_alignment ? next : prev,
3042#define NODE_INSOFS_ANIM_DURATION 0.25f
3051 bool redraw =
false;
3063 if (
node->runtime->anim_ofsx) [[unlikely]] {
3067 if (prev_duration < clamped_duration) {
3068 const float offset_step =
node->runtime->anim_ofsx *
3073 node->location[0] += offset_step;
3087 node->runtime->anim_ofsx = 0.0f;
3098#undef NODE_INSOFS_ANIM_DURATION
3108 if (!iofsd || !iofsd->
insert) {
3118 if (!offset_applied) {
3135 ot->
name =
"Insert Offset";
3136 ot->
description =
"Automatically offset nodes on insertion";
3137 ot->
idname =
"NODE_OT_insert_offset";
#define NODE_EDGE_PAN_OUTSIDE_PAD
#define NODE_EDGE_PAN_INSIDE_PAD
#define NODE_EDGE_PAN_MAX_SPEED
#define NODE_EDGE_PAN_DELAY
#define NODE_EDGE_PAN_ZOOM_INFLUENCE
#define NODE_EDGE_PAN_SPEED_RAMP
#define REGION_DRAW_POST_PIXEL
Read Blender memory allocation and freeing.
#define RNA_BEGIN(sptr, itemptr, propname)
#define UI_PRECISION_FLOAT_MAX
#define UI_NO_ICON_OVERLAY_TEXT
__forceinline const float4 insert(const float4 &a, const float b)
ccl_device_inline float arc_length(const float e2, const float gamma)
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
constexpr IndexRange()=default
Span< Value > lookup(const Key &key) const
void add_multiple(const Key &key, Span< Value > values)
void add(const Key &key, const Value &value)
constexpr Span drop_front(int64_t n) const
constexpr int64_t first_index(const T &search_value) const
constexpr bool contains(const T &value) const
void push_multiple(Span< T > values)
const Key * begin() const
bool contains(const Key &key) const
Span< Key > as_span() const
void append(const T &value)
const T & last(const int64_t n=0) const
IndexRange index_range() const
void resize(const int64_t new_size)
MutableSpan< T > as_mutable_span()
void extend(Span< T > array)
Vector< bNodeSocket * > outputs
Vector< bNodeLink * > directly_linked_links
Vector< SocketDeclaration * > inputs
Vector< SocketDeclaration * > outputs
#define storage(slot, qualifiers)
float distance(float, float) RET
bool node_is_parent_and_child(const bNode &parent, const bNode &child)
void node_attach_node(bNodeTree &ntree, bNode &node, bNode &parent)
bNode * node_get_active(bNodeTree &ntree)
void node_remove_link(bNodeTree *ntree, bNodeLink &link)
int node_count_socket_links(const bNodeTree &ntree, const bNodeSocket &sock)
void node_internal_relink(bNodeTree &ntree, bNode &node)
void node_free_node(bNodeTree *tree, bNode &node)
void node_detach_node(bNodeTree &ntree, bNode &node)
bNodeLink & node_add_link(bNodeTree &ntree, bNode &fromnode, bNodeSocket &fromsock, bNode &tonode, bNodeSocket &tosock)
void node_link_set_mute(bNodeTree &ntree, bNodeLink &link, const bool muted)
void node_remove_socket_links(bNodeTree &ntree, bNodeSocket &sock)
bool node_declaration_ensure(bNodeTree &ntree, bNode &node)
void node_set_active(bNodeTree &ntree, bNode &node)
int node_socket_link_limit(const bNodeSocket &sock)
StringRefNull node_socket_label(const bNodeSocket &sock)
void move_index(T *items, const int items_num, const int from_index, const int to_index)
static int view_socket(const bContext &C, SpaceNode &snode, bNodeTree &btree, bNode &bnode_to_view, bNodeSocket &bsocket_to_view)
static const bNode * find_overlapping_node(const bNodeTree &tree, const rctf &rect, const Span< const bNode * > ignored_nodes)
static int node_link_viewer(const bContext &C, bNode &bnode_to_view, bNodeSocket *bsocket_to_view)
static bNodeSocket * determine_socket_to_view(bNode &node_to_view)
static void finalize_viewer_link(const bContext &C, SpaceNode &snode, bNode &viewer_node, bNodeLink &viewer_link)
static std::string get_viewer_source_name(const bNodeSocket &socket)
static bNodeSocket * node_link_viewer_get_socket(bNodeTree &ntree, bNode &viewer_node, bNodeSocket &src_socket)
static void remove_links_to_unavailable_viewer_sockets(bNodeTree &btree, bNode &viewer_node)
static bool is_viewer_socket(const bNodeSocket &socket)
static bool is_viewer_node(const bNode &node)
static bool socket_can_be_viewed(const bNodeSocket &socket)
static bool is_viewer_socket_in_viewer(const bNodeSocket &socket)
static int ensure_geometry_nodes_viewer_has_non_geometry_socket(bNodeTree &ntree, bNode &viewer_node, const eNodeSocketDatatype socket_type)
static Vector< float2 > get_viewer_node_position_candidates(const float2 initial, const float step_distance, const float max_distance)
static int get_default_viewer_type(const bContext *C)
static void position_viewer_node(const bContext &C, bNodeTree &tree, bNode &viewer_node, const bNode &node_to_view)
static void ensure_geometry_nodes_viewer_starts_with_geometry_socket(bNodeTree &tree, bNode &viewer_node)
void NODE_OT_parent_set(wmOperatorType *ot)
static void join_group_inputs(bNodeTree &tree, VectorSet< bNode * > group_inputs, bNode *active_node)
static wmOperatorStatus node_link_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void draw_draglink_tooltip_activate(const ARegion ®ion, bNodeLinkDrag &nldrag)
void node_deselect_all_input_sockets(bNodeTree &node_tree, bool deselect_nodes)
void node_insert_on_link_flags_set(SpaceNode &snode, const ARegion ®ion, bool attach_enabled, bool is_new_node)
static wmOperatorStatus mute_links_exec(bContext *C, wmOperator *op)
static void node_swap_links(bNodeLinkDrag &nldrag, bNodeTree &ntree)
void tree_draw_order_update(bNodeTree &ntree)
static bool need_drag_link_tooltip(const bNodeTree &node_tree, const bNodeLinkDrag &nldrag)
static wmOperatorStatus node_join_in_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void shift_nodes(bNodeTree &tree, const bNode &start_node, const bool left_to_right, const float value)
static bNodeLink create_drag_link(bNode &node, bNodeSocket &socket)
static void sort_multi_input_socket_links_with_drag(bNodeSocket &socket, bNodeLink &drag_link, const float2 &cursor)
bNode * add_static_node(const bContext &C, int type, const float2 &location)
static std::unique_ptr< bNodeLinkDrag > node_link_init(ARegion ®ion, SpaceNode &snode, const float2 cursor, const bool detach)
void invoke_node_link_drag_add_menu(bContext &C, bNode &node, bNodeSocket &socket, const float2 &cursor)
static wmOperatorStatus node_active_link_viewer_exec(bContext *C, wmOperator *)
void NODE_OT_detach(wmOperatorType *ot)
bool all_links_muted(const bNodeSocket &socket)
static bool can_attach_node_to_frame(const bNode &node, const bNode &frame)
bNodeSocket * node_find_indicated_socket(SpaceNode &snode, ARegion ®ion, const float2 &cursor, const eNodeSocketInOut in_out)
static bool node_link_insert_offset_ntree(NodeInsertOfsData *iofsd, const bool right_alignment)
static bNodeSocket * node_find_linkable_socket(const bNodeTree &ntree, const bNode *node, bNodeSocket *socket_to_match)
static wmOperatorStatus node_insert_offset_modal(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus node_insert_offset_invoke(bContext *C, wmOperator *op, const wmEvent *)
static wmOperatorStatus node_link_modal(bContext *C, wmOperator *op, const wmEvent *event)
void NODE_OT_insert_offset(wmOperatorType *ot)
Array< bNode * > tree_draw_order_calc_nodes_reversed(bNodeTree &ntree)
static int get_main_socket_priority(const bNodeSocket *socket)
static bool snode_autoconnect_input(bContext &C, SpaceNode &snode, bNode *node_fr, bNodeSocket *sock_fr, bNode *node_to, bNodeSocket *sock_to, int replace)
static void expand_nodes_mask_in_direction(const Span< const bNode * > nodes, const bool left_to_right, MutableSpan< bool > mask_to_propagate)
static Vector< bNodeSocket * > get_available_sorted_inputs(const bNodeTree *ntree, const bNode *node, const bool only_unlinked)
float2 node_link_calculate_multi_input_position(const float2 &socket_position, const int index, const int total_inputs)
void node_insert_on_frame_flag_set(SpaceNode &snode, ARegion ®ion, const int2 &cursor)
void NODE_OT_links_detach(wmOperatorType *ot)
static bool dragged_links_are_detached(const bNodeLinkDrag &nldrag)
void NODE_OT_links_cut(wmOperatorType *ot)
static void clear_picking_highlight(ListBaseT< bNodeLink > *links)
static void pick_input_link_by_link_intersect(const bContext &C, wmOperator &op, bNodeLinkDrag &nldrag, const float2 &cursor)
static wmOperatorStatus node_attach_invoke(bContext *C, wmOperator *, const wmEvent *event)
static void node_detach_recursive(bNodeTree &ntree, MutableSpan< NodeDetachstate > detach_states, bNode *node)
static void node_displace_existing_links(bNodeLinkDrag &nldrag, bNodeTree &ntree)
static void node_link_cancel(bContext *C, wmOperator *op)
static void pick_link(bNodeLinkDrag &nldrag, SpaceNode &snode, bNode *node, bNodeLink &link_to_pick)
static void displace_links(bNodeTree *ntree, const bNode *node, bNodeLink *inserted_link)
static wmOperatorStatus node_join_nodes_exec(bContext *C, wmOperator *op)
static wmOperatorStatus node_join_in_frame_exec(bContext *C, wmOperator *)
void NODE_OT_join(wmOperatorType *ot)
static void snode_autoconnect(bContext &C, SpaceNode &snode, const bool allow_multiple, const bool replace)
static bNode * node_find_frame_to_attach(ARegion ®ion, bNodeTree &ntree, const int2 mouse_xy)
static bool node_active_link_viewer_poll(bContext *C)
static wmOperatorStatus node_detach_exec(bContext *C, wmOperator *)
static bool socket_is_available(const bNodeTree *ntree, bNodeSocket *sock, const bool allow_used)
static wmOperatorStatus detach_links_exec(bContext *C, wmOperator *)
static Vector< bNode * > get_sorted_node_parents(const bNode &node)
static bool node_can_be_inserted_on_link(bNodeTree &tree, bNode &node, const bNodeLink &link)
void NODE_OT_attach(wmOperatorType *ot)
bool node_link_is_hidden_or_dimmed(const View2D &v2d, const bNodeLink &link)
static void draw_draglink_tooltip_deactivate(const ARegion ®ion, bNodeLinkDrag &nldrag)
std::optional< float2 > link_path_intersection(const bNodeLink &link, const Span< float2 > path)
void NODE_OT_link_viewer(wmOperatorType *ot)
VectorSet< bNode * > get_selected_nodes(bNodeTree &node_tree)
void node_deselect_all_output_sockets(bNodeTree &node_tree, bool deselect_nodes)
float2 node_to_view(const float2 &co)
void node_insert_on_link_flags_clear(bNodeTree &node_tree)
static void add_dragged_links_to_tree(bContext &C, bNodeLinkDrag &nldrag)
static void remove_unavailable_links(bNodeTree &tree, bNodeSocket &socket)
static wmOperatorStatus node_parent_set_exec(bContext *C, wmOperator *)
void NODE_OT_link_make(wmOperatorType *ot)
void node_link_bezier_points_evaluated(const bNodeLink &link, std::array< float2, NODE_LINK_RESOL+1 > &coords)
wmKeyMap * node_link_modal_keymap(wmKeyConfig *keyconf)
static wmOperatorStatus node_make_link_exec(bContext *C, wmOperator *op)
void NODE_OT_join_nodes(wmOperatorType *ot)
static bNodeSocket * best_socket_output(bNodeTree *ntree, bNode *node, bNodeSocket *sock_target, const bool allow_multiple)
bNode * find_common_parent_node(Span< bNode * > nodes)
static int node_socket_count_links(const bNodeTree &ntree, const bNodeSocket &socket)
void node_to_updated_rect(const bNode &node, rctf &r_rect)
static bool should_create_drag_link_search_menu(const bNodeTree &node_tree, const bNodeLinkDrag &nldrag)
static void node_link_find_socket(bContext &C, wmOperator &op, const float2 &cursor)
void NODE_OT_link(wmOperatorType *ot)
void NODE_OT_links_mute(wmOperatorType *ot)
void node_insert_on_frame_flag_clear(SpaceNode &snode)
bNodeSocket * get_main_socket(bNodeTree &ntree, bNode &node, eNodeSocketInOut in_out)
static void node_join_attach_recursive(bNodeTree &ntree, MutableSpan< NodeJoinState > join_states, bNode *node, bNode *frame, const VectorSet< bNode * > &selected_nodes)
void update_multi_input_indices_for_removed_links(bNode &node)
void node_insert_on_link_flags(Main &bmain, SpaceNode &snode, bool is_new_node)
static void node_remove_existing_links_if_needed(bNodeLinkDrag &nldrag, bNodeTree &ntree)
static wmOperatorStatus cut_links_exec(bContext *C, wmOperator *op)
static bNode * get_selected_node_for_insertion(bNodeTree &node_tree)
static void draw_draglink_tooltip(const bContext *, ARegion *, void *arg)
void activate_geometry_node(Main &bmain, SpaceNode &snode, bNode &node, std::optional< int > item_identifier=std::nullopt)
T min(const T &a, const T &b)
void set_item_name_and_make_unique(bNode &node, typename Accessor::ItemT &item, const char *value)
Accessor::ItemT * find_item_by_identifier(bNode &node, const StringRef identifier)
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)
void update_node_declaration_and_sockets(bNodeTree &ntree, bNode &node, Main *bmain)
void get_color_4ubv(int colorid, unsigned char col[4])
void view2d_edge_pan_operator_properties_ex(wmOperatorType *ot, float inside_pad, float outside_pad, float speed_ramp, float max_speed, float delay, float zoom_influence)
void icon_draw_ex(float x, float y, int icon_id, float aspect, float alpha, float desaturate, const uchar mono_color[4], bool mono_border, const IconTextOverlay *text_overlay, const bool inverted=false, float scale=1.0f)
void view2d_region_to_view(const View2D *v2d, float x, float y, float *r_view_x, float *r_view_y) ATTR_NONNULL()
void view2d_region_to_view_rctf(const View2D *v2d, const rctf *rect_src, rctf *rect_dst) ATTR_NONNULL()
MINLINE float min_ff(float a, float b)
bool ED_node_is_compositor(const SpaceNode *snode)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
@ NODE_GEO_VIEWER_ITEM_FLAG_AUTO_REMOVE
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
ScrArea * CTX_wm_area(const bContext *C)
uint padding(uint offset, uint alignment)
bool ED_node_is_geometry(const SpaceNode *snode)
void BKE_ntree_update_tag_link_added(bNodeTree *ntree, bNodeLink *link)
bool BLI_rctf_isect_pt_v(const struct rctf *rect, const float xy[2])
wmKeyMap * WM_modalkeymap_find(wmKeyConfig *keyconf, const char *idname)
void BKE_ntree_update_tag_link_changed(bNodeTree *ntree)
PropertyRNA * RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identifier, const int len, const float *default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
MINLINE void copy_v2_v2(float r[2], const float a[2])
bool ED_operator_node_editable(bContext *C)
float BLI_easing_cubic_ease_in_out(float time, float begin, float change, float duration)
wmWindow * CTX_wm_window(const bContext *C)
PropertyRNA * RNA_def_collection_runtime(StructOrFunctionRNA *cont, const char *identifier, StructRNA *type, const char *ui_name, const char *ui_description)
MINLINE int max_ii(int a, int b)
void BKE_ntree_update_tag_link_removed(bNodeTree *ntree)
void ED_region_tag_redraw(ARegion *region)
float dist_squared_to_line_segment_v2(const float p[2], const float l1[2], const float l2[2])
void WM_gesture_lines_cancel(bContext *C, wmOperator *op)
wmOperatorStatus WM_gesture_lines_modal(bContext *C, wmOperator *op, const wmEvent *event)
void ED_preview_kill_jobs(wmWindowManager *wm, Main *bmain)
void * BLI_findlink(const ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
wmOperatorStatus WM_gesture_lines_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void * ED_region_draw_cb_activate(ARegionType *art, void(*draw)(const bContext *, ARegion *, void *), void *customdata, int type)
VecBase< int32_t, 2 > int2
VecBase< float, 2 > float2
bool ED_region_draw_cb_exit(ARegionType *art, void *handle)
void BKE_report(ReportList *reports, eReportType type, const char *message)
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
wmWindowManager * CTX_wm_manager(const bContext *C)
void BKE_main_ensure_invariants(Main &bmain, std::optional< Span< ID * > > modified_ids=std::nullopt)
bool BLI_rctf_inside_rctf(const rctf *rct_a, const rctf *rct_b)
SpaceNode * CTX_wm_space_node(const bContext *C)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_event_drag_start_mval(const wmEvent *event, const ARegion *region, int r_mval[2])
ARegion * BKE_area_find_region_type(const ScrArea *area, int region_type)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BKE_ntree_update_tag_node_property(bNodeTree *ntree, bNode *node)
Main * CTX_data_main(const bContext *C)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
BLI_INLINE float BLI_rctf_size_x(const struct rctf *rct)
@ NODE_VIEWER_SHORTCUT_NONE
bool BLI_rctf_isect(const struct rctf *src1, const struct rctf *src2, struct rctf *dest)
void BKE_ntree_update_tag_active_output_changed(bNodeTree *ntree)
void WM_modalkeymap_assign(wmKeyMap *km, const char *opname)
void WM_event_timer_remove(wmWindowManager *wm, wmWindow *, wmTimer *timer)
@ SNODE_INSERTOFS_DIR_RIGHT
wmKeyMap * WM_modalkeymap_ensure(wmKeyConfig *keyconf, const char *idname, const EnumPropertyItem *items)
@ OPTYPE_DEPENDS_ON_CURSOR
wmTimer * WM_event_timer_add(wmWindowManager *wm, wmWindow *win, const wmEventType event_type, const double time_step)
@ NODE_LINK_INSERT_TARGET
@ NODE_LINK_INSERT_TARGET_INVALID
@ NODE_LINK_TEMP_HIGHLIGHT
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
ARegion * CTX_wm_region(const bContext *C)
void ED_workspace_status_text(bContext *C, const char *str)
bool BLI_rctf_isect_segment(const struct rctf *rect, const float s1[2], const float s2[2])
void BLI_rctf_pad(struct rctf *rect, float pad_x, float pad_y)
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
void ED_area_tag_redraw(ScrArea *area)
#define NODE_INSOFS_ANIM_DURATION
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
bke::ARegionRuntime * runtime
eNodeSocketDatatype socket_type
struct bNodeTree * edittree
eSpaceNode_InsertOffsetDir insert_ofs_dir
struct bNodeTree * nodetree
ed::space_node::SpaceNode_Runtime * runtime
bke::bNodeSocketType * typeinfo
bke::bNodeSocketRuntime * runtime
struct bNodeSocket * next
ListBaseT< bNodeLink > links
bke::bNodeTreeType * typeinfo
ListBaseT< bNodeSocket > outputs
bke::bNodeRuntime * runtime
ListBaseT< bNodeSocket > inputs
bke::bNodeType * typeinfo
struct ARegionType * type
bool(*) validate_link(eNodeSocketDatatype from, eNodeSocketDatatype to)
bool(*) insert_link(NodeInsertLinkParams ¶ms)
float2 multi_socket_position
std::optional< int > frame_identifier_to_highlight
std::unique_ptr< bNodeLinkDrag > linkdrag
std::unique_ptr< NodeInsertOfsData > iofsd
Vector< bNodeLink > links
ui::View2DEdgePanData pan_data
bNodeSocket * hovered_socket
bNodeLink * last_picked_multi_input_socket_link
bNode * last_node_hovered_while_dragging_a_link
std::array< int, 2 > cursor
bNodeSocket * start_socket
static bool supports_socket_type(const eNodeSocketDatatype socket_type, const int ntree_type)
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
void(*) cancel(bContext *C, wmOperator *op)
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports