[Bf-blender-cvs] [6acf0e7ed3b] usd-importer-T81257-merge: USD Import: declared parameters const.

makowalski noreply at git.blender.org
Fri Apr 16 01:02:18 CEST 2021


Commit: 6acf0e7ed3b536a189255ad5fcf7062b4f3cc03a
Author: makowalski
Date:   Thu Apr 15 18:54:17 2021 -0400
Branches: usd-importer-T81257-merge
https://developer.blender.org/rB6acf0e7ed3b536a189255ad5fcf7062b4f3cc03a

USD Import: declared parameters const.

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

M	source/blender/io/usd/intern/usd_reader_camera.cc
M	source/blender/io/usd/intern/usd_reader_curve.cc
M	source/blender/io/usd/intern/usd_reader_instance.cc
M	source/blender/io/usd/intern/usd_reader_light.cc
M	source/blender/io/usd/intern/usd_reader_material.cc
M	source/blender/io/usd/intern/usd_reader_mesh.cc
M	source/blender/io/usd/intern/usd_reader_nurbs.cc
M	source/blender/io/usd/intern/usd_reader_volume.cc
M	source/blender/io/usd/intern/usd_reader_xform.cc

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

diff --git a/source/blender/io/usd/intern/usd_reader_camera.cc b/source/blender/io/usd/intern/usd_reader_camera.cc
index c2a524f0673..129532b3e38 100644
--- a/source/blender/io/usd/intern/usd_reader_camera.cc
+++ b/source/blender/io/usd/intern/usd_reader_camera.cc
@@ -48,7 +48,7 @@ extern "C" {
 
 namespace blender::io::usd {
 
-void USDCameraReader::create_object(Main *bmain, double /* motionSampleTime */)
+void USDCameraReader::create_object(Main *bmain, const double /* motionSampleTime */)
 {
   Camera *bcam = static_cast<Camera *>(BKE_camera_add(bmain, name_.c_str()));
 
@@ -56,7 +56,7 @@ void USDCameraReader::create_object(Main *bmain, double /* motionSampleTime */)
   object_->data = bcam;
 }
 
-void USDCameraReader::read_object_data(Main *bmain, double motionSampleTime)
+void USDCameraReader::read_object_data(Main *bmain, const double motionSampleTime)
 {
   Camera *bcam = (Camera *)object_->data;
 
diff --git a/source/blender/io/usd/intern/usd_reader_curve.cc b/source/blender/io/usd/intern/usd_reader_curve.cc
index ab19d098870..a3519699bdd 100644
--- a/source/blender/io/usd/intern/usd_reader_curve.cc
+++ b/source/blender/io/usd/intern/usd_reader_curve.cc
@@ -59,7 +59,7 @@ extern "C" {
 
 namespace blender::io::usd {
 
-void USDCurvesReader::create_object(Main *bmain, double /* motionSampleTime */)
+void USDCurvesReader::create_object(Main *bmain, const double /* motionSampleTime */)
 {
   curve_ = BKE_curve_add(bmain, name_.c_str(), OB_CURVE);
 
@@ -83,7 +83,7 @@ void USDCurvesReader::read_object_data(Main *bmain, double motionSampleTime)
   USDXformReader::read_object_data(bmain, motionSampleTime);
 }
 
-void USDCurvesReader::read_curve_sample(Curve *cu, double motionSampleTime)
+void USDCurvesReader::read_curve_sample(Curve *cu, const double motionSampleTime)
 {
   curve_prim_ = pxr::UsdGeomBasisCurves(prim_);
 
@@ -198,9 +198,9 @@ void USDCurvesReader::read_curve_sample(Curve *cu, double motionSampleTime)
 }
 
 Mesh *USDCurvesReader::read_mesh(struct Mesh *existing_mesh,
-                                 double motionSampleTime,
-                                 int read_flag,
-                                 float vel_scale,
+                                 const double motionSampleTime,
+                                 const int read_flag,
+                                 const float vel_scale,
                                  const char **err_str)
 {
   if (!curve_prim_) {
diff --git a/source/blender/io/usd/intern/usd_reader_instance.cc b/source/blender/io/usd/intern/usd_reader_instance.cc
index c6f380c1670..e645b0237b9 100644
--- a/source/blender/io/usd/intern/usd_reader_instance.cc
+++ b/source/blender/io/usd/intern/usd_reader_instance.cc
@@ -38,7 +38,7 @@ bool USDInstanceReader::valid() const
   return prim_.IsValid() && prim_.IsInstance();
 }
 
-void USDInstanceReader::create_object(Main *bmain, double /* motionSampleTime */)
+void USDInstanceReader::create_object(Main *bmain, const double /* motionSampleTime */)
 {
   this->object_ = BKE_object_add_only_object(bmain, OB_EMPTY, name_.c_str());
   this->object_->data = nullptr;
diff --git a/source/blender/io/usd/intern/usd_reader_light.cc b/source/blender/io/usd/intern/usd_reader_light.cc
index 454f424f9ca..7db02a42068 100644
--- a/source/blender/io/usd/intern/usd_reader_light.cc
+++ b/source/blender/io/usd/intern/usd_reader_light.cc
@@ -44,7 +44,7 @@ extern "C" {
 
 namespace blender::io::usd {
 
-void USDLightReader::create_object(Main *bmain, double /* motionSampleTime */)
+void USDLightReader::create_object(Main *bmain, const double /* motionSampleTime */)
 {
   Light *blight = static_cast<Light *>(BKE_light_add(bmain, name_.c_str()));
 
@@ -52,7 +52,7 @@ void USDLightReader::create_object(Main *bmain, double /* motionSampleTime */)
   object_->data = blight;
 }
 
-void USDLightReader::read_object_data(Main *bmain, double motionSampleTime)
+void USDLightReader::read_object_data(Main *bmain, const double motionSampleTime)
 {
   Light *blight = (Light *)object_->data;
 
diff --git a/source/blender/io/usd/intern/usd_reader_material.cc b/source/blender/io/usd/intern/usd_reader_material.cc
index fa538f6abe7..790b87d1bdf 100644
--- a/source/blender/io/usd/intern/usd_reader_material.cc
+++ b/source/blender/io/usd/intern/usd_reader_material.cc
@@ -79,7 +79,8 @@ static const pxr::TfToken UsdPrimvarReader_float2("UsdPrimvarReader_float2",
 static const pxr::TfToken UsdUVTexture("UsdUVTexture", pxr::TfToken::Immortal);
 }  // namespace usdtokens
 
-static bNode *add_node(const bContext *C, bNodeTree *ntree, int type, float locx, float locy)
+static bNode *add_node(
+    const bContext *C, bNodeTree *ntree, const int type, const float locx, const float locy)
 {
   bNode *new_node = nodeAddStaticNode(C, ntree, type);
 
@@ -112,7 +113,7 @@ static void link_nodes(
 }
 
 static pxr::UsdShadeShader get_source_shader(const pxr::UsdShadeConnectableAPI &source,
-                                             pxr::TfToken in_shader_id)
+                                             const pxr::TfToken in_shader_id)
 {
   if (source && source.GetPrim().IsA<pxr::UsdShadeShader>()) {
     pxr::UsdShadeShader source_shader(source.GetPrim());
@@ -249,8 +250,11 @@ namespace {
 // Compute the x- and y-coordinates for placing a new node in an unoccupied region of
 // the column with the given index.  Returns the coordinates in r_locx and r_locy and
 // updates the column-occupancy information in r_ctx.
-void compute_node_loc(
-    int column, float node_height, float &r_locx, float &r_locy, NodePlacementContext &r_ctx)
+void compute_node_loc(const int column,
+                      const float node_height,
+                      float &r_locx,
+                      float &r_locy,
+                      NodePlacementContext &r_ctx)
 {
   r_locx = r_ctx.origx - column * r_ctx.horizontal_step;
 
@@ -408,7 +412,7 @@ void USDMaterialReader::set_node_input(const pxr::UsdShadeInput &usd_input,
                                        bNode *dest_node,
                                        const char *dest_socket_name,
                                        bNodeTree *ntree,
-                                       int column,
+                                       const int column,
                                        NodePlacementContext &r_ctx) const
 {
   if (!(usd_input && dest_node)) {
@@ -525,7 +529,7 @@ void USDMaterialReader::convert_usd_uv_texture(const pxr::UsdShadeShader &usd_sh
                                                bNode *dest_node,
                                                const char *dest_socket_name,
                                                bNodeTree *ntree,
-                                               int column,
+                                               const int column,
                                                NodePlacementContext &r_ctx) const
 {
   if (!usd_shader || !dest_node || !ntree || !dest_socket_name || !bmain_) {
@@ -608,7 +612,7 @@ void USDMaterialReader::convert_usd_primvar_reader_float2(const pxr::UsdShadeSha
                                                           bNode *dest_node,
                                                           const char *dest_socket_name,
                                                           bNodeTree *ntree,
-                                                          int column,
+                                                          const int column,
                                                           NodePlacementContext &r_ctx) const
 {
   if (!usd_shader || !dest_node || !ntree || !dest_socket_name || !bmain_) {
diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc b/source/blender/io/usd/intern/usd_reader_mesh.cc
index afd94cb89ee..bff159dea00 100644
--- a/source/blender/io/usd/intern/usd_reader_mesh.cc
+++ b/source/blender/io/usd/intern/usd_reader_mesh.cc
@@ -167,7 +167,7 @@ static void assign_materials(Main *bmain,
 
 }  // namespace utils
 
-static void *add_customdata_cb(Mesh *mesh, const char *name, int data_type)
+static void *add_customdata_cb(Mesh *mesh, const char *name, const int data_type)
 {
   CustomDataType cd_data_type = static_cast<CustomDataType>(data_type);
   void *cd_ptr;
@@ -207,7 +207,7 @@ USDMeshReader::USDMeshReader(const pxr::UsdPrim &prim,
 {
 }
 
-void USDMeshReader::create_object(Main *bmain, double /* motionSampleTime */)
+void USDMeshReader::create_object(Main *bmain, const double /* motionSampleTime */)
 {
   Mesh *mesh = BKE_mesh_add(bmain, name_.c_str());
 
@@ -259,7 +259,7 @@ bool USDMeshReader::valid() const
   return static_cast<bool>(mesh_prim_);
 }
 
-bool USDMeshReader::topology_changed(Mesh *existing_mesh, double motionSampleTime)
+bool USDMeshReader::topology_changed(Mesh *existing_mesh, const double motionSampleTime)
 {
   pxr::UsdAttribute faceVertCountsAttr = mesh_prim_.GetFaceVertexCountsAttr();
   pxr::UsdAttribute faceVertIndicesAttr = mesh_prim_.GetFaceVertexIndicesAttr();
@@ -289,7 +289,9 @@ bool USDMeshReader::topology_changed(Mesh *existing_mesh, double motionSampleTim
   return false;
 }
 
-void USDMeshReader::read_mpolys(Mesh *mesh, pxr::UsdGeomMesh mesh_prim_, double motionSampleTime)
+void USDMeshReader::read_mpolys(Mesh *mesh,
+                                pxr::UsdGeomMesh mesh_prim_,
+                                const double motionSampleTime)
 {
   MPoly *mpolys = mesh->mpoly;
   MLoop *mloops = mesh->mloop;
@@ -333,8 +335,8 @@ void USDMeshReader::read_mpolys(Mesh *mesh, pxr::UsdGeomMesh mesh_prim_, double
 
 void USDMeshReader::read_uvs(Mesh *mesh,
                              pxr::UsdGeomMesh mesh_prim_,
-                             double motionSampleTime,
-                             bool load_uvs)
+                             const double motionSampleTime,
+                             const bool load_uvs)
 {
   unsigned int loop_index = 0;
   unsigned int rev_loop_index = 0;
@@ -449,7 +451,7 @@ void USDMeshReader::read_uvs(Mesh *mesh,
 
 void USDMeshReader::read_colors(Mesh *mesh,
                                 const pxr::UsdGeomMesh &mesh_prim_,
-                                double motionSampleTime)
+                                const double motionSampleTime)
 {
   if (!(mesh && mesh_prim_ &

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list