From d812e46f40bce18f37b192f423e61360239a295c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 9 Dec 2021 22:46:40 +1100 Subject: Cleanup: move public doc-strings into headers for 'io/usd' Ref T92709 --- source/blender/io/usd/intern/usd_reader_material.cc | 10 ---------- source/blender/io/usd/intern/usd_reader_material.h | 16 ++++++++++++++++ source/blender/io/usd/intern/usd_reader_mesh.cc | 1 - source/blender/io/usd/intern/usd_reader_mesh.h | 1 + source/blender/io/usd/intern/usd_reader_stage.cc | 10 ---------- source/blender/io/usd/intern/usd_reader_stage.h | 14 ++++++++++++++ source/blender/io/usd/intern/usd_writer_abstract.cc | 1 - source/blender/io/usd/intern/usd_writer_abstract.h | 14 ++++++++++---- 8 files changed, 41 insertions(+), 26 deletions(-) diff --git a/source/blender/io/usd/intern/usd_reader_material.cc b/source/blender/io/usd/intern/usd_reader_material.cc index 317dfd2a62b..db0c5785a68 100644 --- a/source/blender/io/usd/intern/usd_reader_material.cc +++ b/source/blender/io/usd/intern/usd_reader_material.cc @@ -298,7 +298,6 @@ Material *USDMaterialReader::add_material(const pxr::UsdShadeMaterial &usd_mater return mtl; } -/* Create the Principled BSDF shader node network. */ void USDMaterialReader::import_usd_preview(Material *mtl, const pxr::UsdShadeShader &usd_shader) const { @@ -416,7 +415,6 @@ void USDMaterialReader::set_principled_node_inputs(bNode *principled, } } -/* Convert the given USD shader input to an input on the given Blender node. */ void USDMaterialReader::set_node_input(const pxr::UsdShadeInput &usd_input, bNode *dest_node, const char *dest_socket_name, @@ -484,8 +482,6 @@ void USDMaterialReader::set_node_input(const pxr::UsdShadeInput &usd_input, } } -/* Follow the connected source of the USD input to create corresponding inputs - * for the given Blender node. */ void USDMaterialReader::follow_connection(const pxr::UsdShadeInput &usd_input, bNode *dest_node, const char *dest_socket_name, @@ -594,8 +590,6 @@ void USDMaterialReader::convert_usd_uv_texture(const pxr::UsdShadeShader &usd_sh } } -/* Load the texture image node's texture from the path given by the USD shader's - * file input value. */ void USDMaterialReader::load_tex_image(const pxr::UsdShadeShader &usd_shader, bNode *tex_image) const { @@ -653,10 +647,6 @@ void USDMaterialReader::load_tex_image(const pxr::UsdShadeShader &usd_shader, } } -/* This function creates a Blender UV Map node, under the simplifying assumption that - * UsdPrimvarReader_float2 shaders output UV coordinates. - * TODO(makowalski): investigate supporting conversion to other Blender node types - * (e.g., Attribute Nodes) if needed. */ void USDMaterialReader::convert_usd_primvar_reader_float2( const pxr::UsdShadeShader &usd_shader, const pxr::TfToken & /* usd_source_name */, diff --git a/source/blender/io/usd/intern/usd_reader_material.h b/source/blender/io/usd/intern/usd_reader_material.h index a17504bd590..fb40b4f2f6d 100644 --- a/source/blender/io/usd/intern/usd_reader_material.h +++ b/source/blender/io/usd/intern/usd_reader_material.h @@ -90,12 +90,14 @@ class USDMaterialReader { Material *add_material(const pxr::UsdShadeMaterial &usd_material) const; protected: + /** Create the Principled BSDF shader node network. */ void import_usd_preview(Material *mtl, const pxr::UsdShadeShader &usd_shader) const; void set_principled_node_inputs(bNode *principled_node, bNodeTree *ntree, const pxr::UsdShadeShader &usd_shader) const; + /** Convert the given USD shader input to an input on the given Blender node. */ void set_node_input(const pxr::UsdShadeInput &usd_input, bNode *dest_node, const char *dest_socket_name, @@ -103,6 +105,10 @@ class USDMaterialReader { int column, NodePlacementContext *r_ctx) const; + /** + * Follow the connected source of the USD input to create corresponding inputs + * for the given Blender node. + */ void follow_connection(const pxr::UsdShadeInput &usd_input, bNode *dest_node, const char *dest_socket_name, @@ -118,8 +124,18 @@ class USDMaterialReader { int column, NodePlacementContext *r_ctx) const; + /** + * Load the texture image node's texture from the path given by the USD shader's + * file input value. + */ void load_tex_image(const pxr::UsdShadeShader &usd_shader, bNode *tex_image) const; + /** + * This function creates a Blender UV Map node, under the simplifying assumption that + * UsdPrimvarReader_float2 shaders output UV coordinates. + * TODO(makowalski): investigate supporting conversion to other Blender node types + * (e.g., Attribute Nodes) if needed. + */ void convert_usd_primvar_reader_float2(const pxr::UsdShadeShader &usd_shader, const pxr::TfToken &usd_source_name, bNode *dest_node, diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc b/source/blender/io/usd/intern/usd_reader_mesh.cc index 5c8bd88e87a..3ad1d4adf18 100644 --- a/source/blender/io/usd/intern/usd_reader_mesh.cc +++ b/source/blender/io/usd/intern/usd_reader_mesh.cc @@ -589,7 +589,6 @@ void USDMeshReader::process_normals_face_varying(Mesh *mesh) MEM_freeN(lnors); } -/* Set USD uniform (per-face) normals as Blender loop normals. */ void USDMeshReader::process_normals_uniform(Mesh *mesh) { if (normals_.empty()) { diff --git a/source/blender/io/usd/intern/usd_reader_mesh.h b/source/blender/io/usd/intern/usd_reader_mesh.h index 54ad144d191..9ed73ba5a28 100644 --- a/source/blender/io/usd/intern/usd_reader_mesh.h +++ b/source/blender/io/usd/intern/usd_reader_mesh.h @@ -75,6 +75,7 @@ class USDMeshReader : public USDGeomReader { private: void process_normals_vertex_varying(Mesh *mesh); void process_normals_face_varying(Mesh *mesh); + /** Set USD uniform (per-face) normals as Blender loop normals. */ void process_normals_uniform(Mesh *mesh); void readFaceSetsSample(Main *bmain, Mesh *mesh, double motionSampleTime); void assign_facesets_to_mpoly(double motionSampleTime, diff --git a/source/blender/io/usd/intern/usd_reader_stage.cc b/source/blender/io/usd/intern/usd_reader_stage.cc index 8c4cc18a9af..9df5611bec9 100644 --- a/source/blender/io/usd/intern/usd_reader_stage.cc +++ b/source/blender/io/usd/intern/usd_reader_stage.cc @@ -110,11 +110,6 @@ USDPrimReader *USDStageReader::create_reader(const pxr::UsdPrim &prim) return nullptr; } -/* Returns true if the given prim should be included in the - * traversal based on the import options and the prim's visibility - * attribute. Note that the prim will be trivially included - * if it has no visibility attribute or if the visibility - * is inherited. */ bool USDStageReader::include_by_visibility(const pxr::UsdGeomImageable &imageable) const { if (!params_.import_visible_only) { @@ -140,11 +135,6 @@ bool USDStageReader::include_by_visibility(const pxr::UsdGeomImageable &imageabl return visibility != pxr::UsdGeomTokens->invisible; } -/* Returns true if the given prim should be included in the - * traversal based on the import options and the prim's purpose - * attribute. E.g., return false (to exclude the prim) if the prim - * represents guide geometry and the 'Import Guide' option is - * toggled off. */ bool USDStageReader::include_by_purpose(const pxr::UsdGeomImageable &imageable) const { if (params_.import_guide && params_.import_proxy && params_.import_render) { diff --git a/source/blender/io/usd/intern/usd_reader_stage.h b/source/blender/io/usd/intern/usd_reader_stage.h index ba223962c0c..df5f83067c1 100644 --- a/source/blender/io/usd/intern/usd_reader_stage.h +++ b/source/blender/io/usd/intern/usd_reader_stage.h @@ -82,8 +82,22 @@ class USDStageReader { private: USDPrimReader *collect_readers(Main *bmain, const pxr::UsdPrim &prim); + /** + * Returns true if the given prim should be included in the + * traversal based on the import options and the prim's visibility + * attribute. Note that the prim will be trivially included + * if it has no visibility attribute or if the visibility + * is inherited. + */ bool include_by_visibility(const pxr::UsdGeomImageable &imageable) const; + /** + * Returns true if the given prim should be included in the + * traversal based on the import options and the prim's purpose + * attribute. E.g., return false (to exclude the prim) if the prim + * represents guide geometry and the 'Import Guide' option is + * toggled off. + */ bool include_by_purpose(const pxr::UsdGeomImageable &imageable) const; }; diff --git a/source/blender/io/usd/intern/usd_writer_abstract.cc b/source/blender/io/usd/intern/usd_writer_abstract.cc index 5aad1d84cfe..2b5326eb4c1 100644 --- a/source/blender/io/usd/intern/usd_writer_abstract.cc +++ b/source/blender/io/usd/intern/usd_writer_abstract.cc @@ -121,7 +121,6 @@ void USDAbstractWriter::write_visibility(const HierarchyContext &context, usd_value_writer_.SetAttribute(attr_visibility, pxr::VtValue(visibility), timecode); } -/* Reference the original data instead of writing a copy. */ bool USDAbstractWriter::mark_as_instance(const HierarchyContext &context, const pxr::UsdPrim &prim) { BLI_assert(context.is_instance()); diff --git a/source/blender/io/usd/intern/usd_writer_abstract.h b/source/blender/io/usd/intern/usd_writer_abstract.h index 6f143a7e241..dd81dd47c83 100644 --- a/source/blender/io/usd/intern/usd_writer_abstract.h +++ b/source/blender/io/usd/intern/usd_writer_abstract.h @@ -52,13 +52,15 @@ class USDAbstractWriter : public AbstractHierarchyWriter { virtual void write(HierarchyContext &context) override; - /* Returns true if the data to be written is actually supported. This would, for example, allow a + /** + * Returns true if the data to be written is actually supported. This would, for example, allow a * hypothetical camera writer accept a perspective camera but reject an orthogonal one. * * Returning false from a transform writer will prevent the object and all its descendants from * being exported. Returning false from a data writer (object data, hair, or particles) will * only prevent that data from being written (and thus cause the object to be exported as an - * Empty). */ + * Empty). + */ virtual bool is_supported(const HierarchyContext *context) const; const pxr::SdfPath &usd_path() const; @@ -73,8 +75,12 @@ class USDAbstractWriter : public AbstractHierarchyWriter { const pxr::UsdTimeCode timecode, pxr::UsdGeomImageable &usd_geometry); - /* Turn `prim` into an instance referencing `context.original_export_path`. - * Return true when the instancing was successful, false otherwise. */ + /** + * Turn `prim` into an instance referencing `context.original_export_path`. + * Return true when the instancing was successful, false otherwise. + * + * Reference the original data instead of writing a copy. + */ virtual bool mark_as_instance(const HierarchyContext &context, const pxr::UsdPrim &prim); }; -- cgit v1.2.3