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:
authorLeon Schittek <leon.schittek@gmx.net>2022-10-06 08:32:04 +0300
committerLeon Schittek <leon.schittek@gmx.net>2022-10-06 08:35:35 +0300
commit707c7de21f0bc9a1ca4e71ef4819dafada5542ac (patch)
tree2d2e441c30c0dd986ce12b66b589528654c30456 /source/blender/editors/space_node
parentc2c31afa929f07979acbb19528c93d5a4f61a21f (diff)
Fix T101628: Correct frame node intersection in add reroute operator
Fix reroute nodes added via the cut link gesture being parented to the wrong frame node. The frame's bounds that are used for the intersection test with the newly added reroute are in view space, but the reroute's location was given in the node tree's coordinate space, when the add reroute operator was recently refactored (56193eccf646). Reviewed By: Hans Goudey Differential Revision: http://developer.blender.org/D16163
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r--source/blender/editors/space_node/node_add.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/editors/space_node/node_add.cc b/source/blender/editors/space_node/node_add.cc
index 943fc99a7f6..07eecff320a 100644
--- a/source/blender/editors/space_node/node_add.cc
+++ b/source/blender/editors/space_node/node_add.cc
@@ -194,15 +194,16 @@ static int add_reroute_exec(bContext *C, wmOperator *op)
}
/* Place the new reroute at the average location of all connected cuts. */
- const float2 loc = std::accumulate(cuts.values().begin(), cuts.values().end(), float2(0)) /
- cuts.size() / UI_DPI_FAC;
- reroute->locx = loc.x;
- reroute->locy = loc.y;
+ const float2 insert_point = std::accumulate(
+ cuts.values().begin(), cuts.values().end(), float2(0)) /
+ cuts.size();
+ reroute->locx = insert_point.x / UI_DPI_FAC;
+ reroute->locy = insert_point.y / UI_DPI_FAC;
/* Attach the reroute node to frame nodes behind it. */
for (const int i : frame_nodes.index_range()) {
bNode *frame_node = frame_nodes.last(i);
- if (BLI_rctf_isect_pt_v(&frame_node->totr, loc)) {
+ if (BLI_rctf_isect_pt_v(&frame_node->totr, insert_point)) {
nodeAttachNode(reroute, frame_node);
break;
}