Fix T103624: Last node is skipped for cursor and link picking

I wrote the reverse iteration incorrectly in e091291b5b.
This commit is contained in:
Hans Goudey 2023-01-04 10:06:10 -05:00
parent 22fec7b1a4
commit 20b2d6fc71
Notes: blender-bot 2023-02-14 08:29:54 +01:00
Referenced by issue #103637, Nodes can no longer be connected in node editors
Referenced by issue #103624, Regression: Nodes created by the "Use Nodes" button initially can't accept inputs
2 changed files with 2 additions and 2 deletions

View File

@ -2601,7 +2601,7 @@ static const bNode *find_node_under_cursor(SpaceNode &snode, const float2 &curso
{
/* Check nodes front to back. */
const Span<bNode *> nodes = snode.edittree->all_nodes();
for (int i = nodes.index_range().last(); i > 0; i--) {
for (int i = nodes.index_range().last(); i >= 0; i--) {
if (BLI_rctf_isect_pt(&nodes[i]->runtime->totr, cursor[0], cursor[1])) {
return nodes[i];
}

View File

@ -1130,7 +1130,7 @@ bNodeSocket *node_find_indicated_socket(SpaceNode &snode,
snode.edittree->ensure_topology_cache();
const Span<bNode *> nodes = snode.edittree->all_nodes();
for (int i = nodes.index_range().last(); i > 0; i--) {
for (int i = nodes.index_range().last(); i >= 0; i--) {
bNode &node = *nodes[i];
BLI_rctf_init_pt_radius(&rect, cursor, size_sock_padded);