[Bf-blender-cvs] [3b4943b2c6a] temp-sybren-usd-patch-02: USD: moved all code into C++ namespace 'USD'

Sybren A. Stüvel noreply at git.blender.org
Wed Dec 11 16:37:09 CET 2019


Commit: 3b4943b2c6a1d0f066191d0b235a4b80a6a087ef
Author: Sybren A. Stüvel
Date:   Wed Dec 11 15:54:54 2019 +0100
Branches: temp-sybren-usd-patch-02
https://developer.blender.org/rB3b4943b2c6a1d0f066191d0b235a4b80a6a087ef

USD: moved all code into C++ namespace 'USD'

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

M	source/blender/usd/intern/abstract_hierarchy_iterator.cc
M	source/blender/usd/intern/abstract_hierarchy_iterator.h
M	source/blender/usd/intern/usd_capi.cc
M	source/blender/usd/intern/usd_exporter_context.h
M	source/blender/usd/intern/usd_hierarchy_iterator.cc
M	source/blender/usd/intern/usd_hierarchy_iterator.h
M	source/blender/usd/intern/usd_writer_abstract.cc
M	source/blender/usd/intern/usd_writer_abstract.h
M	source/blender/usd/intern/usd_writer_camera.cc
M	source/blender/usd/intern/usd_writer_camera.h
M	source/blender/usd/intern/usd_writer_hair.cc
M	source/blender/usd/intern/usd_writer_hair.h
M	source/blender/usd/intern/usd_writer_light.cc
M	source/blender/usd/intern/usd_writer_light.h
M	source/blender/usd/intern/usd_writer_mesh.cc
M	source/blender/usd/intern/usd_writer_mesh.h
M	source/blender/usd/intern/usd_writer_transform.cc
M	source/blender/usd/intern/usd_writer_transform.h
M	tests/gtests/usd/abstract_hierarchy_iterator_test.cc
M	tests/gtests/usd/hierarchy_context_order_test.cc

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

diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.cc b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
index 159383c2448..b0e01f55d66 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.cc
@@ -38,6 +38,8 @@ extern "C" {
 #include "DEG_depsgraph_query.h"
 }
 
+namespace USD {
+
 const HierarchyContext *HierarchyContext::root()
 {
   return nullptr;
@@ -556,3 +558,5 @@ bool AbstractHierarchyIterator::should_visit_dupli_object(const DupliObject *dup
   // Removing dupli_object->no_draw hides things like custom bone shapes.
   return !dupli_object->no_draw;
 }
+
+}  // namespace USD
diff --git a/source/blender/usd/intern/abstract_hierarchy_iterator.h b/source/blender/usd/intern/abstract_hierarchy_iterator.h
index bf13627489e..18d0b891ddc 100644
--- a/source/blender/usd/intern/abstract_hierarchy_iterator.h
+++ b/source/blender/usd/intern/abstract_hierarchy_iterator.h
@@ -48,6 +48,8 @@ struct Object;
 struct ParticleSystem;
 struct ViewLayer;
 
+namespace USD {
+
 class AbstractHierarchyWriter;
 
 /* HierarchyContext structs are created by the AbstractHierarchyIterator. Each HierarchyContext
@@ -243,4 +245,6 @@ class AbstractHierarchyIterator {
   virtual void delete_object_writer(AbstractHierarchyWriter *writer) = 0;
 };
 
+}  // namespace USD
+
 #endif /* __USD__ABSTRACT_HIERARCHY_ITERATOR_H__ */
diff --git a/source/blender/usd/intern/usd_capi.cc b/source/blender/usd/intern/usd_capi.cc
index d6130d36423..3f1a61a8ebc 100644
--- a/source/blender/usd/intern/usd_capi.cc
+++ b/source/blender/usd/intern/usd_capi.cc
@@ -45,6 +45,8 @@ extern "C" {
 #include "WM_types.h"
 }
 
+namespace USD {
+
 struct ExportJobData {
   ViewLayer *view_layer;
   Main *bmain;
@@ -175,6 +177,8 @@ static void export_endjob(void *customdata)
   WM_set_locked_interface(data->wm, false);
 }
 
+}  // namespace USD
+
 bool USD_export(bContext *C,
                 const char *filepath,
                 const USDExportParams *params,
@@ -183,8 +187,8 @@ bool USD_export(bContext *C,
   ViewLayer *view_layer = CTX_data_view_layer(C);
   Scene *scene = CTX_data_scene(C);
 
-  ExportJobData *job = static_cast<ExportJobData *>(
-      MEM_mallocN(sizeof(ExportJobData), "ExportJobData"));
+  USD::ExportJobData *job = static_cast<USD::ExportJobData *>(
+      MEM_mallocN(sizeof(USD::ExportJobData), "ExportJobData"));
 
   job->bmain = CTX_data_main(C);
   job->wm = CTX_wm_manager(C);
@@ -202,7 +206,7 @@ bool USD_export(bContext *C,
     /* setup job */
     WM_jobs_customdata_set(wm_job, job, MEM_freeN);
     WM_jobs_timer(wm_job, 0.1, NC_SCENE | ND_FRAME, NC_SCENE | ND_FRAME);
-    WM_jobs_callbacks(wm_job, export_startjob, NULL, NULL, export_endjob);
+    WM_jobs_callbacks(wm_job, USD::export_startjob, NULL, NULL, USD::export_endjob);
 
     WM_jobs_start(CTX_wm_manager(C), wm_job);
   }
@@ -211,8 +215,8 @@ bool USD_export(bContext *C,
     short stop = 0, do_update = 0;
     float progress = 0.f;
 
-    export_startjob(job, &stop, &do_update, &progress);
-    export_endjob(job);
+    USD::export_startjob(job, &stop, &do_update, &progress);
+    USD::export_endjob(job);
     export_ok = job->export_ok;
 
     MEM_freeN(job);
diff --git a/source/blender/usd/intern/usd_exporter_context.h b/source/blender/usd/intern/usd_exporter_context.h
index 876aa13fd6b..aaa0121807c 100644
--- a/source/blender/usd/intern/usd_exporter_context.h
+++ b/source/blender/usd/intern/usd_exporter_context.h
@@ -26,6 +26,9 @@
 
 struct Depsgraph;
 struct Object;
+
+namespace USD {
+
 class USDHierarchyIterator;
 
 struct USDExporterContext {
@@ -36,4 +39,6 @@ struct USDExporterContext {
   const USDExportParams &export_params;
 };
 
+}  // namespace USD
+
 #endif /* __USD__USD_EXPORTER_CONTEXT_H__ */
diff --git a/source/blender/usd/intern/usd_hierarchy_iterator.cc b/source/blender/usd/intern/usd_hierarchy_iterator.cc
index da69aa4a506..b7912b8ea46 100644
--- a/source/blender/usd/intern/usd_hierarchy_iterator.cc
+++ b/source/blender/usd/intern/usd_hierarchy_iterator.cc
@@ -42,6 +42,8 @@ extern "C" {
 #include "DNA_object_types.h"
 }
 
+namespace USD {
+
 USDHierarchyIterator::USDHierarchyIterator(Depsgraph *depsgraph,
                                            pxr::UsdStageRefPtr stage,
                                            const USDExportParams &params)
@@ -143,3 +145,5 @@ AbstractHierarchyWriter *USDHierarchyIterator::create_particle_writer(const Hier
 {
   return nullptr;
 }
+
+}  // namespace USD
diff --git a/source/blender/usd/intern/usd_hierarchy_iterator.h b/source/blender/usd/intern/usd_hierarchy_iterator.h
index f4441d64f75..2a61f2ae3d7 100644
--- a/source/blender/usd/intern/usd_hierarchy_iterator.h
+++ b/source/blender/usd/intern/usd_hierarchy_iterator.h
@@ -32,6 +32,8 @@ struct Depsgraph;
 struct ID;
 struct Object;
 
+namespace USD {
+
 class USDHierarchyIterator : public AbstractHierarchyIterator {
  private:
   const pxr::UsdStageRefPtr stage;
@@ -63,4 +65,6 @@ class USDHierarchyIterator : public AbstractHierarchyIterator {
   USDExporterContext create_usd_export_context(const HierarchyContext *context);
 };
 
+}  // namespace USD
+
 #endif /* __USD__USD_HIERARCHY_ITERATOR_H__ */
diff --git a/source/blender/usd/intern/usd_writer_abstract.cc b/source/blender/usd/intern/usd_writer_abstract.cc
index 00e7ef050f1..07b42ef3d6b 100644
--- a/source/blender/usd/intern/usd_writer_abstract.cc
+++ b/source/blender/usd/intern/usd_writer_abstract.cc
@@ -37,7 +37,9 @@ static const pxr::TfToken preview_shader("previewShader", pxr::TfToken::Immortal
 static const pxr::TfToken preview_surface("UsdPreviewSurface", pxr::TfToken::Immortal);
 static const pxr::TfToken roughness("roughness", pxr::TfToken::Immortal);
 static const pxr::TfToken surface("surface", pxr::TfToken::Immortal);
-};  // namespace usdtokens
+}  // namespace usdtokens
+
+namespace USD {
 
 USDAbstractWriter::USDAbstractWriter(const USDExporterContext &usd_export_context)
     : usd_export_context_(usd_export_context),
@@ -141,3 +143,5 @@ pxr::UsdShadeMaterial USDAbstractWriter::ensure_usd_material(Material *material)
 
   return usd_material;
 }
+
+}  // namespace USD
diff --git a/source/blender/usd/intern/usd_writer_abstract.h b/source/blender/usd/intern/usd_writer_abstract.h
index 3c022ecf4a5..136b9e70e86 100644
--- a/source/blender/usd/intern/usd_writer_abstract.h
+++ b/source/blender/usd/intern/usd_writer_abstract.h
@@ -38,6 +38,8 @@ struct Main;
 struct Material;
 struct Object;
 
+namespace USD {
+
 class USDAbstractWriter : public AbstractHierarchyWriter {
  protected:
   const USDExporterContext usd_export_context_;
@@ -71,4 +73,6 @@ class USDAbstractWriter : public AbstractHierarchyWriter {
   pxr::UsdShadeMaterial ensure_usd_material(Material *material);
 };
 
+}  // namespace USD
+
 #endif /* __USD__USD_WRITER_ABSTRACT_H__ */
diff --git a/source/blender/usd/intern/usd_writer_camera.cc b/source/blender/usd/intern/usd_writer_camera.cc
index fa1db6ad39a..9b85d69559c 100644
--- a/source/blender/usd/intern/usd_writer_camera.cc
+++ b/source/blender/usd/intern/usd_writer_camera.cc
@@ -30,6 +30,8 @@ extern "C" {
 #include "DNA_scene_types.h"
 }
 
+namespace USD {
+
 USDCameraWriter::USDCameraWriter(const USDExporterContext &ctx) : USDAbstractWriter(ctx)
 {
 }
@@ -105,3 +107,5 @@ void USDCameraWriter::do_write(HierarchyContext &context)
     usd_camera.CreateFocusDistanceAttr().Set(focus_distance, timecode);
   }
 }
+
+}  // namespace USD
diff --git a/source/blender/usd/intern/usd_writer_camera.h b/source/blender/usd/intern/usd_writer_camera.h
index 98421b14af7..86b5ed464b0 100644
--- a/source/blender/usd/intern/usd_writer_camera.h
+++ b/source/blender/usd/intern/usd_writer_camera.h
@@ -21,6 +21,8 @@
 
 #include "usd_writer_abstract.h"
 
+namespace USD {
+
 /* Writer for writing camera data to UsdGeomCamera. */
 class USDCameraWriter : public USDAbstractWriter {
  public:
@@ -31,4 +33,6 @@ class USDCameraWriter : public USDAbstractWriter {
   virtual void do_write(HierarchyContext &context) override;
 };
 
+}  // namespace USD
+
 #endif /* __USD__USD_WRITER_CAMERA_H__ */
diff --git a/source/blender/usd/intern/usd_writer_hair.cc b/source/blender/usd/intern/usd_writer_hair.cc
index 47fd4325fac..d09922be908 100644
--- a/source/blender/usd/intern/usd_writer_hair.cc
+++ b/source/blender/usd/intern/usd_writer_hair.cc
@@ -28,6 +28,8 @@ extern "C" {
 #include "DNA_particle_types.h"
 }
 
+namespace USD {
+
 USDHairWriter::USDHairWriter(const USDExporterContext &ctx) : USDAbstractWriter(ctx)
 {
 }
@@ -78,3 +80,5 @@ bool USDHairWriter::check_is_animated(const HierarchyContext &) const
 {
   return true;
 }
+
+}  // namespace USD
diff --git a/source/blender/usd/intern/usd_writer_hair.h b/source/blender/usd/intern/usd_writer_hair.h
index a50da3cb903..ccb5af76099 100644
--- a/source/blender/usd/intern/usd_writer_hair.h
+++ b/source/blender/usd/intern/usd_writer_hair.h
@@ -21,6 +21,8 @@
 
 #include "usd_writer_abstract.h"
 
+namespace USD {
+
 /* Writer for writing hair particle data as USD curves. */
 class USDHairWriter : public USDAbstractWriter {
  public:
@@ -31,4 +33,6 @@ class USDHairWriter : public USDAbstractWriter {
   virtual bool check_is_animated(const HierarchyContext &context) const override;
 };
 
+}  // namespace USD
+
 #endif /* __USD__USD_WRITER_HAIR_H__ */
diff --git a/source/blender/usd/intern/usd_writer_light.cc b/source/blender/usd/intern/usd_writer_light.cc
index d505b7dbb5e..e13e2c58a79 100644
--- a/source/blender/usd/intern/usd_writer_light.cc
+++ b/source/blender/usd/intern/usd_writer_light.cc
@@ -32,6 +32,8 @@ extern "C" {
 #include "DNA_object_types.h"
 }
 
+namespace USD {
+
 USDLightWriter::USDLightWriter(const USDExporterContext &ctx) : USDAbstractWriter(ctx)
 {
 }
@@ -106,3 +108,5 @@ void USDLightWriter::do_write(HierarchyContext &context)
   usd_light.CreateColorAttr().Set(pxr::GfVec3f(light->r, light->g, light->b), timecode);
   usd_light.CreateSpecularAttr().Set(light->spec_fac, timecode);
 }
+
+}  // namespace USD
diff --git a/source/blender/usd/intern/usd_writer_light.h b/source/blender/usd/intern/usd_writer_light.h
index 6a0710b7dff..3813412c330 100644
--- a/source/blender/usd/intern/usd_writer_light.h
+++ b/source/ble

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list