Blender  V3.3
Classes | Typedefs | Enumerations | Functions
blender::io::usd Namespace Reference

Classes

struct  ExportJobData
 
struct  ImportJobData
 
struct  USDExporterContext
 
class  USDHierarchyIterator
 
class  USDCameraReader
 
class  USDCurvesReader
 
class  USDGeomReader
 
class  USDLightReader
 
struct  NodePlacementContext
 
class  USDMaterialReader
 
class  USDMeshReader
 
class  USDNurbsReader
 
struct  ImportSettings
 
class  USDPrimReader
 
class  USDStageReader
 
class  USDVolumeReader
 
class  USDXformReader
 
class  USDAbstractWriter
 
class  USDCameraWriter
 
class  USDHairWriter
 
class  USDLightWriter
 
struct  InputSpec
 
struct  USDMeshData
 
class  USDGenericMeshWriter
 
class  USDMeshWriter
 
class  USDMetaballWriter
 
class  USDTransformWriter
 
class  USDVolumeWriter
 
class  USDImagingTest
 
class  USDStageCreationTest
 

Typedefs

typedef std::map< pxr::SdfPath, std::vector< USDPrimReader * > > ProtoReaderMap
 
using InputSpecMap = std::map< std::string, InputSpec >
 

Enumerations

enum  { USD_NO_ERROR = 0 , USD_ARCHIVE_FAIL }
 

Functions

static void report_job_duration (const ExportJobData *data)
 
static void export_startjob (void *customdata, short *stop, short *do_update, float *progress)
 
static void export_endjob (void *customdata)
 
static CacheArchiveHandlehandle_from_stage_reader (USDStageReader *reader)
 
static USDStageReaderstage_reader_from_handle (CacheArchiveHandle *handle)
 
static bool gather_objects_paths (const pxr::UsdPrim &object, ListBase *object_paths)
 
static void convert_to_z_up (pxr::UsdStageRefPtr stage, ImportSettings *r_settings)
 
static void report_job_duration (const ImportJobData *data)
 
static void import_startjob (void *customdata, short *stop, short *do_update, float *progress)
 
static void import_endjob (void *customdata)
 
static void import_freejob (void *user_data)
 
void ensure_usd_plugin_path_registered ()
 
static bool merge_with_parent (USDPrimReader *reader)
 
static void camera_sensor_size_for_render (const Camera *camera, const struct RenderData *rd, float *r_sensor_x, float *r_sensor_y)
 
static pxr::UsdShadeShader create_usd_preview_shader (const USDExporterContext &usd_export_context, pxr::UsdShadeMaterial &material, const char *name, int type)
 
static pxr::UsdShadeShader create_usd_preview_shader (const USDExporterContext &usd_export_context, pxr::UsdShadeMaterial &material, bNode *node)
 
static void create_uvmap_shader (const USDExporterContext &usd_export_context, bNode *tex_node, pxr::UsdShadeMaterial &usd_material, pxr::UsdShadeShader &usd_tex_shader, const pxr::TfToken &default_uv)
 
static void export_texture (bNode *node, const pxr::UsdStageRefPtr stage, const bool allow_overwrite=false)
 
static bNodefind_bsdf_node (Material *material)
 
static void get_absolute_path (Image *ima, char *r_path)
 
static std::string get_tex_image_asset_path (bNode *node, const pxr::UsdStageRefPtr stage, const USDExportParams &export_params)
 
static InputSpecMappreview_surface_input_map ()
 
static bNodetraverse_channel (bNodeSocket *input, short target_type)
 
template<typename T1 , typename T2 >
void create_input (pxr::UsdShadeShader &shader, const InputSpec &spec, const void *value)
 
void create_usd_preview_surface_material (const USDExporterContext &usd_export_context, Material *material, pxr::UsdShadeMaterial &usd_material, const std::string &default_uv)
 
void create_usd_viewport_material (const USDExporterContext &usd_export_context, Material *material, pxr::UsdShadeMaterial &usd_material)
 
static std::string get_in_memory_texture_filename (Image *ima)
 
static void export_in_memory_texture (Image *ima, const std::string &export_dir, const bool allow_overwrite)
 
static pxr::TfToken get_node_tex_image_color_space (bNode *node)
 
static std::string get_tex_image_asset_path (Image *ima)
 
static void copy_tiled_textures (Image *ima, const std::string &dest_dir, const bool allow_overwrite)
 
static void copy_single_file (Image *ima, const std::string &dest_dir, const bool allow_overwrite)
 
static void get_vertices (const Mesh *mesh, USDMeshData &usd_mesh_data)
 
static void get_loops_polys (const Mesh *mesh, USDMeshData &usd_mesh_data)
 
static void get_edge_creases (const Mesh *mesh, USDMeshData &usd_mesh_data)
 
static void get_vert_creases (const Mesh *mesh, USDMeshData &usd_mesh_data)
 
 TEST_F (USDImagingTest, CapsuleAdapterTest)
 
 TEST_F (USDStageCreationTest, JSONFileLoadingTest)
 
std::string register_usd_plugins_for_tests ()
 

Typedef Documentation

◆ InputSpecMap

using blender::io::usd::InputSpecMap = typedef std::map<std::string, InputSpec>

Definition at line 88 of file usd_writer_material.cc.

◆ ProtoReaderMap

Definition at line 19 of file usd_reader_stage.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
USD_NO_ERROR 
USD_ARCHIVE_FAIL 

Definition at line 112 of file usd_capi_import.cc.

Function Documentation

◆ camera_sensor_size_for_render()

static void blender::io::usd::camera_sensor_size_for_render ( const Camera camera,
const struct RenderData rd,
float r_sensor_x,
float r_sensor_y 
)
static

◆ convert_to_z_up()

static void blender::io::usd::convert_to_z_up ( pxr::UsdStageRefPtr  stage,
ImportSettings r_settings 
)
static

◆ copy_single_file()

static void blender::io::usd::copy_single_file ( Image ima,
const std::string &  dest_dir,
const bool  allow_overwrite 
)
static

◆ copy_tiled_textures()

static void blender::io::usd::copy_tiled_textures ( Image ima,
const std::string &  dest_dir,
const bool  allow_overwrite 
)
static

◆ create_input()

template<typename T1 , typename T2 >
void blender::io::usd::create_input ( pxr::UsdShadeShader &  shader,
const InputSpec spec,
const void value 
)

◆ create_usd_preview_shader() [1/2]

static pxr::UsdShadeShader blender::io::usd::create_usd_preview_shader ( const USDExporterContext usd_export_context,
pxr::UsdShadeMaterial &  material,
bNode node 
)
static

◆ create_usd_preview_shader() [2/2]

static pxr::UsdShadeShader blender::io::usd::create_usd_preview_shader ( const USDExporterContext usd_export_context,
pxr::UsdShadeMaterial &  material,
const char *  name,
int  type 
)
static

◆ create_usd_preview_surface_material()

void blender::io::usd::create_usd_preview_surface_material ( const USDExporterContext usd_export_context,
Material material,
pxr::UsdShadeMaterial &  usd_material,
const std::string &  default_uv = "" 
)

Entry point to create an approximate USD Preview Surface network from a Cycles node graph. Due to the limited nodes in the USD Preview Surface specification, only the following nodes are supported:

  • UVMap
  • Texture Coordinate
  • Image Texture
  • Principled BSDF More may be added in the future.
Parameters
default_uvused as the default UV set name sampled by the primvar reader shaders generated for image texture nodes that don't have an attached UVMap node.

Definition at line 117 of file usd_writer_material.cc.

References create_usd_preview_shader(), create_uvmap_shader(), blender::io::usd::USDExporterContext::export_params, export_texture(), USDExportParams::export_textures, find_bsdf_node(), blender::io::usd::InputSpec::input_name, blender::io::usd::InputSpec::input_type, LISTBASE_FOREACH, material, node, USDExportParams::overwrite_textures, usdtokens::preview(), usdtokens::preview_surface(), preview_surface_input_map(), blender::io::usd::InputSpec::set_default_value, SH_NODE_TEX_IMAGE, SOCK_FLOAT, SOCK_RGBA, SOCK_VECTOR, blender::io::usd::InputSpec::source_name, blender::io::usd::USDExporterContext::stage, traverse_channel(), bNode::type, and cyclestokens::UVMap().

Referenced by blender::io::usd::USDAbstractWriter::ensure_usd_material().

◆ create_usd_viewport_material()

void blender::io::usd::create_usd_viewport_material ( const USDExporterContext usd_export_context,
Material material,
pxr::UsdShadeMaterial &  usd_material 
)

◆ create_uvmap_shader()

static void blender::io::usd::create_uvmap_shader ( const USDExporterContext usd_export_context,
bNode tex_node,
pxr::UsdShadeMaterial &  usd_material,
pxr::UsdShadeShader &  usd_tex_shader,
const pxr::TfToken &  default_uv 
)
static

◆ ensure_usd_plugin_path_registered()

void blender::io::usd::ensure_usd_plugin_path_registered ( )

Definition at line 12 of file usd_common.cc.

References BKE_appdir_folder_id(), and BLENDER_DATAFILES.

Referenced by USD_create_handle(), USD_export(), and USD_import().

◆ export_endjob()

static void blender::io::usd::export_endjob ( void customdata)
static

◆ export_in_memory_texture()

static void blender::io::usd::export_in_memory_texture ( Image ima,
const std::string &  export_dir,
const bool  allow_overwrite 
)
static

◆ export_startjob()

static void blender::io::usd::export_startjob ( void customdata,
short *  stop,
short *  do_update,
float progress 
)
static

◆ export_texture()

static void blender::io::usd::export_texture ( bNode node,
const pxr::UsdStageRefPtr  stage,
const bool  allow_overwrite = false 
)
static

◆ find_bsdf_node()

static bNode * blender::io::usd::find_bsdf_node ( Material material)
static

◆ gather_objects_paths()

static bool blender::io::usd::gather_objects_paths ( const pxr::UsdPrim &  object,
ListBase object_paths 
)
static

Definition at line 70 of file usd_capi_import.cc.

References BLI_addtail(), BLI_strncpy(), MEM_callocN, and CacheObjectPath::path.

Referenced by USD_create_handle().

◆ get_absolute_path()

static void blender::io::usd::get_absolute_path ( Image ima,
char *  r_path 
)
static

◆ get_edge_creases()

static void blender::io::usd::get_edge_creases ( const Mesh mesh,
USDMeshData usd_mesh_data 
)
static

◆ get_in_memory_texture_filename()

static std::string blender::io::usd::get_in_memory_texture_filename ( Image ima)
static

◆ get_loops_polys()

static void blender::io::usd::get_loops_polys ( const Mesh mesh,
USDMeshData usd_mesh_data 
)
static

◆ get_node_tex_image_color_space()

static pxr::TfToken blender::io::usd::get_node_tex_image_color_space ( bNode node)
static

◆ get_tex_image_asset_path() [1/2]

static std::string blender::io::usd::get_tex_image_asset_path ( bNode node,
const pxr::UsdStageRefPtr  stage,
const USDExportParams export_params 
)
static

◆ get_tex_image_asset_path() [2/2]

static std::string blender::io::usd::get_tex_image_asset_path ( Image ima)
static

Definition at line 529 of file usd_writer_material.cc.

References FILE_MAX, and get_absolute_path().

◆ get_vert_creases()

static void blender::io::usd::get_vert_creases ( const Mesh mesh,
USDMeshData usd_mesh_data 
)
static

◆ get_vertices()

static void blender::io::usd::get_vertices ( const Mesh mesh,
USDMeshData usd_mesh_data 
)
static

◆ handle_from_stage_reader()

static CacheArchiveHandle* blender::io::usd::handle_from_stage_reader ( USDStageReader reader)
static

Definition at line 60 of file usd_capi_import.cc.

Referenced by USD_create_handle().

◆ import_endjob()

static void blender::io::usd::import_endjob ( void customdata)
static

◆ import_freejob()

static void blender::io::usd::import_freejob ( void user_data)
static

Definition at line 374 of file usd_capi_import.cc.

References data, and user_data.

Referenced by USD_import().

◆ import_startjob()

static void blender::io::usd::import_startjob ( void customdata,
short *  stop,
short *  do_update,
float progress 
)
static

◆ merge_with_parent()

static bool blender::io::usd::merge_with_parent ( USDPrimReader reader)
static

◆ preview_surface_input_map()

static InputSpecMap & blender::io::usd::preview_surface_input_map ( )
static

◆ register_usd_plugins_for_tests()

std::string blender::io::usd::register_usd_plugins_for_tests ( )

Definition at line 17 of file usd_tests_common.cc.

References BLI_assert, BLI_path_join(), and FILE_MAX.

Referenced by TEST_F().

◆ report_job_duration() [1/2]

static void blender::io::usd::report_job_duration ( const ExportJobData data)
static

Definition at line 49 of file usd_capi_export.cc.

References data, and blender::timeit::print_duration().

Referenced by export_endjob(), and import_endjob().

◆ report_job_duration() [2/2]

static void blender::io::usd::report_job_duration ( const ImportJobData data)
static

Definition at line 139 of file usd_capi_import.cc.

References data, and blender::timeit::print_duration().

◆ stage_reader_from_handle()

static USDStageReader* blender::io::usd::stage_reader_from_handle ( CacheArchiveHandle handle)
static

Definition at line 65 of file usd_capi_import.cc.

Referenced by CacheReader_open_usd_object(), and USD_free_handle().

◆ TEST_F() [1/2]

blender::io::usd::TEST_F ( USDImagingTest  ,
CapsuleAdapterTest   
)

Definition at line 16 of file usd_imaging_test.cc.

References register_usd_plugins_for_tests(), and stage.

◆ TEST_F() [2/2]

blender::io::usd::TEST_F ( USDStageCreationTest  ,
JSONFileLoadingTest   
)

Definition at line 22 of file usd_stage_creation_test.cc.

References register_usd_plugins_for_tests().

◆ traverse_channel()

static bNode * blender::io::usd::traverse_channel ( bNodeSocket input,
short  target_type 
)
static