[Bf-blender-cvs] [e7d1d6b4a58] sybren-usd-experiments: NULL -> nullptr

Sybren A. Stüvel noreply at git.blender.org
Wed Jun 19 17:59:20 CEST 2019


Commit: e7d1d6b4a5879454825172881a3caf63b0f84d92
Author: Sybren A. Stüvel
Date:   Fri Jun 14 18:06:39 2019 +0200
Branches: sybren-usd-experiments
https://developer.blender.org/rBe7d1d6b4a5879454825172881a3caf63b0f84d92

NULL -> nullptr

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

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

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

diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.cc b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
index 61d43a86b60..b108f38accc 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
@@ -36,13 +36,13 @@ void AbstractHierarchyIterator::iterate()
   ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
   for (Base *base = static_cast<Base *>(view_layer->object_bases.first); base; base = base->next) {
     Object *ob = base->object;
-    visit_object(base, ob, ob->parent, NULL);
+    visit_object(base, ob, ob->parent, nullptr);
   }
 }
 
 std::string AbstractHierarchyIterator::get_object_name(const Object *const object) const
 {
-  if (object == NULL) {
+  if (object == nullptr) {
     return "";
   }
 
@@ -51,7 +51,7 @@ std::string AbstractHierarchyIterator::get_object_name(const Object *const objec
 
 std::string AbstractHierarchyIterator::get_id_name(const ID *const id) const
 {
-  if (id == NULL) {
+  if (id == nullptr) {
     return "";
   }
 
@@ -61,7 +61,7 @@ std::string AbstractHierarchyIterator::get_id_name(const ID *const id) const
 /**
  * \brief get_object_dag_path_name returns the name under which the object
  *  will be exported in the Alembic file. It is of the form
- *  "[../grandparent/]parent/object" if dupli_parent is NULL, or
+ *  "[../grandparent/]parent/object" if dupli_parent is nullptr, or
  *  "dupli_parent/[../grandparent/]parent/object" otherwise.
  * \param ob:
  * \param dupli_parent:
@@ -103,7 +103,7 @@ void AbstractHierarchyIterator::visit_object(Base *base,
 {
   /* If an object isn't exported itself, its duplilist shouldn't be
    * exported either. */
-  if (!should_visit_object(base, dupliObParent != NULL)) {
+  if (!should_visit_object(base, dupliObParent != nullptr)) {
     return;
   }
 
@@ -114,8 +114,8 @@ void AbstractHierarchyIterator::visit_object(Base *base,
 
   if (lb) {
     DupliObject *link = static_cast<DupliObject *>(lb->first);
-    Object *dupli_ob = NULL;
-    Object *dupli_parent = NULL;
+    Object *dupli_ob = nullptr;
+    Object *dupli_parent = nullptr;
 
     for (; link; link = link->next) {
       if (!should_visit_duplilink(link)) {
@@ -139,12 +139,11 @@ TEMP_WRITER_TYPE *AbstractHierarchyIterator::export_object_and_parents(Object *o
   BLI_assert(ob != parent);
   BLI_assert(ob != dupliObParent);
 
-  std::string name;
-  name = get_object_dag_path_name(ob, dupliObParent);
+  std::string name = get_object_dag_path_name(ob, dupliObParent);
 
   /* check if we have already created a transform writer for this object */
   TEMP_WRITER_TYPE *xform_writer = get_writer(name);
-  if (xform_writer != NULL) {
+  if (xform_writer != nullptr) {
     return xform_writer;
   }
 
@@ -156,15 +155,15 @@ TEMP_WRITER_TYPE *AbstractHierarchyIterator::export_object_and_parents(Object *o
      * return the parent's writer pointer. */
     if (parent->parent) {
       if (parent == dupliObParent) {
-        parent_writer = export_object_and_parents(parent, parent->parent, NULL);
+        parent_writer = export_object_and_parents(parent, parent->parent, nullptr);
       }
       else {
         parent_writer = export_object_and_parents(parent, parent->parent, dupliObParent);
       }
     }
     else if (parent == dupliObParent) {
-      if (dupliObParent->parent == NULL) {
-        parent_writer = export_object_and_parents(parent, NULL, NULL);
+      if (dupliObParent->parent == nullptr) {
+        parent_writer = export_object_and_parents(parent, nullptr, nullptr);
       }
       else {
         parent_writer = export_object_and_parents(
@@ -179,13 +178,13 @@ TEMP_WRITER_TYPE *AbstractHierarchyIterator::export_object_and_parents(Object *o
   }
 
   xform_writer = create_xform_writer(name, ob, parent_writer);
-  if (xform_writer != NULL) {
+  if (xform_writer != nullptr) {
     writers[name] = xform_writer;
   }
 
-  if (ob->data != NULL) {
+  if (ob->data != nullptr) {
     TEMP_WRITER_TYPE *data_writer = create_data_writer(name, ob, xform_writer);
-    if (data_writer != NULL) {
+    if (data_writer != nullptr) {
       writers[name] = data_writer;
     }
   }
@@ -198,7 +197,7 @@ TEMP_WRITER_TYPE *AbstractHierarchyIterator::get_writer(const std::string &name)
   WriterMap::iterator it = writers.find(name);
 
   if (it == writers.end()) {
-    return NULL;
+    return nullptr;
   }
   return it->second;
 }
diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.h b/source/blender/usd/intern/abstract_hierarchy_iterator.h
index 0b305af4f9c..d4ff4491903 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.h
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.h
@@ -14,10 +14,11 @@ struct ViewLayer;
 typedef void TEMP_WRITER_TYPE;
 
 class AbstractHierarchyIterator {
+ public:
+  typedef std::map<std::string, TEMP_WRITER_TYPE *> WriterMap;
+
  protected:
   Depsgraph *depsgraph;
-
-  typedef std::map<std::string, TEMP_WRITER_TYPE *> WriterMap;
   WriterMap writers;
 
  public:
diff --git a/source/blender/usd/intern/usd_hierarchy_iterator.cc b/source/blender/usd/intern/usd_hierarchy_iterator.cc
index 4d10080d614..5c64f42f939 100644
--- a/source/blender/usd/intern/usd_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/usd_hierarchy_iterator.cc
@@ -32,7 +32,7 @@ void USDHierarchyIterator::delete_object_writer(TEMP_WRITER_TYPE *writer)
 
 std::string USDHierarchyIterator::get_id_name(const ID *const id) const
 {
-  BLI_assert(id != NULL);
+  BLI_assert(id != nullptr);
   std::string name(id->name + 2);
   return pxr::TfMakeValidIdentifier(name);
 }
@@ -68,7 +68,7 @@ TEMP_WRITER_TYPE *USDHierarchyIterator::create_data_writer(const std::string &na
       printf("USD-\033[34mXFORM-ONLY\033[0m object %s  type=%d (no data writer)\n",
              ctx.ob_eval->id.name,
              ctx.ob_eval->type);
-      return NULL;
+      return nullptr;
   }
 
   if (!data_writer->is_supported()) {
@@ -76,7 +76,7 @@ TEMP_WRITER_TYPE *USDHierarchyIterator::create_data_writer(const std::string &na
            ctx.ob_eval->id.name,
            ctx.ob_eval->type);
     delete data_writer;
-    return NULL;
+    return nullptr;
   }
 
   data_writer->write();



More information about the Bf-blender-cvs mailing list