Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Fill <dominikfill>2022-02-18 21:22:51 +0300
committerHans Goudey <h.goudey@me.com>2022-02-18 21:22:51 +0300
commitd9d97db018d28f4c1ce7543ba275a9809d56294a (patch)
tree81a5af6e6a9d6ce12517ae4a9dd02690631a3905 /source/blender/editors/space_node/node_edit.cc
parent07fbf3108b1eb111ddcc1f164f73b31520716147 (diff)
Fix T87829, T95331: Issues when nodes too close together
This patch aims to fix the issues presented in T87829 and T95331, namely precision issues while connecting two nodes when being too close together in the node editor editors, in a few cases even resulting in the complete inability to connect nodes. Sockets are found by intersecting a padded rect around the cursor with the nodes' sockets' location. That creates ambiguities, as it's possible for the padded rect to intersect with the wrong node, as the distance between two nodes is smaller than the rect is padded. The fix in this patch is checking against an unpadded rectangle in visible_node(). Differential Revision: https://developer.blender.org/D14122
Diffstat (limited to 'source/blender/editors/space_node/node_edit.cc')
-rw-r--r--source/blender/editors/space_node/node_edit.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc
index 7b7aaef518b..64f6e8bdf18 100644
--- a/source/blender/editors/space_node/node_edit.cc
+++ b/source/blender/editors/space_node/node_edit.cc
@@ -1160,12 +1160,16 @@ bool node_find_indicated_socket(SpaceNode &snode,
{
rctf rect;
+ const float size_sock_padded = NODE_SOCKSIZE + 4;
+
*nodep = nullptr;
*sockp = nullptr;
/* check if we click in a socket */
LISTBASE_FOREACH (bNode *, node, &snode.edittree->nodes) {
- BLI_rctf_init_pt_radius(&rect, cursor, NODE_SOCKSIZE + 4);
+ BLI_rctf_init_pt_radius(&rect, cursor, size_sock_padded);
+ rctf node_visible;
+ BLI_rctf_init_pt_radius(&node_visible, cursor, size_sock_padded);
if (!(node->flag & NODE_HIDDEN)) {
/* extra padding inside and out - allow dragging on the text areas too */
@@ -1184,7 +1188,7 @@ bool node_find_indicated_socket(SpaceNode &snode,
if (!nodeSocketIsHidden(sock)) {
if (sock->flag & SOCK_MULTI_INPUT && !(node->flag & NODE_HIDDEN)) {
if (cursor_isect_multi_input_socket(cursor, *sock)) {
- if (node == visible_node(snode, rect)) {
+ if (node == visible_node(snode, node_visible)) {
*nodep = node;
*sockp = sock;
return true;
@@ -1192,7 +1196,7 @@ bool node_find_indicated_socket(SpaceNode &snode,
}
}
else if (BLI_rctf_isect_pt(&rect, sock->locx, sock->locy)) {
- if (node == visible_node(snode, rect)) {
+ if (node == visible_node(snode, node_visible)) {
*nodep = node;
*sockp = sock;
return true;
@@ -1205,7 +1209,7 @@ bool node_find_indicated_socket(SpaceNode &snode,
LISTBASE_FOREACH (bNodeSocket *, sock, &node->outputs) {
if (!nodeSocketIsHidden(sock)) {
if (BLI_rctf_isect_pt(&rect, sock->locx, sock->locy)) {
- if (node == visible_node(snode, rect)) {
+ if (node == visible_node(snode, node_visible)) {
*nodep = node;
*sockp = sock;
return true;