1
1

Fix T94173: Missing update for frame node size

Before d56bbfea7b, nodes were updated (size calculated and
buttons added) in reverse order. Instead, now calculate the size of
frame nodes after all other nodes. Separating the drawing further
may be a good step to removing the O(n^2) loop later on.
This commit is contained in:
2021-12-18 13:27:05 -06:00
parent 4c3f57ffa7
commit d15d512a68

View File

@@ -2418,9 +2418,11 @@ static void node_update_nodetree(const bContext &C,
bNode &node = *nodes[i];
uiBlock &block = *blocks[i];
if (node.type == NODE_FRAME) {
frame_node_prepare_for_draw(node, nodes);
/* Frame sizes are calculated after all other nodes have calculating their #totr. */
continue;
}
else if (node.type == NODE_REROUTE) {
if (node.type == NODE_REROUTE) {
reroute_node_prepare_for_draw(node);
}
else {
@@ -2432,6 +2434,13 @@ static void node_update_nodetree(const bContext &C,
}
}
}
/* Now calculate the size of frame nodes, which can depend on the size of other nodes. */
for (const int i : nodes.index_range()) {
if (nodes[i]->type == NODE_FRAME) {
frame_node_prepare_for_draw(*nodes[i], nodes);
}
}
}
static void frame_node_draw_label(const bNodeTree &ntree,