From aa55cb2996d4f9a87493d8a0cf602724884703b8 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 15 Dec 2021 14:51:58 -0600 Subject: Cleanup: Use const arguments, references Also slightly change naming to avoid camel case. --- source/blender/modifiers/intern/MOD_nodes.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index 79838f61dfe..211257597cb 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -268,18 +268,19 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte } } -static bool checkForTimeNode(bNodeTree *tree, Set &r_checked_trees) +static bool check_tree_for_time_node(const bNodeTree &tree, + Set &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(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(md); - bNodeTree *tree = nmd->node_group; + const NodesModifierData *nmd = reinterpret_cast(md); + const bNodeTree *tree = nmd->node_group; if (tree == nullptr) { return false; } - Set checked_trees; - return checkForTimeNode(tree, checked_trees); + Set checked_trees; + return check_tree_for_time_node(*tree, checked_trees); } static void foreachIDLink(ModifierData *md, Object *ob, IDWalkFunc walk, void *userData) -- cgit v1.2.3