Fix #106097: Don't offset child nodes when pasting

Nodes inside of frames where pasted with an offset from the cursor.
Since the location of nodes is in parent space, child nodes don't need
to be offset separately.

Pull Request: https://projects.blender.org/blender/blender/pulls/106099
This commit is contained in:
Leon Schittek
2023-03-24 12:47:54 +01:00
committed by Hans Goudey
parent cb4f7cac24
commit 22a3eb47ec

View File

@@ -263,8 +263,11 @@ static int node_clipboard_paste_exec(bContext *C, wmOperator *op)
const float2 offset = (mouse_location - center) / UI_DPI_FAC;
for (bNode *new_node : node_map.values()) {
new_node->locx += offset.x;
new_node->locy += offset.y;
/* Skip the offset for parented nodes since the location is in parent space. */
if (new_node->parent == nullptr) {
new_node->locx += offset.x;
new_node->locy += offset.y;
}
}
}