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:
authorHans Goudey <h.goudey@me.com>2021-12-11 18:51:53 +0300
committerHans Goudey <h.goudey@me.com>2021-12-11 18:51:53 +0300
commit23be5fd4499ad92c049f140564df3e32cfe9cea3 (patch)
tree6210af745bb492331c2d3ca5aa500bf16447592a /source/blender/editors/space_node
parent96387a2eff97709f519274aa510942c5eec6b493 (diff)
Cleanup: Use const arguments
Also remove unnecessary function to set a node type's label function that duplicated its definition, and make another function static.
Diffstat (limited to 'source/blender/editors/space_node')
-rw-r--r--source/blender/editors/space_node/node_draw.cc20
-rw-r--r--source/blender/editors/space_node/node_intern.hh1
-rw-r--r--source/blender/editors/space_node/node_templates.cc2
3 files changed, 13 insertions, 10 deletions
diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc
index 77fccdaf910..5990462191e 100644
--- a/source/blender/editors/space_node/node_draw.cc
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -651,7 +651,7 @@ static void node_update_hidden(bNode &node)
node.totr.ymax);
}
-int node_get_colorid(bNode &node)
+static int node_get_colorid(const bNode &node)
{
switch (node.typeinfo->nclass) {
case NODE_CLASS_INPUT:
@@ -1502,8 +1502,10 @@ static char *node_errors_tooltip_fn(bContext *UNUSED(C), void *argN, const char
#define NODE_HEADER_ICON_SIZE (0.8f * U.widget_unit)
-static void node_add_error_message_button(
- const bContext &C, bNodeTree &UNUSED(ntree), bNode &node, const rctf &rect, float &icon_offset)
+static void node_add_error_message_button(const bContext &C,
+ bNode &node,
+ const rctf &rect,
+ float &icon_offset)
{
SpaceNode *snode = CTX_wm_space_node(&C);
const geo_log::NodeLog *node_log = geo_log::ModifierLog::find_node_by_node_editor_context(*snode,
@@ -1902,7 +1904,7 @@ static void node_draw_basis(const bContext &C,
UI_block_emboss_set(node.block, UI_EMBOSS);
}
- node_add_error_message_button(C, ntree, node, rct, iconofs);
+ node_add_error_message_button(C, node, rct, iconofs);
/* Title. */
if (node.flag & SELECT) {
@@ -2420,12 +2422,14 @@ void node_update_nodetree(const bContext &C, bNodeTree &ntree)
}
}
-static void frame_node_draw_label(bNodeTree &ntree, bNode &node, const SpaceNode &snode)
+static void frame_node_draw_label(const bNodeTree &ntree,
+ const bNode &node,
+ const SpaceNode &snode)
{
const float aspect = snode.runtime->aspect;
/* XXX font id is crap design */
const int fontid = UI_style_get()->widgetlabel.uifont_id;
- NodeFrame *data = (NodeFrame *)node.storage;
+ const NodeFrame *data = (const NodeFrame *)node.storage;
const float font_size = data->label_size / aspect;
char label[MAX_NAME];
@@ -2462,7 +2466,7 @@ static void frame_node_draw_label(bNodeTree &ntree, bNode &node, const SpaceNode
/* draw text body */
if (node.id) {
- Text *text = (Text *)node.id;
+ const Text *text = (const Text *)node.id;
const int line_height_max = BLF_height_max(fontid);
const float line_spacing = (line_height_max * aspect);
const float line_width = (BLI_rctf_size_x(&rct) - margin) / aspect;
@@ -2484,7 +2488,7 @@ static void frame_node_draw_label(bNodeTree &ntree, bNode &node, const SpaceNode
BLF_wordwrap(fontid, line_width);
- LISTBASE_FOREACH (TextLine *, line, &text->lines) {
+ LISTBASE_FOREACH (const TextLine *, line, &text->lines) {
struct ResultBLF info;
if (line->line[0]) {
BLF_position(fontid, x, y, 0);
diff --git a/source/blender/editors/space_node/node_intern.hh b/source/blender/editors/space_node/node_intern.hh
index cabe78067f4..3024f64b0b5 100644
--- a/source/blender/editors/space_node/node_intern.hh
+++ b/source/blender/editors/space_node/node_intern.hh
@@ -99,7 +99,6 @@ blender::float2 node_link_calculate_multi_input_position(const blender::float2 &
int index,
int total_inputs);
-int node_get_colorid(bNode &node);
int node_get_resize_cursor(NodeResizeDirection directions);
NodeResizeDirection node_get_resize_direction(const bNode *node, const int x, const int y);
/**
diff --git a/source/blender/editors/space_node/node_templates.cc b/source/blender/editors/space_node/node_templates.cc
index 3a43386c6bf..6c517a7b17d 100644
--- a/source/blender/editors/space_node/node_templates.cc
+++ b/source/blender/editors/space_node/node_templates.cc
@@ -447,7 +447,7 @@ static void ui_node_link(bContext *C, void *arg_p, void *event_p)
ED_undo_push(C, "Node input modify");
}
-static void ui_node_sock_name(bNodeTree *ntree, bNodeSocket *sock, char name[UI_MAX_NAME_STR])
+static void ui_node_sock_name(const bNodeTree *ntree, bNodeSocket *sock, char name[UI_MAX_NAME_STR])
{
if (sock->link && sock->link->fromnode) {
bNode *node = sock->link->fromnode;