Fix T88411: Draw frame node text when label is empty
This patch fixes the issue described in T88411, that the text in frame nodes is only shown, when the node has a label. This has been caused by rB8f04ddbbc626, because `node_draw_frame_label` not only draws the label, but also all the other text. Therefore skipping it, when the label is empty, also skips drawing the other text. This is fixed by moving the check for the empty label into `node_frame_draw_label`. **Patch:** Frame nodes show text despite not having a label. {F10286204, size = full} **Same setup in master:** {F10128099, size = full} **Test file** {F10128102} Reviewed By: #user_interface, pablovazquez Maniphest Tasks: T88411 Differential Revision: https://developer.blender.org/D11315
This commit is contained in:
parent
ae334532cf
commit
ac97893dfc
Notes:
blender-bot
2023-02-13 18:39:00 +01:00
Referenced by issue #88411, Text in Frame's node won't render if Label is empty
|
@ -362,8 +362,12 @@ static void node_draw_frame_label(bNodeTree *ntree, bNode *node, const float asp
|
|||
float x = BLI_rctf_cent_x(rct) - (0.5f * width);
|
||||
float y = rct->ymax - label_height;
|
||||
|
||||
BLF_position(fontid, x, y, 0);
|
||||
BLF_draw(fontid, label, BLF_DRAW_STR_DUMMY_MAX);
|
||||
/* label */
|
||||
const bool has_label = node->label[0] != '\0';
|
||||
if (has_label) {
|
||||
BLF_position(fontid, x, y, 0);
|
||||
BLF_draw(fontid, label, BLF_DRAW_STR_DUMMY_MAX);
|
||||
}
|
||||
|
||||
/* draw text body */
|
||||
if (node->id) {
|
||||
|
@ -374,7 +378,8 @@ static void node_draw_frame_label(bNodeTree *ntree, bNode *node, const float asp
|
|||
|
||||
/* 'x' doesn't need aspect correction */
|
||||
x = rct->xmin + margin;
|
||||
y = rct->ymax - (label_height + line_spacing);
|
||||
y = rct->ymax - label_height - (has_label ? line_spacing : 0);
|
||||
|
||||
/* early exit */
|
||||
int y_min = y + ((margin * 2) - (y - rct->ymin));
|
||||
|
||||
|
@ -455,10 +460,8 @@ static void node_draw_frame(const bContext *C,
|
|||
UI_draw_roundbox_aa(rct, false, BASIS_RAD, color);
|
||||
}
|
||||
|
||||
/* label */
|
||||
if (node->label[0] != '\0') {
|
||||
node_draw_frame_label(ntree, node, snode->runtime->aspect);
|
||||
}
|
||||
/* label and text */
|
||||
node_draw_frame_label(ntree, node, snode->runtime->aspect);
|
||||
|
||||
UI_block_end(C, node->block);
|
||||
UI_block_draw(C, node->block);
|
||||
|
|
Loading…
Reference in New Issue