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.

Pull Request: https://projects.blender.org/blender/blender/pulls/105400
This commit is contained in:
Philipp Oeser
2023-03-17 12:42:04 +01:00
committed by Philipp Oeser
parent 1929862ad6
commit 6d3ce8273a

View File

@@ -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 */