Blender V5.0
blender::io::usd::USDMaterialReader Class Reference

#include <usd_reader_material.hh>

Public Member Functions

 USDMaterialReader (const USDImportParams &params, Main &bmain)
Materialadd_material (const pxr::UsdShadeMaterial &usd_material, bool read_usd_preview=true) const
void import_usd_preview (Material *mtl, const pxr::UsdShadeMaterial &usd_material) const
ReportListreports () const

Protected Member Functions

void import_usd_preview_nodes (Material *mtl, const pxr::UsdShadeMaterial &usd_material, const pxr::UsdShadeShader &usd_shader) const
void set_principled_node_inputs (bNode *principled_node, bNodeTree *ntree, const pxr::UsdShadeShader &usd_shader) const
bool set_displacement_node_inputs (bNodeTree *ntree, bNode *output, const pxr::UsdShadeShader &usd_shader) const
bool set_node_input (const pxr::UsdShadeInput &usd_input, bNode *dest_node, const StringRefNull dest_socket_name, bNodeTree *ntree, int column, NodePlacementContext &ctx, const ExtraLinkInfo &extra={}) const
bool follow_connection (const pxr::UsdShadeInput &usd_input, bNode *dest_node, const StringRefNull dest_socket_name, bNodeTree *ntree, int column, NodePlacementContext &ctx, const ExtraLinkInfo &extra={}) const
void convert_usd_uv_texture (const pxr::UsdShadeShader &usd_shader, const pxr::TfToken &usd_source_name, bNode *dest_node, const StringRefNull dest_socket_name, bNodeTree *ntree, int column, NodePlacementContext &ctx, const ExtraLinkInfo &extra={}) const
void convert_usd_transform_2d (const pxr::UsdShadeShader &usd_shader, bNode *dest_node, const StringRefNull dest_socket_name, bNodeTree *ntree, int column, NodePlacementContext &ctx) const
void load_tex_image (const pxr::UsdShadeShader &usd_shader, bNode *tex_image, const ExtraLinkInfo &extra={}) const
void convert_usd_primvar_reader_float2 (const pxr::UsdShadeShader &usd_shader, const pxr::TfToken &usd_source_name, bNode *dest_node, const StringRefNull dest_socket_name, bNodeTree *ntree, int column, NodePlacementContext &ctx) const
void convert_usd_primvar_reader_generic (const pxr::UsdShadeShader &usd_shader, StringRef output_type, bNode *dest_node, const StringRefNull dest_socket_name, bNodeTree *ntree, int column, NodePlacementContext &ctx) const

Detailed Description

By default, the USDMaterialReader creates a Blender material with the same name as the USD material. If the USD material has a #UsdPreviewSurface source, the Blender material's viewport display color, roughness and metallic properties are set to the corresponding #UsdPreoviewSurface inputs.

If the Import USD Preview option is enabled, the current implementation converts #UsdPreviewSurface to Blender nodes as follows:

  • #UsdPreviewSurface -> Principled BSDF
  • #UsdUVTexture -> Texture Image + Normal Map
  • UsdPrimvarReader_float2 -> UV Map

Limitations: arbitrary primvar readers or UsdTransform2d not yet supported. For #UsdUVTexture, only the file, st and #sourceColorSpace inputs are handled.

TODO(makowalski): Investigate adding support for converting additional shaders and inputs. Supporting certain types of inputs, such as texture scale and bias, will probably require creating Blender Group nodes with the corresponding inputs.

Definition at line 112 of file usd_reader_material.hh.

Constructor & Destructor Documentation

◆ USDMaterialReader()

blender::io::usd::USDMaterialReader::USDMaterialReader ( const USDImportParams & params,
Main & bmain )

Definition at line 455 of file usd_reader_material.cc.

References params.

Member Function Documentation

◆ add_material()

Material * blender::io::usd::USDMaterialReader::add_material ( const pxr::UsdShadeMaterial & usd_material,
bool read_usd_preview = true ) const

◆ convert_usd_primvar_reader_float2()

void blender::io::usd::USDMaterialReader::convert_usd_primvar_reader_float2 ( const pxr::UsdShadeShader & usd_shader,
const pxr::TfToken & usd_source_name,
bNode * dest_node,
const StringRefNull dest_socket_name,
bNodeTree * ntree,
int column,
NodePlacementContext & ctx ) const
protected

◆ convert_usd_primvar_reader_generic()

void blender::io::usd::USDMaterialReader::convert_usd_primvar_reader_generic ( const pxr::UsdShadeShader & usd_shader,
StringRef output_type,
bNode * dest_node,
const StringRefNull dest_socket_name,
bNodeTree * ntree,
int column,
NodePlacementContext & ctx ) const
protected

◆ convert_usd_transform_2d()

◆ convert_usd_uv_texture()

void blender::io::usd::USDMaterialReader::convert_usd_uv_texture ( const pxr::UsdShadeShader & usd_shader,
const pxr::TfToken & usd_source_name,
bNode * dest_node,
const StringRefNull dest_socket_name,
bNodeTree * ntree,
int column,
NodePlacementContext & ctx,
const ExtraLinkInfo & extra = {} ) const
protected

◆ follow_connection()

◆ import_usd_preview()

void blender::io::usd::USDMaterialReader::import_usd_preview ( Material * mtl,
const pxr::UsdShadeMaterial & usd_material ) const

◆ import_usd_preview_nodes()

void blender::io::usd::USDMaterialReader::import_usd_preview_nodes ( Material * mtl,
const pxr::UsdShadeMaterial & usd_material,
const pxr::UsdShadeShader & usd_shader ) const
protected

◆ load_tex_image()

◆ reports()

ReportList * blender::io::usd::USDMaterialReader::reports ( ) const
inline

Get the wmJobWorkerStatus-provided reports list pointer, to use with the BKE_report API.

Definition at line 126 of file usd_reader_material.hh.

Referenced by convert_usd_transform_2d(), and load_tex_image().

◆ set_displacement_node_inputs()

bool blender::io::usd::USDMaterialReader::set_displacement_node_inputs ( bNodeTree * ntree,
bNode * output,
const pxr::UsdShadeShader & usd_shader ) const
protected

◆ set_node_input()

bool blender::io::usd::USDMaterialReader::set_node_input ( const pxr::UsdShadeInput & usd_input,
bNode * dest_node,
const StringRefNull dest_socket_name,
bNodeTree * ntree,
int column,
NodePlacementContext & ctx,
const ExtraLinkInfo & extra = {} ) const
protected

◆ set_principled_node_inputs()


The documentation for this class was generated from the following files: