diff options
author | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-11-12 22:17:58 +0400 |
---|---|---|
committer | Lukas Toenne <lukas.toenne@googlemail.com> | 2013-11-12 22:17:58 +0400 |
commit | 8663b940eda703c45baf664c9aa379a9ecb684f9 (patch) | |
tree | f3f873d4bb7facefe1534799f43b94b464d0a1ab /source/blender/editors/space_node | |
parent | ba7fd8cd5c173730c8c2250eac7ea48fafd519c7 (diff) |
Instead of requiring a const char* return from the (optional) node label callback function, let it write into a mutable string buffer. This will allow actual dynamic labels for nodes using the python
API.
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_draw.c | 6 |
2 files changed, 6 insertions, 4 deletions
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 1af800ebf24..e7a08d2c626 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -391,12 +391,14 @@ static void node_draw_frame_label(bNode *node, const float aspect) NodeFrame *data = (NodeFrame *)node->storage; rctf *rct = &node->totr; int color_id = node_get_colorid(node); - const char *label = nodeLabel(node); + char label[MAX_NAME]; /* XXX a bit hacky, should use separate align values for x and y */ float width, ascender; float x, y; const int font_size = data->label_size / aspect; + nodeLabel(node, label, sizeof(label)); + BLF_enable(fontid, BLF_ASPECT); BLF_aspect(fontid, aspect, aspect, 1.0f); BLF_size(fontid, MIN2(24, font_size), U.dpi); /* clamp otherwise it can suck up a LOT of memory */ diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index e031e056cd3..f4ffeb05608 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -868,7 +868,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN UI_ThemeColor(TH_TEXT); #endif - BLI_strncpy(showname, nodeLabel(node), sizeof(showname)); + nodeLabel(node, showname, sizeof(showname)); //if (node->flag & NODE_MUTED) // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); /* XXX - don't print into self! */ @@ -1035,8 +1035,8 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b UI_ThemeColor(TH_TEXT); if (node->miniwidth > 0.0f) { - BLI_strncpy(showname, nodeLabel(node), sizeof(showname)); - + nodeLabel(node, showname, sizeof(showname)); + //if (node->flag & NODE_MUTED) // BLI_snprintf(showname, sizeof(showname), "[%s]", showname); /* XXX - don't print into self! */ |