[Bf-blender-cvs] [baeeb1488e4] usd-dev: USD IO: fix compiler warnings and errors

makowalski noreply at git.blender.org
Mon Aug 9 05:22:07 CEST 2021


Commit: baeeb1488e46c027153927c46c4725b485359f80
Author: makowalski
Date:   Sun Aug 8 23:07:26 2021 -0400
Branches: usd-dev
https://developer.blender.org/rBbaeeb1488e46c027153927c46c4725b485359f80

USD IO: fix compiler warnings and errors

Fixed warnings and errors for linux and darwin
builds.  Also fixed copyright date in
usd_light_convert.cc.

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

M	source/blender/io/common/IO_abstract_hierarchy_iterator.h
M	source/blender/io/usd/intern/usd_capi_export.cc
M	source/blender/io/usd/intern/usd_capi_import.cc
M	source/blender/io/usd/intern/usd_light_convert.cc
M	source/blender/io/usd/intern/usd_reader_prim.h
M	source/blender/io/usd/intern/usd_writer_material.cc

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

diff --git a/source/blender/io/common/IO_abstract_hierarchy_iterator.h b/source/blender/io/common/IO_abstract_hierarchy_iterator.h
index ab27c806f41..76f7e66918d 100644
--- a/source/blender/io/common/IO_abstract_hierarchy_iterator.h
+++ b/source/blender/io/common/IO_abstract_hierarchy_iterator.h
@@ -363,13 +363,13 @@ class AbstractHierarchyIterator {
   virtual void release_writer(AbstractHierarchyWriter *writer) = 0;
 
   /* Return true if data writers should be created for this context. */
-  virtual bool include_data_writers(const HierarchyContext *context) const
+  virtual bool include_data_writers(const HierarchyContext *) const
   {
     return true;
   }
 
   /* Return true if children of the context should be converted to writers. */
-  virtual bool include_child_writers(const HierarchyContext *context) const
+  virtual bool include_child_writers(const HierarchyContext *) const
   {
     return true;
   }
diff --git a/source/blender/io/usd/intern/usd_capi_export.cc b/source/blender/io/usd/intern/usd_capi_export.cc
index 1df87459551..4eb79b1583d 100644
--- a/source/blender/io/usd/intern/usd_capi_export.cc
+++ b/source/blender/io/usd/intern/usd_capi_export.cc
@@ -260,7 +260,7 @@ static void export_startjob(void *customdata,
     pxr::UsdPrim defaultPrim = usd_stage->GetPrimAtPath(pxr::SdfPath(valid_default_prim_path));
 
     if (defaultPrim.IsValid()) {
-      WM_reportf(RPT_INFO, "Set default prim path: %s", valid_default_prim_path);
+      WM_reportf(RPT_INFO, "Set default prim path: %s", valid_default_prim_path.c_str());
       usd_stage->SetDefaultPrim(defaultPrim);
     }
   }
diff --git a/source/blender/io/usd/intern/usd_capi_import.cc b/source/blender/io/usd/intern/usd_capi_import.cc
index bcd9be24e37..48d1bbd51d1 100644
--- a/source/blender/io/usd/intern/usd_capi_import.cc
+++ b/source/blender/io/usd/intern/usd_capi_import.cc
@@ -441,7 +441,7 @@ static void import_startjob(void *customdata, short *stop, short *do_update, flo
   CacheFile *cache_file = nullptr;
 
   /* Handle instance prototypes.
-  /* TODO(makowalski): Move this logic inside USDReaderStage? */
+   * TODO(makowalski): Move this logic inside USDReaderStage? */
   for (const auto &pair : archive->proto_readers()) {
 
     for (USDPrimReader *reader : pair.second) {
@@ -466,7 +466,7 @@ static void import_startjob(void *customdata, short *stop, short *do_update, flo
 
       ob->parent = parent_reader ? parent_reader->object() : nullptr;
 
-      // TODO(makowalski): Handle progress update.
+      /* TODO(makowalski): Handle progress update. */
     }
   }
 
diff --git a/source/blender/io/usd/intern/usd_light_convert.cc b/source/blender/io/usd/intern/usd_light_convert.cc
index f9d6d52b6fa..156540aaec3 100644
--- a/source/blender/io/usd/intern/usd_light_convert.cc
+++ b/source/blender/io/usd/intern/usd_light_convert.cc
@@ -13,7 +13,7 @@
  * along with this program; if not, write to the Free Software Foundation,
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
- * The Original Code is Copyright (C) NVIDIA Corporation.
+ * The Original Code is Copyright (C) 2021 NVIDIA Corporation.
  * All rights reserved.
  */
 
@@ -41,7 +41,7 @@
 #include "BLI_listbase.h"
 #include "BLI_path_util.h"
 #include "BLI_string.h"
-#include "BlI_math.h"
+#include "BLI_math.h"
 #include "DNA_light_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_world_types.h"
diff --git a/source/blender/io/usd/intern/usd_reader_prim.h b/source/blender/io/usd/intern/usd_reader_prim.h
index 02ec6dc532b..3beb6231283 100644
--- a/source/blender/io/usd/intern/usd_reader_prim.h
+++ b/source/blender/io/usd/intern/usd_reader_prim.h
@@ -97,7 +97,7 @@ class USDPrimReader {
   {
     return false;
   }
-  virtual void apply_cache_file(CacheFile *cache_file)
+  virtual void apply_cache_file(CacheFile * /* cache_file */)
   {
   }
 
diff --git a/source/blender/io/usd/intern/usd_writer_material.cc b/source/blender/io/usd/intern/usd_writer_material.cc
index 74344aec541..68bede43468 100644
--- a/source/blender/io/usd/intern/usd_writer_material.cc
+++ b/source/blender/io/usd/intern/usd_writer_material.cc
@@ -652,7 +652,7 @@ static std::string get_node_tex_image_filepath(bNode *node)
     unsigned short numlen;
 
     BLI_path_sequence_decode(filepath, head, tail, &numlen);
-    sprintf(filepath, "%s%s%s", head, "<UDIM>", tail);
+    return (std::string(head) + "<UDIM>" + std::string(tail));
   }
 
   return std::string(filepath);
@@ -669,8 +669,6 @@ static pxr::TfToken get_node_tex_image_color_space(bNode *node)
     return pxr::TfToken();
   }
 
-  NodeTexImage *tex_original = (NodeTexImage *)node->storage;
-
   Image *ima = reinterpret_cast<Image *>(node->id);
 
   pxr::TfToken color_space;
@@ -705,10 +703,10 @@ static const int HD_CYCLES_CURVE_EXPORT_RES = 256;
 // fallback will 'hide' missing future features, and 'may' work. However this code should be
 // considered 'live' and require tweaking with each new version until we can share this conversion
 // somehow. (Perhaps as mentioned above with rna_nodetree.c)
-bool usd_handle_shader_enum(pxr::TfToken a_token,
-                            const std::map<int, std::string> &a_conversion_table,
-                            pxr::UsdShadeShader &a_shader,
-                            int a_value)
+static bool usd_handle_shader_enum(pxr::TfToken a_token,
+                                   const std::map<int, std::string> &a_conversion_table,
+                                   pxr::UsdShadeShader &a_shader,
+                                   const int a_value)
 {
   std::map<int, std::string>::const_iterator it = a_conversion_table.find(a_value);
   if (it != a_conversion_table.end()) {
@@ -1023,17 +1021,17 @@ static const std::map<int, std::string> node_principled_subsurface_method_conver
     {SHD_SUBSURFACE_RANDOM_WALK, "random_walk"},
 };
 
-void to_lower(std::string &string)
+static void to_lower(std::string &string)
 {
   std::transform(string.begin(), string.end(), string.begin(), [](unsigned char c) {
     return std::tolower(c);
   });
 }
 
-void set_default(bNode *node,
-                 bNodeSocket *socketValue,
-                 bNodeSocket *socketName,
-                 pxr::UsdShadeShader usd_shader)
+static void set_default(bNode *node,
+                        bNodeSocket *socketValue,
+                        bNodeSocket *socketName,
+                        pxr::UsdShadeShader usd_shader)
 {
   std::string inputName = socketName->identifier;
 
@@ -1193,10 +1191,10 @@ pxr::UsdShadeShader create_usd_preview_shader_node(USDExporterContext const &usd
 }
 
 /* Creates a USDShadeShader based on given cycles shading node */
-pxr::UsdShadeShader create_cycles_shader_node(pxr::UsdStageRefPtr a_stage,
-                                              pxr::SdfPath &shaderPath,
-                                              bNode *node,
-                                              const USDExportParams &export_params)
+static pxr::UsdShadeShader create_cycles_shader_node(pxr::UsdStageRefPtr a_stage,
+                                                     pxr::SdfPath &shaderPath,
+                                                     bNode *node,
+                                                     const USDExportParams &export_params)
 {
   pxr::SdfPath primpath = shaderPath.AppendChild(
       pxr::TfToken(pxr::TfMakeValidIdentifier(node->name)));
@@ -2034,11 +2032,11 @@ void create_usd_preview_surface_material(USDExporterContext const &usd_export_co
   return;
 }
 
-void store_cycles_nodes(pxr::UsdStageRefPtr a_stage,
-                        bNodeTree *ntree,
-                        pxr::SdfPath shader_path,
-                        bNode **material_out,
-                        const USDExportParams &export_params)
+static void store_cycles_nodes(pxr::UsdStageRefPtr a_stage,
+                               bNodeTree *ntree,
+                               pxr::SdfPath shader_path,
+                               bNode **material_out,
+                               const USDExportParams &export_params)
 {
   for (bNode *node = (bNode *)ntree->nodes.first; node; node = node->next) {
 
@@ -2056,11 +2054,10 @@ void store_cycles_nodes(pxr::UsdStageRefPtr a_stage,
   }
 }
 
-void link_cycles_nodes(pxr::UsdStageRefPtr a_stage,
-                       pxr::UsdShadeMaterial &usd_material,
-                       bNodeTree *ntree,
-                       pxr::SdfPath shader_path,
-                       const USDExportParams &export_params)
+static void link_cycles_nodes(pxr::UsdStageRefPtr a_stage,
+                              pxr::UsdShadeMaterial &usd_material,
+                              bNodeTree *ntree,
+                              pxr::SdfPath shader_path)
 {
   // for all links
   for (bNodeLink *link = (bNodeLink *)ntree->links.first; link; link = link->next) {
@@ -2210,8 +2207,7 @@ void create_usd_cycles_material(pxr::UsdStageRefPtr a_stage,
   link_cycles_nodes(a_stage,
                     usd_material,
                     localtree,
-                    usd_material.GetPath().AppendChild(cyclestokens::cycles),
-                    export_params);
+                    usd_material.GetPath().AppendChild(cyclestokens::cycles));
 
   ntreeFreeLocalTree(localtree);
   MEM_freeN(localtree);



More information about the Bf-blender-cvs mailing list