Cleanup: nodeToView & nodeFromView usage #105469

Closed
Iliya Katushenock wants to merge 5 commits from mod_moder:cleanup_no_to_view_usage into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
1 changed files with 6 additions and 12 deletions
Showing only changes of commit 614ec08dfd - Show all commits

View File

@ -45,15 +45,7 @@ static void create_transform_data_for_node(TransData &td,
const float dpi_fac)
{
float locx, locy;
/* account for parents (nested nodes) */
if (node.parent) {
nodeToView(node.parent, node.locx, node.locy, &locx, &locy);
}
else {
locx = node.locx;
locy = node.locy;
}
nodeToView(&node, node.offsetx, node.offsety, &locx, &locy);
/* use top-left corner as the transform origin for nodes */
/* Weirdo - but the node system is a mix of free 2d elements and DPI sensitive UI. */
@ -242,9 +234,11 @@ static void flushTransNodes(TransInfo *t)
loc[0] /= dpi_fac;
loc[1] /= dpi_fac;
/* account for parents (nested nodes) */
if (node->parent) {
nodeFromView(node->parent, loc[0], loc[1], &loc[0], &loc[1]);
loc[0] -= node->offsetx;
loc[1] -= node->offsety;
if (const bNode *parent_space = node->parent; parent_space != nullptr) {
mod_moder marked this conversation as resolved Outdated

The second parent_space != nullptr is unnecessary here in C++ as far as I know

The second `parent_space != nullptr` is unnecessary here in C++ as far as I know

I do this for greater clarity, but yes, we can consider it redundant

I do this for greater clarity, but yes, we can consider it redundant
nodeFromView(parent_space, loc[0], loc[1], &loc[0], &loc[1]);
}
node->locx = loc[0];