[Bf-blender-cvs] [9ccccfb56a3] temp-sybren-usd-patch-01: USD: renamed `should_export_object` to `should_visit_object`

Sybren A. Stüvel noreply at git.blender.org
Thu Nov 28 15:47:49 CET 2019


Commit: 9ccccfb56a3ac67f80ea6fd1b9feb78706b30a4f
Author: Sybren A. Stüvel
Date:   Thu Nov 28 15:18:41 2019 +0100
Branches: temp-sybren-usd-patch-01
https://developer.blender.org/rB9ccccfb56a3ac67f80ea6fd1b9feb78706b30a4f

USD: renamed `should_export_object` to `should_visit_object`

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

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

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

diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.cc b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
index 825a26dec8a..349703ad65a 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
@@ -177,7 +177,7 @@ void AbstractHierarchyIterator::export_graph_construct()
     }
 
     // Non-instanced objects always have their object-parent as export-parent.
-    const bool weak_export = !should_export_object(object);
+    const bool weak_export = mark_as_weak_export(object);
     visit_object(object, object->parent, weak_export);
 
     if (weak_export) {
@@ -547,12 +547,12 @@ std::string AbstractHierarchyIterator::path_concatenate(const std::string &paren
   return parent_path + "/" + child_path;
 }
 
+bool AbstractHierarchyIterator::mark_as_weak_export(const Object * /*object*/) const
+{
+  return false;
+}
 bool AbstractHierarchyIterator::should_visit_dupli_object(const DupliObject *dupli_object) const
 {
   // Removing dupli_object->no_draw hides things like custom bone shapes.
   return !dupli_object->no_draw;
 }
-bool AbstractHierarchyIterator::should_export_object(const Object * /*object*/) const
-{
-  return true;
-}
diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.h b/source/blender/usd/intern/abstract_hierarchy_iterator.h
index b58a98d0f6f..bf13627489e 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.h
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.h
@@ -209,8 +209,22 @@ class AbstractHierarchyIterator {
   virtual std::string path_concatenate(const std::string &parent_path,
                                        const std::string &child_path) const;
 
+  /* Return whether this object should be marked as 'weak export' or not.
+   *
+   * When this returns false, writers for the transform and data are created,
+   * and dupli-objects dupli-object generated from this object will be passed to
+   * should_visit_dupli_object().
+   *
+   * When this returns true, only a transform writer is created and marked as
+   * 'weak export'. In this case, the transform writer will be removed before
+   * exporting starts, unless a decendant of this object is to be exported.
+   * Dupli-object generated from this object will also be skipped.
+   *
+   * See HierarchyContext::weak_export.
+   */
+  virtual bool mark_as_weak_export(const Object *object) const;
+
   virtual bool should_visit_dupli_object(const DupliObject *dupli_object) const;
-  virtual bool should_export_object(const Object *object) const;
 
   /* These functions should create an AbstractHierarchyWriter subclass instance, or return
    * nullptr if the object or its data should not be exported. Returning a nullptr for
diff --git a/source/blender/usd/intern/usd_hierarchy_iterator.cc b/source/blender/usd/intern/usd_hierarchy_iterator.cc
index 2216a0c8f8a..c7531b74a4f 100644
--- a/source/blender/usd/intern/usd_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/usd_hierarchy_iterator.cc
@@ -49,15 +49,15 @@ USDHierarchyIterator::USDHierarchyIterator(Depsgraph *depsgraph,
 {
 }
 
-bool USDHierarchyIterator::should_export_object(const Object *object) const
+bool USDHierarchyIterator::mark_as_weak_export(const Object *object) const
 {
   if (params.selected_objects_only && (object->base_flag & BASE_SELECTED) == 0) {
-    return false;
+    return true;
   }
   if (params.visible_objects_only && (object->base_flag & BASE_VISIBLE_VIEWLAYER) == 0) {
-    return false;
+    return true;
   }
-  return true;
+  return false;
 }
 
 void USDHierarchyIterator::delete_object_writer(AbstractHierarchyWriter *writer)
diff --git a/source/blender/usd/intern/usd_hierarchy_iterator.h b/source/blender/usd/intern/usd_hierarchy_iterator.h
index 83416181ebf..f4441d64f75 100644
--- a/source/blender/usd/intern/usd_hierarchy_iterator.h
+++ b/source/blender/usd/intern/usd_hierarchy_iterator.h
@@ -49,7 +49,7 @@ class USDHierarchyIterator : public AbstractHierarchyIterator {
   virtual std::string make_valid_name(const std::string &name) const override;
 
  protected:
-  virtual bool should_export_object(const Object *object) const override;
+  virtual bool mark_as_weak_export(const Object *object) const override;
 
   virtual AbstractHierarchyWriter *create_xform_writer(const HierarchyContext *context) override;
   virtual AbstractHierarchyWriter *create_data_writer(const HierarchyContext *context) override;



More information about the Bf-blender-cvs mailing list