Fix: Nodes: draw frame labels on top of links

A frame label that is hidden by links is not all that helpful.
On the other hand, if a link is partially hidden by a frame label,
that's typically not a problem at all.
This commit is contained in:
Jacques Lucke
2025-05-07 05:56:10 +02:00
parent 5fb8c8caa5
commit 72f7d3dec7

View File

@@ -4700,12 +4700,9 @@ static void find_bounds_by_zone_recursive(const SpaceNode &snode,
}
}
static void node_draw_zones_and_frames(const bContext &C,
TreeDrawContext &tree_draw_ctx,
const ARegion &region,
static void node_draw_zones_and_frames(const ARegion &region,
const SpaceNode &snode,
const bNodeTree &ntree,
Span<uiBlock *> blocks)
const bNodeTree &ntree)
{
const bNodeTreeZones *zones = ntree.zones();
const int zones_num = zones ? zones->zones.size() : 0;
@@ -4844,13 +4841,17 @@ static void node_draw_zones_and_frames(const bContext &C,
}
GPU_blend(GPU_BLEND_NONE);
}
/* Draw text on frame nodes. */
for (const ZoneOrNode &zone_or_node : draw_order) {
if (const bNode *const *node_p = std::get_if<const bNode *>(&zone_or_node)) {
const bNode &node = **node_p;
frame_node_draw_overlay(C, tree_draw_ctx, region, snode, ntree, node, *blocks[node.index()]);
}
static void draw_frame_overlays(const bContext &C,
TreeDrawContext &tree_draw_ctx,
const ARegion &region,
const SpaceNode &snode,
const bNodeTree &ntree,
Span<uiBlock *> blocks)
{
for (const bNode *node : ntree.nodes_by_type("NodeFrame")) {
frame_node_draw_overlay(C, tree_draw_ctx, region, snode, ntree, *node, *blocks[node->index()]);
}
}
@@ -4897,6 +4898,8 @@ static void node_draw_nodetree(const bContext &C,
nodelink_batch_end(snode);
GPU_blend(GPU_BLEND_NONE);
draw_frame_overlays(C, tree_draw_ctx, region, snode, ntree, blocks);
/* Draw foreground nodes, last nodes in front. */
for (const int i : nodes.index_range()) {
bNode &node = *nodes[i];
@@ -5034,7 +5037,7 @@ static void draw_nodetree(const bContext &C,
}
node_update_nodetree(C, tree_draw_ctx, ntree, nodes, blocks);
node_draw_zones_and_frames(C, tree_draw_ctx, region, *snode, ntree, blocks);
node_draw_zones_and_frames(region, *snode, ntree);
node_draw_nodetree(C, tree_draw_ctx, region, *snode, ntree, nodes, blocks, parent_key);
}