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
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.
-rw-r--r--source/blender/blenkernel/BKE_node.h10
-rw-r--r--source/blender/blenkernel/intern/node.cc9
-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
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c4
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_common.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_filter.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_image.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mask.cc7
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_math.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_mixrgb.cc2
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc4
-rw-r--r--source/blender/nodes/function/nodes/node_fn_boolean_math.cc7
-rw-r--r--source/blender/nodes/function/nodes/node_fn_compare.cc7
-rw-r--r--source/blender/nodes/function/nodes/node_fn_float_to_int.cc7
-rw-r--r--source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_math.cc7
-rw-r--r--source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_vector_math.cc6
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_common.cc2
-rw-r--r--source/blender/nodes/intern/node_common.cc2
-rw-r--r--source/blender/nodes/intern/node_common.h5
-rw-r--r--source/blender/nodes/intern/node_util.c13
-rw-r--r--source/blender/nodes/intern/node_util.h25
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_common.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_math.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_environment.c2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_tex_image.cc2
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_vector_math.cc2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_common.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_image.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_math.c2
-rw-r--r--source/blender/nodes/texture/nodes/node_texture_mixRgb.c2
33 files changed, 100 insertions, 68 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 0902e6867a2..777cc807423 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -258,7 +258,10 @@ typedef struct bNodeType {
* Optional custom label function for the node header.
* \note Used as a fallback when #bNode.label isn't set.
*/
- void (*labelfunc)(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
+ void (*labelfunc)(const struct bNodeTree *ntree,
+ const struct bNode *node,
+ char *label,
+ int maxlen);
/** Called when the node is updated in the editor. */
void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node);
@@ -967,7 +970,7 @@ void BKE_node_preview_set_pixel(
/** \name Node Type Access
* \{ */
-void nodeLabel(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
+void nodeLabel(const struct bNodeTree *ntree, const struct bNode *node, char *label, int maxlen);
/**
* Get node socket label if it is set.
*/
@@ -1000,9 +1003,6 @@ void node_type_storage(struct bNodeType *ntype,
void (*copyfunc)(struct bNodeTree *dest_ntree,
struct bNode *dest_node,
const struct bNode *src_node));
-void node_type_label(
- struct bNodeType *ntype,
- void (*labelfunc)(struct bNodeTree *ntree, struct bNode *, char *label, int maxlen));
void node_type_update(struct bNodeType *ntype,
void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node));
void node_type_group_update(struct bNodeType *ntype,
diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc
index 74c762439c7..a78917ab0a3 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -5180,7 +5180,7 @@ void nodeUpdateInternalLinks(bNodeTree *ntree, bNode *node)
/* ************* node type access ********** */
-void nodeLabel(bNodeTree *ntree, bNode *node, char *label, int maxlen)
+void nodeLabel(const bNodeTree *ntree, const bNode *node, char *label, int maxlen)
{
label[0] = '\0';
@@ -5400,13 +5400,6 @@ void node_type_storage(bNodeType *ntype,
ntype->freefunc = freefunc;
}
-void node_type_label(
- struct bNodeType *ntype,
- void (*labelfunc)(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen))
-{
- ntype->labelfunc = labelfunc;
-}
-
void node_type_update(struct bNodeType *ntype,
void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node))
{
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;
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index e1c1ba16165..984e87692f7 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -1891,7 +1891,7 @@ static void rna_Node_draw_buttons_ext(struct uiLayout *layout, bContext *C, Poin
RNA_parameter_list_free(&list);
}
-static void rna_Node_draw_label(bNodeTree *ntree, bNode *node, char *label, int maxlen)
+static void rna_Node_draw_label(const bNodeTree *ntree, const bNode *node, char *label, int maxlen)
{
extern FunctionRNA rna_Node_draw_label_func;
@@ -1903,7 +1903,7 @@ static void rna_Node_draw_label(bNodeTree *ntree, bNode *node, char *label, int
func = &rna_Node_draw_label_func; /* RNA_struct_find_function(&ptr, "draw_label"); */
- RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr);
+ RNA_pointer_create((ID *)&ntree->id, &RNA_Node, (bNode *)node, &ptr);
RNA_parameter_list_create(&list, &ptr, func);
node->typeinfo->rna_ext.call(NULL, &ptr, func, &list);
diff --git a/source/blender/nodes/composite/nodes/node_composite_common.cc b/source/blender/nodes/composite/nodes/node_composite_common.cc
index f76ab765a51..aa81cecc3e2 100644
--- a/source/blender/nodes/composite/nodes/node_composite_common.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_common.cc
@@ -49,7 +49,7 @@ void register_node_type_cmp_group()
node_type_socket_templates(&ntype, nullptr, nullptr);
node_type_size(&ntype, 140, 60, 400);
- node_type_label(&ntype, node_group_label);
+ ntype.labelfunc = node_group_label;
node_type_group_update(&ntype, node_group_update);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_filter.cc b/source/blender/nodes/composite/nodes/node_composite_filter.cc
index 72510387b6a..4258bd977e0 100644
--- a/source/blender/nodes/composite/nodes/node_composite_filter.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_filter.cc
@@ -42,7 +42,7 @@ void register_node_type_cmp_filter()
cmp_node_type_base(&ntype, CMP_NODE_FILTER, "Filter", NODE_CLASS_OP_FILTER, NODE_PREVIEW);
ntype.declare = blender::nodes::cmp_node_filter_declare;
- node_type_label(&ntype, node_filter_label);
+ ntype.labelfunc = node_filter_label;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_image.cc b/source/blender/nodes/composite/nodes/node_composite_image.cc
index ed76aa50527..18f919edbe9 100644
--- a/source/blender/nodes/composite/nodes/node_composite_image.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_image.cc
@@ -451,7 +451,7 @@ void register_node_type_cmp_image()
node_type_init(&ntype, node_composit_init_image);
node_type_storage(&ntype, "ImageUser", node_composit_free_image, node_composit_copy_image);
node_type_update(&ntype, cmp_node_image_update);
- node_type_label(&ntype, node_image_label);
+ ntype.labelfunc = node_image_label;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_mask.cc b/source/blender/nodes/composite/nodes/node_composite_mask.cc
index 0c6f70a3837..a1b76d8a423 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mask.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_mask.cc
@@ -46,7 +46,10 @@ static void node_composit_init_mask(bNodeTree *UNUSED(ntree), bNode *node)
node->custom3 = 0.5f; /* shutter */
}
-static void node_mask_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
+static void node_mask_label(const bNodeTree *UNUSED(ntree),
+ const bNode *node,
+ char *label,
+ int maxlen)
{
if (node->id != nullptr) {
BLI_strncpy(label, node->id->name + 2, maxlen);
@@ -63,7 +66,7 @@ void register_node_type_cmp_mask()
cmp_node_type_base(&ntype, CMP_NODE_MASK, "Mask", NODE_CLASS_INPUT, 0);
ntype.declare = blender::nodes::cmp_node_mask_declare;
node_type_init(&ntype, node_composit_init_mask);
- node_type_label(&ntype, node_mask_label);
+ ntype.labelfunc = node_mask_label;
node_type_storage(&ntype, "NodeMask", node_free_standard_storage, node_copy_standard_storage);
diff --git a/source/blender/nodes/composite/nodes/node_composite_math.cc b/source/blender/nodes/composite/nodes/node_composite_math.cc
index e6e4531dd2e..b34cfab5eb5 100644
--- a/source/blender/nodes/composite/nodes/node_composite_math.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_math.cc
@@ -49,7 +49,7 @@ void register_node_type_cmp_math()
cmp_node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTER, 0);
ntype.declare = blender::nodes::cmp_node_math_declare;
- node_type_label(&ntype, node_math_label);
+ ntype.labelfunc = node_math_label;
node_type_update(&ntype, node_math_update);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc b/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc
index cbfa3509c2b..4432b031ee7 100644
--- a/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_mixrgb.cc
@@ -44,7 +44,7 @@ void register_node_type_cmp_mix_rgb()
cmp_node_type_base(&ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_PREVIEW);
ntype.declare = blender::nodes::cmp_node_mixrgb_declare;
- node_type_label(&ntype, node_blend_label);
+ ntype.labelfunc = node_blend_label;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc
index d874be63616..b859d19c4a4 100644
--- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc
@@ -38,7 +38,7 @@ static void cmp_node_moviedistortion_declare(NodeDeclarationBuilder &b)
} // namespace blender::nodes
-static void label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
+static void label(const bNodeTree *UNUSED(ntree), const bNode *node, char *label, int maxlen)
{
if (node->custom1 == 0) {
BLI_strncpy(label, IFACE_("Undistortion"), maxlen);
@@ -79,7 +79,7 @@ void register_node_type_cmp_moviedistortion()
cmp_node_type_base(&ntype, CMP_NODE_MOVIEDISTORTION, "Movie Distortion", NODE_CLASS_DISTORT, 0);
ntype.declare = blender::nodes::cmp_node_moviedistortion_declare;
- node_type_label(&ntype, label);
+ ntype.labelfunc = label;
ntype.initfunc_api = init;
node_type_storage(&ntype, nullptr, storage_free, storage_copy);
diff --git a/source/blender/nodes/function/nodes/node_fn_boolean_math.cc b/source/blender/nodes/function/nodes/node_fn_boolean_math.cc
index ed03cc0025d..4b59b49c632 100644
--- a/source/blender/nodes/function/nodes/node_fn_boolean_math.cc
+++ b/source/blender/nodes/function/nodes/node_fn_boolean_math.cc
@@ -47,7 +47,10 @@ static void node_boolean_math_update(bNodeTree *ntree, bNode *node)
ntree, sockB, ELEM(node->custom1, NODE_BOOLEAN_MATH_AND, NODE_BOOLEAN_MATH_OR));
}
-static void node_boolean_math_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
+static void node_boolean_math_label(const bNodeTree *UNUSED(ntree),
+ const bNode *node,
+ char *label,
+ int maxlen)
{
const char *name;
bool enum_label = RNA_enum_name(rna_enum_node_boolean_math_items, node->custom1, &name);
@@ -92,7 +95,7 @@ void register_node_type_fn_boolean_math()
fn_node_type_base(&ntype, FN_NODE_BOOLEAN_MATH, "Boolean Math", NODE_CLASS_CONVERTER, 0);
ntype.declare = blender::nodes::fn_node_boolean_math_declare;
- node_type_label(&ntype, blender::nodes::node_boolean_math_label);
+ ntype.labelfunc = blender::nodes::node_boolean_math_label;
node_type_update(&ntype, blender::nodes::node_boolean_math_update);
ntype.build_multi_function = blender::nodes::fn_node_boolean_math_build_multi_function;
ntype.draw_buttons = blender::nodes::fn_node_boolean_math_layout;
diff --git a/source/blender/nodes/function/nodes/node_fn_compare.cc b/source/blender/nodes/function/nodes/node_fn_compare.cc
index 5acd4ae1466..c880f0b1423 100644
--- a/source/blender/nodes/function/nodes/node_fn_compare.cc
+++ b/source/blender/nodes/function/nodes/node_fn_compare.cc
@@ -103,7 +103,10 @@ static void node_compare_init(bNodeTree *UNUSED(tree), bNode *node)
node->storage = data;
}
-static void node_compare_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
+static void node_compare_label(const bNodeTree *UNUSED(ntree),
+ const bNode *node,
+ char *label,
+ int maxlen)
{
const NodeFunctionCompare *data = (NodeFunctionCompare *)node->storage;
const char *name;
@@ -479,7 +482,7 @@ void register_node_type_fn_compare()
static bNodeType ntype;
fn_node_type_base(&ntype, FN_NODE_COMPARE, "Compare", NODE_CLASS_CONVERTER, 0);
ntype.declare = file_ns::fn_node_compare_declare;
- node_type_label(&ntype, file_ns::node_compare_label);
+ ntype.labelfunc = file_ns::node_compare_label;
node_type_update(&ntype, file_ns::node_compare_update);
node_type_init(&ntype, file_ns::node_compare_init);
node_type_storage(
diff --git a/source/blender/nodes/function/nodes/node_fn_float_to_int.cc b/source/blender/nodes/function/nodes/node_fn_float_to_int.cc
index e6ec925f945..21f6734e4aa 100644
--- a/source/blender/nodes/function/nodes/node_fn_float_to_int.cc
+++ b/source/blender/nodes/function/nodes/node_fn_float_to_int.cc
@@ -39,7 +39,10 @@ static void fn_node_float_to_int_layout(uiLayout *layout, bContext *UNUSED(C), P
uiItemR(layout, ptr, "rounding_mode", 0, "", ICON_NONE);
}
-static void node_float_to_int_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
+static void node_float_to_int_label(const bNodeTree *UNUSED(ntree),
+ const bNode *node,
+ char *label,
+ int maxlen)
{
const char *name;
bool enum_label = RNA_enum_name(rna_enum_node_float_to_int_items, node->custom1, &name);
@@ -86,7 +89,7 @@ void register_node_type_fn_float_to_int()
fn_node_type_base(&ntype, FN_NODE_FLOAT_TO_INT, "Float to Integer", NODE_CLASS_CONVERTER, 0);
ntype.declare = blender::nodes::fn_node_float_to_int_declare;
- node_type_label(&ntype, blender::nodes::node_float_to_int_label);
+ ntype.labelfunc = blender::nodes::node_float_to_int_label;
ntype.build_multi_function = blender::nodes::fn_node_float_to_int_build_multi_function;
ntype.draw_buttons = blender::nodes::fn_node_float_to_int_layout;
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_math.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_math.cc
index 11f06adcf50..a689a972a8b 100644
--- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_math.cc
+++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_math.cc
@@ -130,7 +130,10 @@ static void node_init(bNodeTree *UNUSED(tree), bNode *node)
node->storage = data;
}
-static void geo_node_math_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
+static void geo_node_math_label(const bNodeTree *UNUSED(ntree),
+ const bNode *node,
+ char *label,
+ int maxlen)
{
NodeAttributeMath &node_storage = *(NodeAttributeMath *)node->storage;
const char *name;
@@ -310,7 +313,7 @@ void register_node_type_geo_attribute_math()
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
- node_type_label(&ntype, file_ns::geo_node_math_label);
+ ntype.labelfunc = file_ns::geo_node_math_label;
node_type_update(&ntype, file_ns::node_update);
node_type_init(&ntype, file_ns::node_init);
node_type_storage(
diff --git a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_vector_math.cc b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_vector_math.cc
index 1bd1712f22d..49376947914 100644
--- a/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_vector_math.cc
+++ b/source/blender/nodes/geometry/nodes/legacy/node_geo_legacy_attribute_vector_math.cc
@@ -150,8 +150,8 @@ static CustomDataType operation_get_result_type(const NodeVectorMathOperation op
return CD_PROP_FLOAT3;
}
-static void geo_node_vector_math_label(bNodeTree *UNUSED(ntree),
- bNode *node,
+static void geo_node_vector_math_label(const bNodeTree *UNUSED(ntree),
+ const bNode *node,
char *label,
int maxlen)
{
@@ -565,7 +565,7 @@ void register_node_type_geo_attribute_vector_math()
ntype.declare = file_ns::node_declare;
ntype.geometry_node_execute = file_ns::node_geo_exec;
ntype.draw_buttons = file_ns::node_layout;
- node_type_label(&ntype, file_ns::geo_node_vector_math_label);
+ ntype.labelfunc = file_ns::geo_node_vector_math_label;
node_type_update(&ntype, file_ns::node_update);
node_type_init(&ntype, file_ns::node_init);
node_type_storage(
diff --git a/source/blender/nodes/geometry/nodes/node_geo_common.cc b/source/blender/nodes/geometry/nodes/node_geo_common.cc
index 1a8d04e5da9..64b7a80bdb4 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_common.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_common.cc
@@ -37,7 +37,7 @@ void register_node_type_geo_group()
node_type_socket_templates(&ntype, nullptr, nullptr);
node_type_size(&ntype, 140, 60, 400);
- node_type_label(&ntype, node_group_label);
+ ntype.labelfunc = node_group_label;
node_type_group_update(&ntype, node_group_update);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/intern/node_common.cc b/source/blender/nodes/intern/node_common.cc
index f7068782dbf..6881145a2ae 100644
--- a/source/blender/nodes/intern/node_common.cc
+++ b/source/blender/nodes/intern/node_common.cc
@@ -75,7 +75,7 @@ bNodeSocket *node_group_find_output_socket(bNode *groupnode, const char *identif
return nullptr;
}
-void node_group_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
+void node_group_label(const bNodeTree *UNUSED(ntree), const bNode *node, char *label, int maxlen)
{
BLI_strncpy(label, (node->id) ? node->id->name + 2 : IFACE_("Missing Data-Block"), maxlen);
}
diff --git a/source/blender/nodes/intern/node_common.h b/source/blender/nodes/intern/node_common.h
index 7aa356dbc01..0d1b51224e6 100644
--- a/source/blender/nodes/intern/node_common.h
+++ b/source/blender/nodes/intern/node_common.h
@@ -32,7 +32,10 @@ extern "C" {
struct bNodeTree;
/** Groups display their internal tree name as label. */
-void node_group_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
+void node_group_label(const struct bNodeTree *ntree,
+ const struct bNode *node,
+ char *label,
+ int maxlen);
bool node_group_poll_instance(struct bNode *node,
struct bNodeTree *nodetree,
const char **r_disabled_hint);
diff --git a/source/blender/nodes/intern/node_util.c b/source/blender/nodes/intern/node_util.c
index e4756d71114..7620c8fa1a8 100644
--- a/source/blender/nodes/intern/node_util.c
+++ b/source/blender/nodes/intern/node_util.c
@@ -190,7 +190,7 @@ void node_math_update(bNodeTree *ntree, bNode *node)
/** \name Labels
* \{ */
-void node_blend_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
+void node_blend_label(const bNodeTree *UNUSED(ntree), const bNode *node, char *label, int maxlen)
{
const char *name;
bool enum_label = RNA_enum_name(rna_enum_ramp_blend_items, node->custom1, &name);
@@ -200,14 +200,14 @@ void node_blend_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int ma
BLI_strncpy(label, IFACE_(name), maxlen);
}
-void node_image_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
+void node_image_label(const bNodeTree *UNUSED(ntree), const bNode *node, char *label, int maxlen)
{
/* If there is no loaded image, return an empty string,
* and let nodeLabel() fill in the proper type translation. */
BLI_strncpy(label, (node->id) ? node->id->name + 2 : "", maxlen);
}
-void node_math_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
+void node_math_label(const bNodeTree *UNUSED(ntree), const bNode *node, char *label, int maxlen)
{
const char *name;
bool enum_label = RNA_enum_name(rna_enum_node_math_items, node->custom1, &name);
@@ -217,7 +217,10 @@ void node_math_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int max
BLI_strncpy(label, IFACE_(name), maxlen);
}
-void node_vector_math_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
+void node_vector_math_label(const bNodeTree *UNUSED(ntree),
+ const bNode *node,
+ char *label,
+ int maxlen)
{
const char *name;
bool enum_label = RNA_enum_name(rna_enum_node_vec_math_items, node->custom1, &name);
@@ -227,7 +230,7 @@ void node_vector_math_label(bNodeTree *UNUSED(ntree), bNode *node, char *label,
BLI_strncpy(label, IFACE_(name), maxlen);
}
-void node_filter_label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
+void node_filter_label(const bNodeTree *UNUSED(ntree), const bNode *node, char *label, int maxlen)
{
const char *name;
bool enum_label = RNA_enum_name(rna_enum_node_filter_items, node->custom1, &name);
diff --git a/source/blender/nodes/intern/node_util.h b/source/blender/nodes/intern/node_util.h
index 5cb3540d617..635d5364594 100644
--- a/source/blender/nodes/intern/node_util.h
+++ b/source/blender/nodes/intern/node_util.h
@@ -75,11 +75,26 @@ void node_sock_label_clear(struct bNodeSocket *sock);
void node_math_update(struct bNodeTree *ntree, struct bNode *node);
/**** Labels ****/
-void node_blend_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
-void node_image_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
-void node_math_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
-void node_vector_math_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
-void node_filter_label(struct bNodeTree *ntree, struct bNode *node, char *label, int maxlen);
+void node_blend_label(const struct bNodeTree *ntree,
+ const struct bNode *node,
+ char *label,
+ int maxlen);
+void node_image_label(const struct bNodeTree *ntree,
+ const struct bNode *node,
+ char *label,
+ int maxlen);
+void node_math_label(const struct bNodeTree *ntree,
+ const struct bNode *node,
+ char *label,
+ int maxlen);
+void node_vector_math_label(const struct bNodeTree *ntree,
+ const struct bNode *node,
+ char *label,
+ int maxlen);
+void node_filter_label(const struct bNodeTree *ntree,
+ const struct bNode *node,
+ char *label,
+ int maxlen);
/*** Link Handling */
diff --git a/source/blender/nodes/shader/nodes/node_shader_common.c b/source/blender/nodes/shader/nodes/node_shader_common.c
index 07ae412d384..190e0cfad4c 100644
--- a/source/blender/nodes/shader/nodes/node_shader_common.c
+++ b/source/blender/nodes/shader/nodes/node_shader_common.c
@@ -243,7 +243,7 @@ void register_node_type_sh_group(void)
node_type_socket_templates(&ntype, NULL, NULL);
node_type_size(&ntype, 140, 60, 400);
- node_type_label(&ntype, node_group_label);
+ ntype.labelfunc = node_group_label;
node_type_group_update(&ntype, node_group_update);
node_type_exec(&ntype, group_initexec, group_freeexec, group_execute);
node_type_gpu(&ntype, gpu_group_execute);
diff --git a/source/blender/nodes/shader/nodes/node_shader_math.cc b/source/blender/nodes/shader/nodes/node_shader_math.cc
index a9d6491f4be..a10124460ff 100644
--- a/source/blender/nodes/shader/nodes/node_shader_math.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_math.cc
@@ -167,7 +167,7 @@ void register_node_type_sh_math()
sh_fn_node_type_base(&ntype, SH_NODE_MATH, "Math", NODE_CLASS_CONVERTER, 0);
ntype.declare = blender::nodes::sh_node_math_declare;
- node_type_label(&ntype, node_math_label);
+ ntype.labelfunc = node_math_label;
node_type_gpu(&ntype, gpu_shader_math);
node_type_update(&ntype, node_math_update);
ntype.build_multi_function = sh_node_math_build_multi_function;
diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc
index 8fbd6a9e6e1..b89e0527eed 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc
@@ -189,7 +189,7 @@ void register_node_type_sh_mix_rgb()
sh_fn_node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, 0);
ntype.declare = blender::nodes::sh_node_mix_rgb_declare;
- node_type_label(&ntype, node_blend_label);
+ ntype.labelfunc = node_blend_label;
node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_mix_rgb);
node_type_gpu(&ntype, gpu_shader_mix_rgb);
ntype.build_multi_function = sh_node_mix_rgb_build_multi_function;
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
index 26a1db1f3a6..ff08961b3e9 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.c
@@ -143,7 +143,7 @@ void register_node_type_sh_tex_environment(void)
node_type_storage(
&ntype, "NodeTexEnvironment", node_free_standard_storage, node_copy_standard_storage);
node_type_gpu(&ntype, node_shader_gpu_tex_environment);
- node_type_label(&ntype, node_image_label);
+ ntype.labelfunc = node_image_label;
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.cc b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc
index 41f7e5438ea..d139707c6d7 100644
--- a/source/blender/nodes/shader/nodes/node_shader_tex_image.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc
@@ -184,7 +184,7 @@ void register_node_type_sh_tex_image()
node_type_storage(
&ntype, "NodeTexImage", node_free_standard_storage, node_copy_standard_storage);
node_type_gpu(&ntype, node_shader_gpu_tex_image);
- node_type_label(&ntype, node_image_label);
+ ntype.labelfunc = node_image_label;
node_type_size_preset(&ntype, NODE_SIZE_LARGE);
nodeRegisterType(&ntype);
diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_math.cc b/source/blender/nodes/shader/nodes/node_shader_vector_math.cc
index e0cbaa4df9e..7f87332ba1b 100644
--- a/source/blender/nodes/shader/nodes/node_shader_vector_math.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_vector_math.cc
@@ -285,7 +285,7 @@ void register_node_type_sh_vect_math()
sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_MATH, "Vector Math", NODE_CLASS_OP_VECTOR, 0);
ntype.declare = blender::nodes::sh_node_vector_math_declare;
- node_type_label(&ntype, node_vector_math_label);
+ ntype.labelfunc = node_vector_math_label;
node_type_gpu(&ntype, gpu_shader_vector_math);
node_type_update(&ntype, node_shader_update_vector_math);
ntype.build_multi_function = sh_node_vector_math_build_multi_function;
diff --git a/source/blender/nodes/texture/nodes/node_texture_common.c b/source/blender/nodes/texture/nodes/node_texture_common.c
index bd8a844003f..f873ed5e457 100644
--- a/source/blender/nodes/texture/nodes/node_texture_common.c
+++ b/source/blender/nodes/texture/nodes/node_texture_common.c
@@ -172,7 +172,7 @@ void register_node_type_tex_group(void)
node_type_socket_templates(&ntype, NULL, NULL);
node_type_size(&ntype, 140, 60, 400);
- node_type_label(&ntype, node_group_label);
+ ntype.labelfunc = node_group_label;
node_type_group_update(&ntype, node_group_update);
node_type_exec(&ntype, group_initexec, group_freeexec, group_execute);
diff --git a/source/blender/nodes/texture/nodes/node_texture_image.c b/source/blender/nodes/texture/nodes/node_texture_image.c
index a85b963286b..9c61405ea23 100644
--- a/source/blender/nodes/texture/nodes/node_texture_image.c
+++ b/source/blender/nodes/texture/nodes/node_texture_image.c
@@ -113,7 +113,7 @@ void register_node_type_tex_image(void)
node_type_init(&ntype, init);
node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);
node_type_exec(&ntype, NULL, NULL, exec);
- node_type_label(&ntype, node_image_label);
+ ntype.labelfunc = node_image_label;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/nodes/texture/nodes/node_texture_math.c b/source/blender/nodes/texture/nodes/node_texture_math.c
index ab226a4dd38..9e37f4ee643 100644
--- a/source/blender/nodes/texture/nodes/node_texture_math.c
+++ b/source/blender/nodes/texture/nodes/node_texture_math.c
@@ -337,7 +337,7 @@ void register_node_type_tex_math(void)
tex_node_type_base(&ntype, TEX_NODE_MATH, "Math", NODE_CLASS_CONVERTER, 0);
node_type_socket_templates(&ntype, inputs, outputs);
- node_type_label(&ntype, node_math_label);
+ ntype.labelfunc = node_math_label;
node_type_storage(&ntype, "", NULL, NULL);
node_type_exec(&ntype, NULL, NULL, exec);
node_type_update(&ntype, node_math_update);
diff --git a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
index b1aeb269018..044875cce90 100644
--- a/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
+++ b/source/blender/nodes/texture/nodes/node_texture_mixRgb.c
@@ -71,7 +71,7 @@ void register_node_type_tex_mix_rgb(void)
tex_node_type_base(&ntype, TEX_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, 0);
node_type_socket_templates(&ntype, inputs, outputs);
- node_type_label(&ntype, node_blend_label);
+ ntype.labelfunc = node_blend_label;
node_type_exec(&ntype, NULL, NULL, exec);
nodeRegisterType(&ntype);