Fix #105363: Frame nodes can act wrong in transform system #105400

Merged
Philipp Oeser merged 1 commits from lichtwerk/blender:105363 into blender-v3.5-release 2023-03-17 12:42:16 +01:00
1 changed files with 12 additions and 7 deletions

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;
}
mod_moder marked this conversation as resolved

This looks strange. The parent check already happens in the nodeToView implementation. The whole if can be replaced with

float locx, locy;
nodeToView(node, node.offsetx, node.offsety, &locx, &locy);
...

Same for nodeFromView below

This looks strange. The parent check already happens in the `nodeToView` implementation. The whole if can be replaced with ``` float locx, locy; nodeToView(node, node.offsetx, node.offsety, &locx, &locy); ... ``` Same for `nodeFromView` below
Review

Yeah, could be done, the nodeFromView case would need a bit of additional tweaking, but as you also mentioned, would keep the cleanup separate from the fix here.

Yeah, could be done, the `nodeFromView` case would need a bit of additional tweaking, but as you also mentioned, would keep the cleanup separate from the fix here.
/* 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 */