[Bf-blender-cvs] [a7ea07c6777] master: Depsgraph: use blender::Vector instead of std::vector

Jacques Lucke noreply at git.blender.org
Wed Jun 10 15:41:49 CEST 2020


Commit: a7ea07c6777a93373c8261d4a36edcee8a66a460
Author: Jacques Lucke
Date:   Wed Jun 10 15:25:39 2020 +0200
Branches: master
https://developer.blender.org/rBa7ea07c6777a93373c8261d4a36edcee8a66a460

Depsgraph: use blender::Vector instead of std::vector

We decided that `blender::Vector` should be the default choice for
a vector data structure in Blender.

Reviewers: sergey

Differential Revision: https://developer.blender.org/D7981

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

M	source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M	source/blender/depsgraph/intern/builder/deg_builder_nodes.h
M	source/blender/depsgraph/intern/builder/deg_builder_relations.cc
M	source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
M	source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc
M	source/blender/depsgraph/intern/depsgraph.cc
M	source/blender/depsgraph/intern/depsgraph.h
M	source/blender/depsgraph/intern/depsgraph_type.h
M	source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc
M	source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.h
M	source/blender/depsgraph/intern/node/deg_node_component.cc
M	source/blender/depsgraph/intern/node/deg_node_component.h

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

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 9230fa19c32..513472f6ec9 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -179,7 +179,7 @@ IDNode *DepsgraphNodeBuilder::add_id_node(ID *id)
         OperationCode::COPY_ON_WRITE,
         "",
         -1);
-    graph_->operations.push_back(op_cow);
+    graph_->operations.append(op_cow);
   }
   return id_node;
 }
@@ -213,7 +213,7 @@ OperationNode *DepsgraphNodeBuilder::add_operation_node(ComponentNode *comp_node
   OperationNode *op_node = comp_node->find_operation(opcode, name, name_tag);
   if (op_node == nullptr) {
     op_node = comp_node->add_operation(op, opcode, name, name_tag);
-    graph_->operations.push_back(op_node);
+    graph_->operations.append(op_node);
   }
   else {
     fprintf(stderr,
@@ -347,7 +347,7 @@ void DepsgraphNodeBuilder::begin_build()
     entry_tag.opcode = op_node->opcode;
     entry_tag.name = op_node->name;
     entry_tag.name_tag = op_node->name_tag;
-    saved_entry_tags_.push_back(entry_tag);
+    saved_entry_tags_.append(entry_tag);
   }
 
   /* Make sure graph has no nodes left from previous state. */
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
index 5cd7f7449a2..8c0e486ec04 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h
@@ -251,7 +251,7 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder {
     string name;
     int name_tag;
   };
-  vector<SavedEntryTag> saved_entry_tags_;
+  Vector<SavedEntryTag> saved_entry_tags_;
 
   struct BuilderWalkUserData {
     DepsgraphNodeBuilder *builder;
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index f5a131a1731..92dff751b8a 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -2887,7 +2887,7 @@ void DepsgraphRelationBuilder::build_driver_relations(IDNode *id_node)
   }
 
   // Mapping from RNA prefix -> set of driver evaluation nodes:
-  typedef vector<Node *> DriverGroup;
+  typedef Vector<Node *> DriverGroup;
   typedef map<string, DriverGroup> DriverGroupMap;
   DriverGroupMap driver_groups;
 
@@ -2906,7 +2906,7 @@ void DepsgraphRelationBuilder::build_driver_relations(IDNode *id_node)
     OperationKey driver_key(
         id_orig, NodeType::PARAMETERS, OperationCode::DRIVER, fcu->rna_path, fcu->array_index);
     Node *node_driver = get_node(driver_key);
-    driver_groups[rna_prefix].push_back(node_driver);
+    driver_groups[rna_prefix].append(node_driver);
   }
 
   for (pair<string, DriverGroup> prefix_group : driver_groups) {
diff --git a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
index dbe88ee92a8..1f33bdefb79 100644
--- a/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
+++ b/source/blender/depsgraph/intern/debug/deg_debug_relations_graphviz.cc
@@ -442,7 +442,7 @@ static void deg_debug_graphviz_node(const DebugContext &ctx, const Node *node)
     case NodeType::GENERIC_DATABLOCK:
     case NodeType::SIMULATION: {
       ComponentNode *comp_node = (ComponentNode *)node;
-      if (!comp_node->operations.empty()) {
+      if (!comp_node->operations.is_empty()) {
         deg_debug_graphviz_node_cluster_begin(ctx, node);
         for (Node *op_node : comp_node->operations) {
           deg_debug_graphviz_node(ctx, op_node);
@@ -480,7 +480,7 @@ static bool deg_debug_graphviz_is_cluster(const Node *node)
     case NodeType::EVAL_POSE:
     case NodeType::BONE: {
       ComponentNode *comp_node = (ComponentNode *)node;
-      return !comp_node->operations.empty();
+      return !comp_node->operations.is_empty();
     }
     default:
       return false;
diff --git a/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc b/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc
index 7bef5fda636..9e751093ae2 100644
--- a/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc
+++ b/source/blender/depsgraph/intern/debug/deg_debug_stats_gnuplot.cc
@@ -96,7 +96,7 @@ string gnuplotify_name(const string &name)
 void write_stats_data(const DebugContext &ctx)
 {
   // Fill in array of all stats which are to be displayed.
-  vector<StatsEntry> stats;
+  Vector<StatsEntry> stats;
   stats.reserve(ctx.graph->id_nodes.size());
   for (const IDNode *id_node : ctx.graph->id_nodes) {
     const double time = get_node_time(ctx, id_node);
@@ -106,7 +106,7 @@ void write_stats_data(const DebugContext &ctx)
     StatsEntry entry;
     entry.id_node = id_node;
     entry.time = time;
-    stats.push_back(entry);
+    stats.append(entry);
   }
   // Sort the data.
   std::sort(stats.begin(), stats.end(), stat_entry_comparator);
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index d4a6b0a8b76..51ae56ac613 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -120,7 +120,7 @@ IDNode *Depsgraph::add_id_node(ID *id, ID *id_cow_hint)
      * NOTE: We address ID nodes by the original ID pointer they are
      * referencing to. */
     id_hash.add_new(id, id_node);
-    id_nodes.push_back(id_node);
+    id_nodes.append(id_node);
 
     id_type_exist[BKE_idtype_idcode_to_index(GS(id->name))] = 1;
   }
diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h
index 672f202338e..e0686bd04aa 100644
--- a/source/blender/depsgraph/intern/depsgraph.h
+++ b/source/blender/depsgraph/intern/depsgraph.h
@@ -57,9 +57,8 @@ struct TimeSourceNode;
 
 /* Dependency Graph object */
 struct Depsgraph {
-  // TODO(sergey): Go away from C++ container and use some native BLI.
-  typedef vector<OperationNode *> OperationNodes;
-  typedef vector<IDNode *> IDDepsNodes;
+  typedef Vector<OperationNode *> OperationNodes;
+  typedef Vector<IDNode *> IDDepsNodes;
 
   Depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluationMode mode);
   ~Depsgraph();
diff --git a/source/blender/depsgraph/intern/depsgraph_type.h b/source/blender/depsgraph/intern/depsgraph_type.h
index 43b1ecb774a..3d386695e6c 100644
--- a/source/blender/depsgraph/intern/depsgraph_type.h
+++ b/source/blender/depsgraph/intern/depsgraph_type.h
@@ -66,7 +66,6 @@ using std::pair;
 using std::set;
 using std::string;
 using std::unique_ptr;
-using std::vector;
 
 /* Commonly used functions. */
 using std::make_pair;
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc
index e3beeb52ab1..29f70e8548e 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.cc
@@ -70,7 +70,7 @@ void animated_property_store_cb(ID *id, FCurve *fcurve, void *data_v)
     return;
   }
 
-  data->backup->values_backup.emplace_back(fcurve->rna_path, fcurve->array_index, value);
+  data->backup->values_backup.append({fcurve->rna_path, fcurve->array_index, value});
 }
 
 }  // namespace
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.h b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.h
index d97ee2b0556..d021354e6f2 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.h
+++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_animation.h
@@ -59,7 +59,7 @@ class AnimationBackup {
   void restore_to_id(ID *id);
 
   bool meed_value_backup;
-  vector<AnimationValueBackup> values_backup;
+  Vector<AnimationValueBackup> values_backup;
 };
 
 }  // namespace DEG
diff --git a/source/blender/depsgraph/intern/node/deg_node_component.cc b/source/blender/depsgraph/intern/node/deg_node_component.cc
index e75b5a96480..87d704bb0a0 100644
--- a/source/blender/depsgraph/intern/node/deg_node_component.cc
+++ b/source/blender/depsgraph/intern/node/deg_node_component.cc
@@ -293,7 +293,7 @@ void ComponentNode::finalize_build(Depsgraph * /*graph*/)
 {
   operations.reserve(operations_map->size());
   for (OperationNode *op_node : operations_map->values()) {
-    operations.push_back(op_node);
+    operations.append(op_node);
   }
   delete operations_map;
   operations_map = nullptr;
diff --git a/source/blender/depsgraph/intern/node/deg_node_component.h b/source/blender/depsgraph/intern/node/deg_node_component.h
index 727551127a5..036baa9d46c 100644
--- a/source/blender/depsgraph/intern/node/deg_node_component.h
+++ b/source/blender/depsgraph/intern/node/deg_node_component.h
@@ -119,7 +119,7 @@ struct ComponentNode : public Node {
 
   /* This is a "normal" list of operations, used by evaluation
    * and other routines after construction. */
-  vector<OperationNode *> operations;
+  Vector<OperationNode *> operations;
 
   OperationNode *entry_operation;
   OperationNode *exit_operation;



More information about the Bf-blender-cvs mailing list