Cleanup: Remove ifdef'd node transform code

This has been turned off since 2013.
This commit is contained in:
Hans Goudey 2022-12-12 17:09:58 -06:00
parent e41abf9e26
commit 57090a4b72
3 changed files with 2 additions and 33 deletions

View File

@ -23,10 +23,6 @@
extern "C" {
#endif
/* use node center for transform instead of upper-left corner.
* disabled since it makes absolute snapping not work so nicely
*/
// #define USE_NODE_CENTER
/* -------------------------------------------------------------------- */
/** \name Types/

View File

@ -57,13 +57,8 @@ static void create_transform_data_for_node(TransData &td,
/* 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. */
#ifdef USE_NODE_CENTER
td2d.loc[0] = (locx * dpi_fac) + (BLI_rctf_size_x(&node.runtime->totr) * +0.5f);
td2d.loc[1] = (locy * dpi_fac) + (BLI_rctf_size_y(&node.runtime->totr) * -0.5f);
#else
td2d.loc[0] = locx * dpi_fac;
td2d.loc[1] = locy * dpi_fac;
#endif
td2d.loc[2] = 0.0f;
td2d.loc2d = td2d.loc; /* current location */
@ -235,11 +230,6 @@ static void flushTransNodes(TransInfo *t)
float loc[2];
add_v2_v2v2(loc, td2d->loc, offset);
#ifdef USE_NODE_CENTER
loc[0] -= 0.5f * BLI_rctf_size_x(&node->runtime->totr);
loc[1] += 0.5f * BLI_rctf_size_y(&node->runtime->totr);
#endif
/* Weirdo - but the node system is a mix of free 2d elements and DPI sensitive UI. */
loc[0] /= dpi_fac;
loc[1] /= dpi_fac;

View File

@ -1190,36 +1190,19 @@ static void TargetSnapOffset(TransInfo *t, TransData *td)
if (t->spacetype == SPACE_NODE && td != nullptr) {
bNode *node = static_cast<bNode *>(td->extra);
char border = t->tsnap.snapNodeBorder;
float width = BLI_rctf_size_x(&node->runtime->totr);
float height = BLI_rctf_size_y(&node->runtime->totr);
#ifdef USE_NODE_CENTER
if (border & NODE_LEFT) {
t->tsnap.snapTarget[0] -= 0.5f * width;
}
if (border & NODE_RIGHT) {
t->tsnap.snapTarget[0] += 0.5f * width;
}
if (border & NODE_BOTTOM) {
t->tsnap.snapTarget[1] -= 0.5f * height;
}
if (border & NODE_TOP) {
t->tsnap.snapTarget[1] += 0.5f * height;
}
#else
if (border & NODE_LEFT) {
t->tsnap.snapTarget[0] -= 0.0f;
}
if (border & NODE_RIGHT) {
t->tsnap.snapTarget[0] += width;
t->tsnap.snapTarget[0] += BLI_rctf_size_x(&node->runtime->totr);
}
if (border & NODE_BOTTOM) {
t->tsnap.snapTarget[1] -= height;
t->tsnap.snapTarget[1] -= BLI_rctf_size_y(&node->runtime->totr);
}
if (border & NODE_TOP) {
t->tsnap.snapTarget[1] += 0.0f;
}
#endif
}
}