diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index ff1128246f3..d247ee5eea0 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -299,12 +299,14 @@ typedef struct bNodeType { * when it's not just a dummy, that is, if it actually wants to access * the returned disabled-hint (null-check needed!). */ - bool (*poll)(struct bNodeType *ntype, struct bNodeTree *nodetree, const char **r_disabled_hint); + bool (*poll)(const struct bNodeType *ntype, + const struct bNodeTree *nodetree, + const char **r_disabled_hint); /** Can this node be added to a node tree? * \param r_disabled_hint: See `poll()`. */ - bool (*poll_instance)(struct bNode *node, - struct bNodeTree *nodetree, + bool (*poll_instance)(const struct bNode *node, + const struct bNodeTree *nodetree, const char **r_disabled_hint); /* optional handling of link insertion */ diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 9fc2cbde1d5..097d14ae7b9 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -4034,14 +4034,16 @@ static void node_type_base_defaults(bNodeType *ntype) } /* allow this node for any tree type */ -static bool node_poll_default(bNodeType * /*ntype*/, - bNodeTree * /*ntree*/, +static bool node_poll_default(const bNodeType * /*ntype*/, + const bNodeTree * /*ntree*/, const char ** /*disabled_hint*/) { return true; } -static bool node_poll_instance_default(bNode *node, bNodeTree *ntree, const char **disabled_hint) +static bool node_poll_instance_default(const bNode *node, + const bNodeTree *ntree, + const char **disabled_hint) { return node->typeinfo->poll(node->typeinfo, ntree, disabled_hint); } diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index fbc13229a3d..aa42e9422e2 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -1659,7 +1659,9 @@ char *rna_Node_ImageUser_path(const PointerRNA *ptr) return NULL; } -static bool rna_Node_poll(bNodeType *ntype, bNodeTree *ntree, const char **UNUSED(r_disabled_hint)) +static bool rna_Node_poll(const bNodeType *ntype, + const bNodeTree *ntree, + const char **UNUSED(r_disabled_hint)) { extern FunctionRNA rna_Node_poll_func; @@ -1684,8 +1686,8 @@ static bool rna_Node_poll(bNodeType *ntype, bNodeTree *ntree, const char **UNUSE return visible; } -static bool rna_Node_poll_instance(bNode *node, - bNodeTree *ntree, +static bool rna_Node_poll_instance(const bNode *node, + const bNodeTree *ntree, const char **UNUSED(disabled_info)) { extern FunctionRNA rna_Node_poll_instance_func; @@ -1696,7 +1698,7 @@ static bool rna_Node_poll_instance(bNode *node, void *ret; bool visible; - RNA_pointer_create(NULL, node->typeinfo->rna_ext.srna, node, &ptr); /* dummy */ + RNA_pointer_create(NULL, node->typeinfo->rna_ext.srna, (bNode *)node, &ptr); /* dummy */ func = &rna_Node_poll_instance_func; /* RNA_struct_find_function(&ptr, "poll_instance"); */ RNA_parameter_list_create(&list, &ptr, func); @@ -1711,8 +1713,8 @@ static bool rna_Node_poll_instance(bNode *node, return visible; } -static bool rna_Node_poll_instance_default(bNode *node, - bNodeTree *ntree, +static bool rna_Node_poll_instance_default(const bNode *node, + const bNodeTree *ntree, const char **disabled_info) { /* use the basic poll function */ diff --git a/source/blender/nodes/composite/node_composite_util.cc b/source/blender/nodes/composite/node_composite_util.cc index afe11de059d..219976e85c0 100644 --- a/source/blender/nodes/composite/node_composite_util.cc +++ b/source/blender/nodes/composite/node_composite_util.cc @@ -11,7 +11,9 @@ #include "node_composite_util.hh" -bool cmp_node_poll_default(bNodeType * /*ntype*/, bNodeTree *ntree, const char **r_disabled_hint) +bool cmp_node_poll_default(const bNodeType * /*ntype*/, + const bNodeTree *ntree, + const char **r_disabled_hint) { if (!STREQ(ntree->idname, "CompositorNodeTree")) { *r_disabled_hint = TIP_("Not a compositor node tree"); diff --git a/source/blender/nodes/composite/node_composite_util.hh b/source/blender/nodes/composite/node_composite_util.hh index 46330c67996..9049834100e 100644 --- a/source/blender/nodes/composite/node_composite_util.hh +++ b/source/blender/nodes/composite/node_composite_util.hh @@ -21,8 +21,8 @@ #define CMP_SCALE_MAX 12000 -bool cmp_node_poll_default(struct bNodeType *ntype, - struct bNodeTree *ntree, +bool cmp_node_poll_default(const struct bNodeType *ntype, + const struct bNodeTree *ntree, const char **r_disabled_hint); void cmp_node_update_default(struct bNodeTree *ntree, struct bNode *node); void cmp_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass); diff --git a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc index fd4ef63879e..ad170984cd7 100644 --- a/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_cryptomatte.cc @@ -277,8 +277,8 @@ static void node_copy_cryptomatte(bNodeTree * /*dst_ntree*/, dest_node->storage = dest_nc; } -static bool node_poll_cryptomatte(bNodeType * /*ntype*/, - bNodeTree *ntree, +static bool node_poll_cryptomatte(const bNodeType * /*ntype*/, + const bNodeTree *ntree, const char **r_disabled_hint) { if (STREQ(ntree->idname, "CompositorNodeTree")) { diff --git a/source/blender/nodes/composite/nodes/node_composite_image.cc b/source/blender/nodes/composite/nodes/node_composite_image.cc index 9bfb150205b..e743c003701 100644 --- a/source/blender/nodes/composite/nodes/node_composite_image.cc +++ b/source/blender/nodes/composite/nodes/node_composite_image.cc @@ -712,8 +712,8 @@ static void node_composit_init_rlayers(const bContext *C, PointerRNA *ptr) } } -static bool node_composit_poll_rlayers(bNodeType * /*ntype*/, - bNodeTree *ntree, +static bool node_composit_poll_rlayers(const bNodeType * /*ntype*/, + const bNodeTree *ntree, const char **r_disabled_hint) { if (!STREQ(ntree->idname, "CompositorNodeTree")) { diff --git a/source/blender/nodes/function/node_function_util.cc b/source/blender/nodes/function/node_function_util.cc index 82459815b77..2be0d639bdf 100644 --- a/source/blender/nodes/function/node_function_util.cc +++ b/source/blender/nodes/function/node_function_util.cc @@ -5,8 +5,8 @@ #include "NOD_socket_search_link.hh" -static bool fn_node_poll_default(bNodeType * /*ntype*/, - bNodeTree *ntree, +static bool fn_node_poll_default(const bNodeType * /*ntype*/, + const bNodeTree *ntree, const char **r_disabled_hint) { /* Function nodes are only supported in simulation node trees so far. */ diff --git a/source/blender/nodes/geometry/node_geometry_util.cc b/source/blender/nodes/geometry/node_geometry_util.cc index 8b962d39b3c..3c830f978d1 100644 --- a/source/blender/nodes/geometry/node_geometry_util.cc +++ b/source/blender/nodes/geometry/node_geometry_util.cc @@ -41,7 +41,9 @@ std::optional node_socket_to_custom_data_type(const bNodeSocket } // namespace blender::nodes -bool geo_node_poll_default(bNodeType * /*ntype*/, bNodeTree *ntree, const char **r_disabled_hint) +bool geo_node_poll_default(const bNodeType * /*ntype*/, + const bNodeTree *ntree, + const char **r_disabled_hint) { if (!STREQ(ntree->idname, "GeometryNodeTree")) { *r_disabled_hint = TIP_("Not a geometry node tree"); diff --git a/source/blender/nodes/geometry/node_geometry_util.hh b/source/blender/nodes/geometry/node_geometry_util.hh index d1aeff2cd7a..d99b4c01ed7 100644 --- a/source/blender/nodes/geometry/node_geometry_util.hh +++ b/source/blender/nodes/geometry/node_geometry_util.hh @@ -28,8 +28,8 @@ struct BVHTreeFromMesh; void geo_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass); -bool geo_node_poll_default(struct bNodeType *ntype, - struct bNodeTree *ntree, +bool geo_node_poll_default(const struct bNodeType *ntype, + const struct bNodeTree *ntree, const char **r_disabled_hint); namespace blender::nodes { diff --git a/source/blender/nodes/intern/node_common.cc b/source/blender/nodes/intern/node_common.cc index b5feea220d1..509921837cc 100644 --- a/source/blender/nodes/intern/node_common.cc +++ b/source/blender/nodes/intern/node_common.cc @@ -70,10 +70,12 @@ void node_group_label(const bNodeTree * /*ntree*/, const bNode *node, char *labe BLI_strncpy(label, (node->id) ? node->id->name + 2 : IFACE_("Missing Data-Block"), maxlen); } -bool node_group_poll_instance(bNode *node, bNodeTree *nodetree, const char **disabled_hint) +bool node_group_poll_instance(const bNode *node, + const bNodeTree *nodetree, + const char **disabled_hint) { if (node->typeinfo->poll(node->typeinfo, nodetree, disabled_hint)) { - bNodeTree *grouptree = (bNodeTree *)node->id; + const bNodeTree *grouptree = (const bNodeTree *)node->id; if (grouptree) { return nodeGroupPoll(nodetree, grouptree, disabled_hint); } diff --git a/source/blender/nodes/intern/node_common.h b/source/blender/nodes/intern/node_common.h index 5ddf0800d8c..e53697be076 100644 --- a/source/blender/nodes/intern/node_common.h +++ b/source/blender/nodes/intern/node_common.h @@ -20,8 +20,8 @@ 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, +bool node_group_poll_instance(const struct bNode *node, + const struct bNodeTree *nodetree, const char **r_disabled_hint); /** diff --git a/source/blender/nodes/intern/node_register.cc b/source/blender/nodes/intern/node_register.cc index 49ee69ed268..69a20098514 100644 --- a/source/blender/nodes/intern/node_register.cc +++ b/source/blender/nodes/intern/node_register.cc @@ -11,8 +11,8 @@ #include "RNA_access.h" -static bool node_undefined_poll(bNodeType * /*ntype*/, - bNodeTree * /*nodetree*/, +static bool node_undefined_poll(const bNodeType * /*ntype*/, + const bNodeTree * /*nodetree*/, const char ** /*r_disabled_hint*/) { /* this type can not be added deliberately, it's just a placeholder */ diff --git a/source/blender/nodes/shader/node_shader_util.cc b/source/blender/nodes/shader/node_shader_util.cc index b1617a779ea..db32495aba4 100644 --- a/source/blender/nodes/shader/node_shader_util.cc +++ b/source/blender/nodes/shader/node_shader_util.cc @@ -15,7 +15,9 @@ #include "node_exec.h" -bool sh_node_poll_default(bNodeType * /*ntype*/, bNodeTree *ntree, const char **r_disabled_hint) +bool sh_node_poll_default(const bNodeType * /*ntype*/, + const bNodeTree *ntree, + const char **r_disabled_hint) { if (!STREQ(ntree->idname, "ShaderNodeTree")) { *r_disabled_hint = TIP_("Not a shader node tree"); @@ -24,8 +26,8 @@ bool sh_node_poll_default(bNodeType * /*ntype*/, bNodeTree *ntree, const char ** return true; } -static bool sh_fn_poll_default(bNodeType * /*ntype*/, - bNodeTree *ntree, +static bool sh_fn_poll_default(const bNodeType * /*ntype*/, + const bNodeTree *ntree, const char **r_disabled_hint) { if (!STR_ELEM(ntree->idname, "ShaderNodeTree", "GeometryNodeTree")) { diff --git a/source/blender/nodes/shader/node_shader_util.hh b/source/blender/nodes/shader/node_shader_util.hh index d69dc0e52b2..d58a09ce934 100644 --- a/source/blender/nodes/shader/node_shader_util.hh +++ b/source/blender/nodes/shader/node_shader_util.hh @@ -63,8 +63,8 @@ #include "RNA_access.h" -bool sh_node_poll_default(struct bNodeType *ntype, - struct bNodeTree *ntree, +bool sh_node_poll_default(const struct bNodeType *ntype, + const struct bNodeTree *ntree, const char **r_disabled_hint); void sh_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass); void sh_fn_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass); diff --git a/source/blender/nodes/texture/node_texture_util.cc b/source/blender/nodes/texture/node_texture_util.cc index 1174c4f4ce9..2c2f14d0316 100644 --- a/source/blender/nodes/texture/node_texture_util.cc +++ b/source/blender/nodes/texture/node_texture_util.cc @@ -23,7 +23,7 @@ #include "node_texture_util.hh" -bool tex_node_poll_default(bNodeType * /*ntype*/, bNodeTree *ntree, const char **r_disabled_hint) +bool tex_node_poll_default(const bNodeType * /*ntype*/, const bNodeTree *ntree, const char **r_disabled_hint) { if (!STREQ(ntree->idname, "TextureNodeTree")) { *r_disabled_hint = TIP_("Not a texture node tree"); diff --git a/source/blender/nodes/texture/node_texture_util.hh b/source/blender/nodes/texture/node_texture_util.hh index c9a2060172d..529a48951dc 100644 --- a/source/blender/nodes/texture/node_texture_util.hh +++ b/source/blender/nodes/texture/node_texture_util.hh @@ -92,8 +92,8 @@ typedef struct TexDelegate { int type; } TexDelegate; -bool tex_node_poll_default(struct bNodeType *ntype, - struct bNodeTree *ntree, +bool tex_node_poll_default(const struct bNodeType *ntype, + const struct bNodeTree *ntree, const char **r_disabled_hint); void tex_node_type_base(struct bNodeType *ntype, int type, const char *name, short nclass);