|
Blender V4.3
|
#include "usd_reader_material.hh"#include "usd_asset_utils.hh"#include "usd_reader_utils.hh"#include "usd_utils.hh"#include "BKE_appdir.hh"#include "BKE_image.hh"#include "BKE_lib_id.hh"#include "BKE_main.hh"#include "BKE_material.h"#include "BKE_node.hh"#include "BKE_node_tree_update.hh"#include "BKE_report.hh"#include "BLI_fileops.h"#include "BLI_map.hh"#include "BLI_math_vector.h"#include "BLI_path_utils.hh"#include "BLI_string.h"#include "BLI_string_utils.hh"#include "BLI_vector.hh"#include "DNA_material_types.h"#include <pxr/base/gf/vec3f.h>#include <pxr/usd/ar/packageUtils.h>#include <pxr/usd/usdShade/material.h>#include <pxr/usd/usdShade/shader.h>#include "CLG_log.h"Go to the source code of this file.
Classes | |
| struct | blender::io::usd::IntermediateNode |
Namespaces | |
| namespace | usdtokens |
| namespace | blender |
| namespace | blender::io |
| namespace | blender::io::usd |
Functions | |
| static const pxr::TfToken | usdtokens::a ("a", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::b ("b", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::bias ("bias", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::clearcoat ("clearcoat", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::clearcoatRoughness ("clearcoatRoughness", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::diffuseColor ("diffuseColor", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::emissiveColor ("emissiveColor", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::file ("file", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::g ("g", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::ior ("ior", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::in ("in", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::metallic ("metallic", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::normal ("normal", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::occlusion ("occlusion", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::opacity ("opacity", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::opacityThreshold ("opacityThreshold", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::r ("r", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::result ("result", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::rgb ("rgb", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::rgba ("rgba", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::roughness ("roughness", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::scale ("scale", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::sourceColorSpace ("sourceColorSpace", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::specularColor ("specularColor", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::st ("st", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::varname ("varname", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::auto_ ("auto", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::sRGB ("sRGB", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::raw ("raw", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::RAW ("RAW", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::black ("black", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::clamp ("clamp", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::repeat ("repeat", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::mirror ("mirror", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::wrapS ("wrapS", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::wrapT ("wrapT", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::rotation ("rotation", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::translation ("translation", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::UsdPreviewSurface ("UsdPreviewSurface", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::UsdPrimvarReader_float2 ("UsdPrimvarReader_float2", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::UsdUVTexture ("UsdUVTexture", pxr::TfToken::Immortal) |
| static const pxr::TfToken | usdtokens::UsdTransform2d ("UsdTransform2d", pxr::TfToken::Immortal) |
| static std::string | get_key (const pxr::UsdShadeShader &usd_shader, const char *tag) |
| static bNode * | get_cached_node (const ShaderToNodeMap &node_cache, const pxr::UsdShadeShader &usd_shader, const char *tag=nullptr) |
| static void | cache_node (ShaderToNodeMap &node_cache, const pxr::UsdShadeShader &usd_shader, bNode *node, const char *tag=nullptr) |
| static bNode * | add_node (const bContext *C, bNodeTree *ntree, const int type, const float locx, const float locy) |
| static void | link_nodes (bNodeTree *ntree, bNode *source, const char *sock_out, bNode *dest, const char *sock_in) |
| static pxr::SdfLayerHandle | get_layer_handle (const pxr::UsdAttribute &attribute) |
| static blender::Vector< int > | get_udim_tiles (const std::string &file_path) |
| static void | add_udim_tiles (Image *image, const blender::Vector< int > &indices) |
| static bool | needs_blend (const pxr::UsdShadeShader &usd_shader) |
| static float | get_opacity_threshold (const pxr::UsdShadeShader &usd_shader, float default_value=0.0f) |
| static pxr::TfToken | get_source_color_space (const pxr::UsdShadeShader &usd_shader) |
| static int | get_image_extension (const pxr::UsdShadeShader &usd_shader, const int default_value) |
| static bool | get_usd_preview_surface (const pxr::UsdShadeMaterial &usd_material, pxr::UsdShadeShader &r_preview_surface) |
| static void | set_viewport_material_props (Material *mtl, const pxr::UsdShadeShader &usd_preview) |
| static pxr::UsdShadeInput | get_input (const pxr::UsdShadeShader &usd_shader, const pxr::TfToken &input_name) |
| static bNodeSocket * | get_input_socket (bNode *node, const char *identifier, ReportList *reports) |
| static IntermediateNode | blender::io::usd::add_normal_map (bNodeTree *ntree, int column, NodePlacementContext *r_ctx) |
| static IntermediateNode | blender::io::usd::add_scale_bias (const pxr::UsdShadeShader &usd_shader, bNodeTree *ntree, int column, bool feeds_normal_map, NodePlacementContext *r_ctx) |
| static IntermediateNode | blender::io::usd::add_scale_bias_adjust (bNodeTree *ntree, int column, NodePlacementContext *r_ctx) |
| static IntermediateNode | blender::io::usd::add_separate_color (const pxr::UsdShadeShader &usd_shader, const pxr::TfToken &usd_source_name, bNodeTree *ntree, int column, NodePlacementContext *r_ctx) |
| static IntermediateNode | blender::io::usd::add_lessthan (bNodeTree *ntree, float threshold, int column, NodePlacementContext *r_ctx) |
| static IntermediateNode | blender::io::usd::add_oneminus (bNodeTree *ntree, int column, NodePlacementContext *r_ctx) |
| void | blender::io::usd::build_material_map (const Main *bmain, blender::Map< std::string, Material * > *r_mat_map) |
| Material * | blender::io::usd::find_existing_material (const pxr::SdfPath &usd_mat_path, const USDImportParams ¶ms, const blender::Map< std::string, Material * > &mat_map, const blender::Map< std::string, std::string > &usd_path_to_mat_name) |
Variables | |
| static CLG_LogRef | LOG = {"io.usd"} |
|
static |
Definition at line 132 of file usd_reader_material.cc.
References bNode::locx, bNode::locy, and blender::bke::node_add_static_node().
Referenced by blender::io::usd::add_lessthan(), blender::io::usd::add_normal_map(), blender::io::usd::add_oneminus(), blender::io::usd::add_scale_bias(), blender::io::usd::add_scale_bias_adjust(), blender::io::usd::add_separate_color(), blender::io::usd::USDMaterialReader::convert_usd_primvar_reader_float2(), blender::io::usd::USDMaterialReader::convert_usd_transform_2d(), blender::io::usd::USDMaterialReader::convert_usd_uv_texture(), do_versions_material_convert_legacy_blend_mode(), blender::io::usd::USDMaterialReader::import_usd_preview(), and versioning_replace_musgrave_texture_node().
|
static |
Definition at line 207 of file usd_reader_material.cc.
References BKE_image_add_tile(), IMA_SRC_TILED, and indices.
Referenced by blender::io::usd::USDMaterialReader::load_tex_image().
|
static |
Definition at line 123 of file usd_reader_material.cc.
References get_key().
Referenced by blender::io::usd::add_scale_bias(), blender::io::usd::add_separate_color(), blender::io::usd::USDMaterialReader::convert_usd_primvar_reader_float2(), blender::io::usd::USDMaterialReader::convert_usd_transform_2d(), blender::io::usd::USDMaterialReader::convert_usd_uv_texture(), and gpencil_traverse_update_cache_ex().
|
static |
Definition at line 114 of file usd_reader_material.cc.
References get_key().
Referenced by blender::io::usd::add_scale_bias(), blender::io::usd::add_separate_color(), blender::io::usd::USDMaterialReader::convert_usd_primvar_reader_float2(), blender::io::usd::USDMaterialReader::convert_usd_transform_2d(), and blender::io::usd::USDMaterialReader::convert_usd_uv_texture().
|
static |
Definition at line 288 of file usd_reader_material.cc.
References usdtokens::black(), usdtokens::clamp(), usdtokens::mirror(), usdtokens::repeat(), SHD_IMAGE_EXTENSION_CLIP, SHD_IMAGE_EXTENSION_EXTEND, SHD_IMAGE_EXTENSION_MIRROR, SHD_IMAGE_EXTENSION_REPEAT, usdtokens::wrapS(), and usdtokens::wrapT().
Referenced by blender::io::usd::USDMaterialReader::load_tex_image().
|
static |
Definition at line 387 of file usd_reader_material.cc.
Referenced by blender::io::usd::USDMaterialReader::convert_usd_transform_2d(), blender::nodes::node_composite_composite_cc::CompositeOperation::execute_copy_cpu(), blender::nodes::node_composite_viewer_cc::ViewerOperation::execute_copy_cpu(), blender::nodes::node_composite_composite_cc::CompositeOperation::execute_copy_gpu(), blender::nodes::node_composite_viewer_cc::ViewerOperation::execute_copy_gpu(), blender::nodes::node_composite_glare_cc::GlareOperation::execute_mix(), blender::nodes::node_composite_composite_cc::CompositeOperation::execute_set_alpha_cpu(), blender::nodes::node_composite_viewer_cc::ViewerOperation::execute_set_alpha_cpu(), blender::nodes::node_composite_composite_cc::CompositeOperation::execute_set_alpha_gpu(), and blender::nodes::node_composite_viewer_cc::ViewerOperation::execute_set_alpha_gpu().
|
static |
Definition at line 408 of file usd_reader_material.cc.
References BKE_reportf(), blender::bke::node_find_socket(), RPT_ERROR, and SOCK_IN.
Referenced by blender::io::usd::USDMaterialReader::convert_usd_transform_2d().
|
static |
Generate a key for caching a Blender node created for a given USD shader by returning the shader prim path with an optional tag suffix. The tag can be specified in order to generate a unique key when more than one Blender node is created for the USD shader.
Definition at line 101 of file usd_reader_material.cc.
Referenced by cache_node(), and get_cached_node().
|
static |
Definition at line 168 of file usd_reader_material.cc.
Referenced by blender::io::usd::USDMaterialReader::load_tex_image().
|
static |
Definition at line 245 of file usd_reader_material.cc.
References usdtokens::opacityThreshold().
Referenced by blender::io::usd::USDMaterialReader::set_principled_node_inputs().
|
static |
Definition at line 268 of file usd_reader_material.cc.
References usdtokens::sourceColorSpace().
Referenced by blender::io::usd::USDMaterialReader::load_tex_image().
|
static |
Definition at line 183 of file usd_reader_material.cc.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), BKE_image_get_tile_info(), BLI_freelistN(), FILE_MAX, LISTBASE_FOREACH, POINTER_AS_INT, STRNCPY, tile, and tiles.
Referenced by blender::io::usd::USDMaterialReader::load_tex_image().
|
static |
Definition at line 329 of file usd_reader_material.cc.
References usdtokens::UsdPreviewSurface().
Referenced by blender::io::usd::USDMaterialReader::add_material().
|
static |
Definition at line 146 of file usd_reader_material.cc.
References CLOG_ERROR, LOG, blender::bke::node_add_link(), blender::bke::node_find_socket(), SOCK_IN, and SOCK_OUT.
Referenced by blender::io::usd::USDMaterialReader::convert_usd_primvar_reader_float2(), blender::io::usd::USDMaterialReader::convert_usd_transform_2d(), blender::io::usd::USDMaterialReader::convert_usd_uv_texture(), blender::io::usd::USDMaterialReader::follow_connection(), and blender::io::usd::USDMaterialReader::import_usd_preview().
|
static |
Definition at line 218 of file usd_reader_material.cc.
References needs_blend(), and usdtokens::opacity().
Referenced by blender::io::usd::USDMaterialReader::import_usd_preview(), and needs_blend().
|
static |
Definition at line 350 of file usd_reader_material.cc.
References Material::b, usdtokens::diffuseColor(), Material::g, Material::metallic, usdtokens::metallic(), Material::r, Material::roughness, and usdtokens::roughness().
Referenced by blender::io::usd::USDMaterialReader::add_material().
|
static |
Definition at line 35 of file usd_reader_material.cc.
Referenced by link_nodes().