Cleanup: Use const arguments for node group poll function

Also make the disabled hint argument optional.
This commit is contained in:
Hans Goudey 2022-09-21 15:01:52 -05:00
parent f42569bb71
commit 3676d6b88d
2 changed files with 11 additions and 6 deletions

View File

@ -960,8 +960,8 @@ void nodeLabel(const struct bNodeTree *ntree, const struct bNode *node, char *la
*/
const char *nodeSocketLabel(const struct bNodeSocket *sock);
bool nodeGroupPoll(struct bNodeTree *nodetree,
struct bNodeTree *grouptree,
bool nodeGroupPoll(const struct bNodeTree *nodetree,
const struct bNodeTree *grouptree,
const char **r_disabled_hint);
/**

View File

@ -82,7 +82,9 @@ bool node_group_poll_instance(bNode *node, bNodeTree *nodetree, const char **dis
return false;
}
bool nodeGroupPoll(bNodeTree *nodetree, bNodeTree *grouptree, const char **r_disabled_hint)
bool nodeGroupPoll(const bNodeTree *nodetree,
const bNodeTree *grouptree,
const char **r_disabled_hint)
{
bool valid = true;
@ -94,13 +96,16 @@ bool nodeGroupPoll(bNodeTree *nodetree, bNodeTree *grouptree, const char **r_dis
}
if (nodetree == grouptree) {
*r_disabled_hint = TIP_("Nesting a node group inside of itself is not allowed");
if (r_disabled_hint) {
*r_disabled_hint = TIP_("Nesting a node group inside of itself is not allowed");
}
return false;
}
LISTBASE_FOREACH (bNode *, node, &grouptree->nodes) {
LISTBASE_FOREACH (const bNode *, node, &grouptree->nodes) {
if (node->typeinfo->poll_instance &&
!node->typeinfo->poll_instance(node, nodetree, r_disabled_hint)) {
!node->typeinfo->poll_instance(
const_cast<bNode *>(node), const_cast<bNodeTree *>(nodetree), r_disabled_hint)) {
valid = false;
break;
}