[Bf-blender-cvs] [d931981d24f] master: Cleanup: USD, added some clarifying comments

Sybren A. Stüvel noreply at git.blender.org
Fri May 8 15:10:56 CEST 2020


Commit: d931981d24f80ab3bbf50f25935bba0b6b044d5f
Author: Sybren A. Stüvel
Date:   Fri May 8 13:42:46 2020 +0200
Branches: master
https://developer.blender.org/rBd931981d24f80ab3bbf50f25935bba0b6b044d5f

Cleanup: USD, added some clarifying comments

No functional changes.

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

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

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

diff --git a/source/blender/io/usd/intern/abstract_hierarchy_iterator.cc b/source/blender/io/usd/intern/abstract_hierarchy_iterator.cc
index 3c7a86b2c34..060a65a68eb 100644
--- a/source/blender/io/usd/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/io/usd/intern/abstract_hierarchy_iterator.cc
@@ -508,6 +508,7 @@ void AbstractHierarchyIterator::make_writers(const HierarchyContext *parent_cont
   }
 
   for (HierarchyContext *context : graph_children(parent_context)) {
+    // Update the context so that it is correct for this parent-child relation.
     copy_m4_m4(context->parent_matrix_inv_world, parent_matrix_inv_world);
 
     // Get or create the transform writer.
diff --git a/source/blender/io/usd/intern/abstract_hierarchy_iterator.h b/source/blender/io/usd/intern/abstract_hierarchy_iterator.h
index 295430d903f..89ea31c7037 100644
--- a/source/blender/io/usd/intern/abstract_hierarchy_iterator.h
+++ b/source/blender/io/usd/intern/abstract_hierarchy_iterator.h
@@ -195,6 +195,7 @@ class AbstractHierarchyIterator {
   void determine_duplication_references(const HierarchyContext *parent_context,
                                         std::string indent);
 
+  /* These three functions create writers and call their write() method. */
   void make_writers(const HierarchyContext *parent_context);
   void make_writer_object_data(const HierarchyContext *context);
   void make_writers_particle_systems(const HierarchyContext *context);
@@ -244,7 +245,10 @@ class AbstractHierarchyIterator {
    * data/hair/particle will NOT prevent the transform to be written.
    *
    * The returned writer is owned by the AbstractHierarchyWriter, and should be freed in
-   * delete_object_writer(). */
+   * delete_object_writer().
+   *
+   * The created AbstractHierarchyWriter instances should NOT keep a copy of the context pointer.
+   * The context can be stack-allocated and go out of scope. */
   virtual AbstractHierarchyWriter *create_transform_writer(const HierarchyContext *context) = 0;
   virtual AbstractHierarchyWriter *create_data_writer(const HierarchyContext *context) = 0;
   virtual AbstractHierarchyWriter *create_hair_writer(const HierarchyContext *context) = 0;



More information about the Bf-blender-cvs mailing list