From 72822b60bcef47328c8997aab5c28f54ac460413 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Fri, 3 Mar 2023 12:19:45 +0100 Subject: [PATCH] Fix #105363: Frame nodes can act wrong in transform system When multiple nodes (Frame nodes included in the selection) are scaled/ rotated, the TransData location and center can get "wrong" due to the fact that Frame nodes dont only use `locx`/`locy` for their representation while drawing, but also `offsetx`/`offsety`. So in order to use the "real" top-left corner in the transform system, we have to respect `offsetx`/`offsety` when creating/flushing transform data. In addition to the file in the report, this patch was also tested to work well with nested Frame nodes. --- .../transform/transform_convert_node.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/source/blender/editors/transform/transform_convert_node.cc b/source/blender/editors/transform/transform_convert_node.cc index 13095ff6f5a..5ac672dbf50 100644 --- a/source/blender/editors/transform/transform_convert_node.cc +++ b/source/blender/editors/transform/transform_convert_node.cc @@ -48,11 +48,11 @@ static void create_transform_data_for_node(TransData &td, /* account for parents (nested nodes) */ if (node.parent) { - nodeToView(node.parent, node.locx, node.locy, &locx, &locy); + nodeToView(node.parent, node.locx + node.offsetx, node.locy + node.offsety, &locx, &locy); } else { - locx = node.locx; - locy = node.locy; + locx = node.locx + node.offsetx; + locy = node.locy + node.offsety; } /* use top-left corner as the transform origin for nodes */ @@ -244,11 +244,16 @@ static void flushTransNodes(TransInfo *t) /* account for parents (nested nodes) */ if (node->parent) { - nodeFromView(node->parent, loc[0], loc[1], &loc[0], &loc[1]); + nodeFromView(node->parent, + loc[0] - node->offsetx, + loc[1] - node->offsety, + &node->locx, + &node->locy); + } + else { + node->locx = loc[0] - node->offsetx; + node->locy = loc[1] - node->offsety; } - - node->locx = loc[0]; - node->locy = loc[1]; } /* handle intersection with noodles */ -- 2.30.2