[be1a8d30553] temp-sybren-usd-patch: USD: renamed `prune_the_weak` → `remove_weak_subtrees` + arguments

Sybren A. Stüvel noreply at git.blender.org
Tue Nov 26 18:07:36 CET 2019


Commit: be1a8d3055393528f2af8cd2326806488d91b435
Author: Sybren A. Stüvel
Date:   Tue Nov 26 13:55:28 2019 +0100
Branches: temp-sybren-usd-patch
https://developer.blender.org/rBbe1a8d3055393528f2af8cd2326806488d91b435

USD: renamed `prune_the_weak` → `remove_weak_subtrees` + arguments

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

M	source/blender/usd/intern/abstract_hierarchy_iterator.cc

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

diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.cc b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
index 4215264c9a0..4930e42cade 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
@@ -216,25 +216,26 @@ void AbstractHierarchyIterator::export_graph_construct()
   DEG_OBJECT_ITER_END;
 }
 
-static bool prune_the_weak(const HierarchyContext *context,
-                           AbstractHierarchyIterator::ExportGraph &modify,
-                           const AbstractHierarchyIterator::ExportGraph &iterate)
+static bool remove_weak_subtrees(const HierarchyContext *context,
+                                 AbstractHierarchyIterator::ExportGraph &clean_graph,
+                                 const AbstractHierarchyIterator::ExportGraph &input_graph)
 {
   bool all_is_weak = context != nullptr && context->weak_export;
   Object *object = context != nullptr ? context->object : nullptr;
   Object *duplicator = context != nullptr ? context->duplicator : nullptr;
 
-  const auto map_index = std::make_pair(object, duplicator);
-  AbstractHierarchyIterator::ExportGraph::const_iterator child_iterator = iterate.find(map_index);
+  const AbstractHierarchyIterator::DupliAndDuplicator map_key = std::make_pair(object, duplicator);
+  AbstractHierarchyIterator::ExportGraph::const_iterator child_iterator;
 
-  if (child_iterator != iterate.end()) {
+  child_iterator = input_graph.find(map_key);
+  if (child_iterator != input_graph.end()) {
     for (HierarchyContext *child_context : child_iterator->second) {
-      bool child_tree_is_weak = prune_the_weak(child_context, modify, iterate);
+      bool child_tree_is_weak = remove_weak_subtrees(child_context, clean_graph, input_graph);
       all_is_weak &= child_tree_is_weak;
 
       if (child_tree_is_weak) {
         // This subtree is all weak, so we can remove it from the current object's children.
-        modify[map_index].erase(child_context);
+        clean_graph[map_key].erase(child_context);
         delete child_context;
       }
     }
@@ -242,7 +243,7 @@ static bool prune_the_weak(const HierarchyContext *context,
 
   if (all_is_weak) {
     // This node and all its children are weak, so it can be removed from the export graph.
-    modify.erase(map_index);
+    clean_graph.erase(map_key);
   }
 
   return all_is_weak;
@@ -252,7 +253,7 @@ void AbstractHierarchyIterator::export_graph_prune()
 {
   // Take a copy of the map so that we can modify while recursing.
   ExportGraph unpruned_export_graph = export_graph_;
-  prune_the_weak(HierarchyContext::root(), export_graph_, unpruned_export_graph);
+  remove_weak_subtrees(HierarchyContext::root(), export_graph_, unpruned_export_graph);
 }
 
 void AbstractHierarchyIterator::export_graph_clear()



More information about the Bf-blender-cvs mailing list