Cleanup: float2 in nodeToView & nodeFromView in BKE_node.hh #108956
|
@ -314,8 +314,8 @@ static Array<uiBlock *> node_uiblocks_init(const bContext &C, const Span<bNode *
|
|||
|
||||
float2 node_to_view(const bNode &node, const float2 &co)
|
||||
{
|
||||
const float2 result = bke::nodeToView(&node, co);
|
||||
return result * UI_SCALE_FAC;
|
||||
const float2 node_location = bke::nodeToView(&node, co);
|
||||
return node_location * UI_SCALE_FAC;
|
||||
}
|
||||
|
||||
void node_to_updated_rect(const bNode &node, rctf &r_rect)
|
||||
|
@ -331,9 +331,9 @@ void node_to_updated_rect(const bNode &node, rctf &r_rect)
|
|||
|
||||
float2 node_from_view(const bNode &node, const float2 &co)
|
||||
{
|
||||
const float2 co_scaled = co / UI_SCALE_FAC;
|
||||
const float2 result = bke::nodeFromView(&node, co_scaled);
|
||||
return result;
|
||||
const float2 node_location = co / UI_SCALE_FAC;
|
||||
return bke::nodeFromView(&node, node_location);
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -47,11 +47,9 @@ static void create_transform_data_for_node(TransData &td,
|
|||
bNode &node,
|
||||
const float dpi_fac)
|
||||
{
|
||||
blender::float2 loc;
|
||||
|
||||
const blender::float2 node_offset = {node.offsetx, node.offsety};
|
||||
/* account for parents (nested nodes) */
|
||||
loc = blender::bke::nodeToView(node.parent, blender::math::round(node_offset));
|
||||
const blender::float2 node_offset = {node.offsetx, node.offsety};
|
||||
blender::float2 loc = blender::bke::nodeToView(&node, blender::math::round(node_offset));
|
||||
loc *= dpi_fac;
|
||||
|
||||
/* use top-left corner as the transform origin for nodes */
|
||||
|
@ -242,11 +240,11 @@ static void flushTransNodes(TransInfo *t)
|
|||
loc /= dpi_fac;
|
||||
|
||||
/* account for parents (nested nodes) */
|
||||
blender::float2 offset = blender::bke::nodeFromView(node, {});
|
||||
offset = blender::math::round(offset);
|
||||
offset += loc;
|
||||
node->locx = offset.x;
|
||||
node->locy = offset.y;
|
||||
const blender::float2 node_offset = {node->offsetx, node->offsety};
|
||||
const blender::float2 new_node_location = loc - blender::math::round(node_offset);
|
||||
const blender::float2 location = blender::bke::nodeFromView(node->parent, new_node_location);
|
||||
node->locx = location.x;
|
||||
node->locy = location.y;
|
||||
}
|
||||
|
||||
/* handle intersection with noodles */
|
||||
|
|
Loading…
Reference in New Issue