Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeon Leno <lone_noel>2021-09-03 17:13:29 +0300
committerPablo Vazquez <pablo@blender.org>2021-09-03 17:18:40 +0300
commitac97893dfc77fd77e0254a0a4692820c7dbc6967 (patch)
treee2b40405e21bf8b294a97ea13ca68475c5160d22
parentae334532cffb2dd9074454b9a7ba095430f18735 (diff)
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
-rw-r--r--source/blender/editors/space_node/drawnode.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc
index 0f7a911e3ce..4b859de0ac9 100644
--- a/source/blender/editors/space_node/drawnode.cc
+++ b/source/blender/editors/space_node/drawnode.cc
@@ -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);