Nodes: Remove wrong tweak handling for reroutes

Remove `node_under_mouse_tweak` and replace it with
`node_under_mouse_select`.

The special handling for tweaking reroutes wasn't working correctly:
1. It didn't check at the correct reroute node location.
2. The (de-)selection behavior negated possible benefits anyway.

In practice the user-facing behavior is not affected by this.

Pull Request: https://projects.blender.org/blender/blender/pulls/130222
This commit is contained in:
Leon Schittek
2024-11-13 14:51:08 +01:00
committed by Hans Goudey
parent 49c6a0320c
commit cff7130fc2

View File

@@ -146,37 +146,9 @@ static bNode *node_under_mouse_select(const SpaceNode &snode, const float2 mouse
return nullptr;
}
static bool node_under_mouse_tweak(const SpaceNode &snode, const float2 &mouse)
{
for (bNode *node : tree_draw_order_calc_nodes_reversed(*snode.edittree)) {
switch (node->type) {
case NODE_REROUTE: {
const float2 location = node_to_view(*node, {node->locx, node->locy});
if (math::distance_squared(mouse, location) < square_f(24.0f)) {
return true;
}
break;
}
case NODE_FRAME: {
if (node_frame_select_isect_mouse(snode, *node, mouse)) {
return true;
}
break;
}
default: {
if (BLI_rctf_isect_pt(&node->runtime->totr, mouse.x, mouse.y)) {
return true;
}
break;
}
}
}
return false;
}
static bool is_position_over_node_or_socket(SpaceNode &snode, ARegion &region, const float2 &mouse)
{
if (node_under_mouse_tweak(snode, mouse)) {
if (node_under_mouse_select(snode, mouse)) {
return true;
}
if (node_find_indicated_socket(snode, region, mouse, SOCK_IN | SOCK_OUT)) {