Cleanup: Use const arguments, references

Also slightly change naming to avoid camel case.
This commit is contained in:
Hans Goudey 2021-12-15 14:51:58 -06:00
parent 43875e8dd1
commit aa55cb2996
1 changed files with 10 additions and 9 deletions

View File

@ -268,18 +268,19 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
}
}
static bool checkForTimeNode(bNodeTree *tree, Set<bNodeTree *> &r_checked_trees)
static bool check_tree_for_time_node(const bNodeTree &tree,
Set<const bNodeTree *> &r_checked_trees)
{
if (!r_checked_trees.add(tree)) {
if (!r_checked_trees.add(&tree)) {
return false;
}
LISTBASE_FOREACH (bNode *, node, &tree->nodes) {
LISTBASE_FOREACH (const bNode *, node, &tree.nodes) {
if (node->type == GEO_NODE_INPUT_SCENE_TIME) {
return true;
}
if (node->type == NODE_GROUP) {
bNodeTree *subtree = (bNodeTree *)node->id;
if (checkForTimeNode(subtree, r_checked_trees)) {
const bNodeTree *sub_tree = reinterpret_cast<const bNodeTree *>(node->id);
if (check_tree_for_time_node(*sub_tree, r_checked_trees)) {
return true;
}
}
@ -291,13 +292,13 @@ static bool dependsOnTime(struct Scene *UNUSED(scene),
ModifierData *md,
const int UNUSED(dag_eval_mode))
{
NodesModifierData *nmd = reinterpret_cast<NodesModifierData *>(md);
bNodeTree *tree = nmd->node_group;
const NodesModifierData *nmd = reinterpret_cast<NodesModifierData *>(md);
const bNodeTree *tree = nmd->node_group;
if (tree == nullptr) {
return false;
}
Set<bNodeTree *> checked_trees;
return checkForTimeNode(tree, checked_trees);
Set<const bNodeTree *> checked_trees;
return check_tree_for_time_node(*tree, checked_trees);
}
static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData)