Cleanup: move public doc-strings into headers for 'io/usd'

Ref T92709
This commit is contained in:
Campbell Barton 2021-12-09 22:46:40 +11:00
parent 74e57efb2d
commit d812e46f40
Notes: blender-bot 2023-02-14 09:09:43 +01:00
Referenced by issue #93854, Relocate doc-strings into public headers
Referenced by issue #92709, Code Style: documentation at declaration or definition
8 changed files with 41 additions and 26 deletions

View File

@ -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 */,

View File

@ -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,

View File

@ -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()) {

View File

@ -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,

View File

@ -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) {

View File

@ -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;
};

View File

@ -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());

View File

@ -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);
};