[Bf-blender-cvs] [aa55cb2996d] master: Cleanup: Use const arguments, references

Hans Goudey noreply at git.blender.org
Wed Dec 15 21:52:10 CET 2021


Commit: aa55cb2996d4f9a87493d8a0cf602724884703b8
Author: Hans Goudey
Date:   Wed Dec 15 14:51:58 2021 -0600
Branches: master
https://developer.blender.org/rBaa55cb2996d4f9a87493d8a0cf602724884703b8

Cleanup: Use const arguments, references

Also slightly change naming to avoid camel case.

===================================================================

M	source/blender/modifiers/intern/MOD_nodes.cc

===================================================================

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<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)



More information about the Bf-blender-cvs mailing list