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:
authorHans Goudey <h.goudey@me.com>2022-09-03 00:43:12 +0300
committerHans Goudey <h.goudey@me.com>2022-09-03 01:46:38 +0300
commitdf40440d22390a86c59e0e9fcc0db5dcfaa8cc11 (patch)
tree7c94ba94248983a604d400a25e0b229e1a8564bb
parentcd10fb4826f383fed659aa37db96424569747dd2 (diff)
Cleanup: Avoid using node socket location
The location of a reroute node and its sockets should be the same, only stored in different coordinate spaces. Because the node's location is the ground truth, use that for finding whether the mouse is hovering.
-rw-r--r--source/blender/editors/space_node/node_select.cc7
1 files changed, 2 insertions, 5 deletions
diff --git a/source/blender/editors/space_node/node_select.cc b/source/blender/editors/space_node/node_select.cc
index 29a809b8053..8cc3c80fdfd 100644
--- a/source/blender/editors/space_node/node_select.cc
+++ b/source/blender/editors/space_node/node_select.cc
@@ -141,14 +141,11 @@ static bNode *node_under_mouse_select(bNodeTree &ntree, const float2 mouse)
static bool node_under_mouse_tweak(const bNodeTree &ntree, const float2 &mouse)
{
- using namespace blender::math;
-
LISTBASE_FOREACH_BACKWARD (const bNode *, node, &ntree.nodes) {
switch (node->type) {
case NODE_REROUTE: {
- bNodeSocket *socket = (bNodeSocket *)node->inputs.first;
- const float2 location{socket->locx, socket->locy};
- if (distance(mouse, location) < 24.0f) {
+ const float2 location = node_to_view(*node, {node->locx, node->locy});
+ if (math::distance(mouse, location) < 24.0f) {
return true;
}
break;