[Bf-blender-cvs] [537a9a7b633] usd-importer-T81257-merge: USD Import: fix comments.
makowalski
noreply at git.blender.org
Sat Jul 24 03:44:28 CEST 2021
Commit: 537a9a7b633f41eece7a0f8a7f32f462585e7d8a
Author: makowalski
Date: Fri Jul 23 15:20:06 2021 -0400
Branches: usd-importer-T81257-merge
https://developer.blender.org/rB537a9a7b633f41eece7a0f8a7f32f462585e7d8a
USD Import: fix comments.
Now using C-style comments throughout. Also,
putting unused code in #if 0 blocks. Removed
unneeded comments and other miscellaneous fixes.
===================================================================
M source/blender/io/usd/intern/usd_capi_import.cc
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_light.cc
M source/blender/io/usd/intern/usd_reader_material.cc
M source/blender/io/usd/intern/usd_reader_material.h
M source/blender/io/usd/intern/usd_reader_mesh.cc
M source/blender/io/usd/usd.h
===================================================================
diff --git a/source/blender/io/usd/intern/usd_capi_import.cc b/source/blender/io/usd/intern/usd_capi_import.cc
index bbb0922bd69..7e6259459d3 100644
--- a/source/blender/io/usd/intern/usd_capi_import.cc
+++ b/source/blender/io/usd/intern/usd_capi_import.cc
@@ -101,18 +101,17 @@ static bool gather_objects_paths(const pxr::UsdPrim &object, ListBase *object_pa
return true;
}
-// Update the given import settings with the global rotation matrix to orient
-// imported objects with Z-up, if necessary
+/* Update the given import settings with the global rotation matrix to orient
+ * imported objects with Z-up, if necessary */
static void convert_to_z_up(pxr::UsdStageRefPtr stage, ImportSettings &r_settings)
{
if (!stage || pxr::UsdGeomGetStageUpAxis(stage) == pxr::UsdGeomTokens->z) {
- // Nothing to do.
return;
}
r_settings.do_convert_mat = true;
- // Rotate 90 degrees about the X-axis.
+ /* Rotate 90 degrees about the X-axis. */
float rmat[3][3];
float axis[3] = {1.0f, 0.0f, 0.0f};
axis_angle_normalized_to_mat3(rmat, axis, M_PI / 2.0f);
@@ -157,7 +156,6 @@ static void import_startjob(void *customdata, short *stop, short *do_update, flo
data->was_canceled = false;
data->archive = nullptr;
- // G.is_rendering = true;
WM_set_locked_interface(data->wm, true);
G.is_break = false;
@@ -215,7 +213,7 @@ static void import_startjob(void *customdata, short *stop, short *do_update, flo
convert_to_z_up(stage, data->settings);
- // Set up the stage for animated data.
+ /* Set up the stage for animated data. */
if (data->params.set_frame_range) {
data->scene->r.sfra = stage->GetStartTimeCode();
data->scene->r.efra = stage->GetEndTimeCode();
diff --git a/source/blender/io/usd/intern/usd_reader_camera.cc b/source/blender/io/usd/intern/usd_reader_camera.cc
index 8606d64c95e..185828a4f40 100644
--- a/source/blender/io/usd/intern/usd_reader_camera.cc
+++ b/source/blender/io/usd/intern/usd_reader_camera.cc
@@ -67,16 +67,18 @@ void USDCameraReader::read_object_data(Main *bmain, const double motionSampleTim
cam_prim.GetHorizontalApertureAttr().Get(&horAp, motionSampleTime);
bcam->lens = val.Get<float>();
- // TODO(makowalski)
- // bcam->sensor_x = 0.0f;
- // bcam->sensor_y = 0.0f;
+ /* TODO(makowalski) */
+#if 0
+ bcam->sensor_x = 0.0f;
+ bcam->sensor_y = 0.0f;
+#endif
bcam->shiftx = verApOffset.Get<float>();
bcam->shifty = horApOffset.Get<float>();
bcam->type = (projectionVal.Get<pxr::TfToken>().GetString() == "perspective") ? CAM_PERSP :
CAM_ORTHO;
- // Calling UncheckedGet() to silence compiler warnings.
+ /* Calling UncheckedGet() to silence compiler warnings. */
bcam->clip_start = max_ff(0.1f, clippingRangeVal.UncheckedGet<pxr::GfVec2f>()[0]);
bcam->clip_end = clippingRangeVal.UncheckedGet<pxr::GfVec2f>()[1];
diff --git a/source/blender/io/usd/intern/usd_reader_curve.cc b/source/blender/io/usd/intern/usd_reader_curve.cc
index c84b768bd36..2fd6efc4bb1 100644
--- a/source/blender/io/usd/intern/usd_reader_curve.cc
+++ b/source/blender/io/usd/intern/usd_reader_curve.cc
@@ -101,7 +101,7 @@ void USDCurvesReader::read_curve_sample(Curve *cu, const double motionSampleTime
/* If normals, extrude, else bevel.
* Perhaps to be replaced by Blender/USD Schema. */
if (!usdNormals.empty()) {
- // Set extrusion to 1.0f.
+ /* Set extrusion to 1.0f. */
curve_->ext1 = 1.0f;
}
else {
diff --git a/source/blender/io/usd/intern/usd_reader_light.cc b/source/blender/io/usd/intern/usd_reader_light.cc
index f609682191f..1812a1c229c 100644
--- a/source/blender/io/usd/intern/usd_reader_light.cc
+++ b/source/blender/io/usd/intern/usd_reader_light.cc
@@ -54,12 +54,12 @@ void USDLightReader::read_object_data(Main *bmain, const double motionSampleTime
pxr::UsdLuxShapingAPI shapingAPI(light_prim);
- // Set light type
+ /* Set light type. */
if (prim_.IsA<pxr::UsdLuxDiskLight>()) {
blight->type = LA_AREA;
blight->area_shape = LA_AREA_DISK;
- // Ellipse lights are not currently supported
+ /* Ellipse lights are not currently supported */
}
else if (prim_.IsA<pxr::UsdLuxRectLight>()) {
blight->type = LA_AREA;
@@ -76,20 +76,24 @@ void USDLightReader::read_object_data(Main *bmain, const double motionSampleTime
blight->type = LA_SUN;
}
- // Set light values
+ /* Set light values. */
pxr::VtValue intensity;
light_prim.GetIntensityAttr().Get(&intensity, motionSampleTime);
blight->energy = intensity.Get<float>() * this->import_params_.light_intensity_scale;
- // TODO: Not currently supported
- // pxr::VtValue exposure;
- // light_prim.GetExposureAttr().Get(&exposure, motionSampleTime);
+ /* TODO(makowalsk): Not currently supported. */
+#if 0
+ pxr::VtValue exposure;
+ light_prim.GetExposureAttr().Get(&exposure, motionSampleTime);
+#endif
- // TODO: Not currently supported
- // pxr::VtValue diffuse;
- // light_prim.GetDiffuseAttr().Get(&diffuse, motionSampleTime);
+ /* TODO(makowalsk): Not currently supported */
+#if 0
+ pxr::VtValue diffuse;
+ light_prim.GetDiffuseAttr().Get(&diffuse, motionSampleTime);
+#endif
pxr::VtValue specular;
light_prim.GetSpecularAttr().Get(&specular, motionSampleTime);
@@ -97,19 +101,23 @@ void USDLightReader::read_object_data(Main *bmain, const double motionSampleTime
pxr::VtValue color;
light_prim.GetColorAttr().Get(&color, motionSampleTime);
- // Calling UncheckedGet() to silence compiler warning.
+ /* Calling UncheckedGet() to silence compiler warning. */
pxr::GfVec3f color_vec = color.UncheckedGet<pxr::GfVec3f>();
blight->r = color_vec[0];
blight->g = color_vec[1];
blight->b = color_vec[2];
- // TODO: Not currently supported
- // pxr::VtValue use_color_temp;
- // light_prim.GetEnableColorTemperatureAttr().Get(&use_color_temp, motionSampleTime);
-
- // TODO: Not currently supported
- // pxr::VtValue color_temp;
- // light_prim.GetColorTemperatureAttr().Get(&color_temp, motionSampleTime);
+ /* TODO(makowalski): Not currently supported. */
+#if 0
+ pxr::VtValue use_color_temp;
+ light_prim.GetEnableColorTemperatureAttr().Get(&use_color_temp, motionSampleTime);
+#endif
+
+ /* TODO(makowalski): Not currently supported. */
+#if 0
+ pxr::VtValue color_temp;
+ light_prim.GetColorTemperatureAttr().Get(&color_temp, motionSampleTime);
+#endif
switch (blight->type) {
case LA_AREA:
diff --git a/source/blender/io/usd/intern/usd_reader_material.cc b/source/blender/io/usd/intern/usd_reader_material.cc
index a99e65f5792..e3a4acde354 100644
--- a/source/blender/io/usd/intern/usd_reader_material.cc
+++ b/source/blender/io/usd/intern/usd_reader_material.cc
@@ -38,7 +38,7 @@
namespace usdtokens {
-// Parameter names
+/* Parameter names. */
static const pxr::TfToken a("a", pxr::TfToken::Immortal);
static const pxr::TfToken b("b", pxr::TfToken::Immortal);
static const pxr::TfToken clearcoat("clearcoat", pxr::TfToken::Immortal);
@@ -63,11 +63,11 @@ static const pxr::TfToken specularColor("specularColor", pxr::TfToken::Immortal)
static const pxr::TfToken st("st", pxr::TfToken::Immortal);
static const pxr::TfToken varname("varname", pxr::TfToken::Immortal);
-// Color space names
+/* Color space names. */
static const pxr::TfToken raw("raw", pxr::TfToken::Immortal);
static const pxr::TfToken RAW("RAW", pxr::TfToken::Immortal);
-// USD shader names.
+/* USD shader names. */
static const pxr::TfToken UsdPreviewSurface("UsdPreviewSurface", pxr::TfToken::Immortal);
static const pxr::TfToken UsdPrimvarReader_float2("UsdPrimvarReader_float2",
pxr::TfToken::Immortal);
@@ -109,9 +109,9 @@ static void link_nodes(
nodeAddLink(ntree, source, source_socket, dest, dest_socket);
}
-// Returns true if the given shader may have opacity < 1.0, based
-// on heuristics. Also returns the shader's opacityThreshold input
-// in r_opacity_threshold, if this input has an authored value.
+/* Returns true if the given shader may have opacity < 1.0, based
+ * on heuristics. Also returns the shader's opacityThreshold input
+ * in r_opacity_threshold, if this input has an authored value. */
static bool needs_blend(const pxr::UsdShadeShader &usd_shader, float &r_opacity_threshold)
{
if (!usd_shader) {
@@ -229,9 +229,9 @@ namespace blender::io::usd {
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.
+/* 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(const int column, float &r_locx, float &r_locy, NodePlacementContext &r_ctx)
{
r_locx = r_ctx.origx - column * r_ctx.horizontal_step;
@@ -242,12 +242,12 @@ void compute_node_loc(const int column, float &r_locx, float &r_locy, NodePlacem
r_locy = r_ctx.origy - r_ctx.column_offsets[column];
- // Record the y-offset of the occupied region in
- // the column, including padding.
+ /* Record the y-offset of the occupied region in
+ * the column, including padding. */
r_ctx.column_offsets[column] += r_ctx.vertical_step + 10.0f;
}
-} // namespace
+} // End anonymous namespace.
USDMaterialReader::USDMaterialReader(const USDImportParams ¶ms, Main *bmain)
: params_(params), bmain_(bmain)
@@ -508,20 +508,20 @@ void USDMaterialReader::follow_connection(const pxr::UsdShadeInput &usd_input,
if (strcmp(dest_socket_name, "Normal") == 0) {
- // The normal texture input requires creating a normal map node.
+ /* The normal texture input requires creating a normal map node. */
float locx = 0.0f;
float locy = 0.0f;
compute_node_loc(column + 1, locx, locy, r_ctx);
bNode *normal_map = add_node(nullptr, ntree, SH_NODE_NORMAL_MAP, locx, locy);
- // Currently, the Normal Map node has Tangent Space a
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list