Blender V4.3
usd.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2019 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
7#include <memory>
8
10
11#include "DEG_depsgraph.hh"
12
13#include "DNA_modifier_types.h"
14#include "RNA_types.hh"
15
16struct bContext;
18struct CacheReader;
19struct ListBase;
20struct Mesh;
21struct Object;
22struct ReportList;
24
25namespace blender::bke {
26struct GeometrySet;
27}
28
29namespace blender::io::usd {
30
39
40/* Enums specifying the USD material purpose,
41 * corresponding to #pxr::UsdShadeTokens 'allPurpose',
42 * 'preview', and 'render', respectively. */
48
59
69
78
90
96
106
115
117 bool export_animation = false;
120
121 bool export_meshes = true;
122 bool export_lights = true;
123 bool export_cameras = true;
124 bool export_curves = true;
125 bool export_points = true;
126 bool export_volumes = true;
127 bool export_hair = true;
128 bool export_uvmaps = true;
129 bool rename_uvmaps = true;
130 bool export_normals = true;
132 bool export_materials = true;
133
134 bool export_armatures = true;
135 bool export_shapekeys = true;
136 bool only_deform_bones = false;
137
139
140 bool use_instancing = false;
143 bool allow_unicode = false;
144
147
150 bool export_textures = false;
152 bool relative_paths = true;
153 bool use_original_paths = false;
154
155 bool triangulate_meshes = false;
158
163
166
167 char root_prim_path[1024] = ""; /* FILE_MAX */
168 char collection[MAX_IDPROP_NAME] = "";
170
174};
175
230
236 double motion_sample_time; /* USD TimeCode in frames. */
237 int read_flags; /* MOD_MESHSEQ_xxx value that is set from MeshSeqCacheModifierData.read_flag. */
238};
239
240USDMeshReadParams create_mesh_read_params(double motion_sample_time, int read_flags);
241
251bool USD_export(const bContext *C,
252 const char *filepath,
253 const USDExportParams *params,
254 bool as_background_job,
255 ReportList *reports);
256
257bool USD_import(const bContext *C,
258 const char *filepath,
259 const USDImportParams *params,
260 bool as_background_job,
261 ReportList *reports);
262
263int USD_get_version();
264
265/* USD Import and Mesh Cache interface. */
266
267/* Similar to BLI_path_abs(), but also invokes the USD asset resolver
268 * to determine the absolute path. This is necessary for resolving
269 * paths with URIs that BLI_path_abs() would otherwise alter when
270 * attempting to normalize the path. */
271void USD_path_abs(char *path, const char *basepath, bool for_import);
272
273CacheArchiveHandle *USD_create_handle(Main *bmain, const char *filepath, ListBase *object_paths);
274
276
277void USD_get_transform(CacheReader *reader, float r_mat[4][4], float time, float scale);
278
280void USD_read_geometry(CacheReader *reader,
281 const Object *ob,
282 blender::bke::GeometrySet &geometry_set,
284 const char **r_err_str);
285
287 const Object *ob,
288 const Mesh *existing_mesh,
289 double time,
290 const char **r_err_str);
291
293 CacheReader *reader,
294 Object *object,
295 const char *object_path);
296
298
300struct USDHook {
301
302 /* Identifier used for class name. */
303 char idname[64];
304 /* Identifier used as label. */
305 char name[64];
306 /* Short help/description. */
307 char description[1024]; /* #RNA_DYN_DESCR_MAX */
308
309 /* rna_ext.data points to the USDHook class PyObject. */
311};
312
313void USD_register_hook(std::unique_ptr<USDHook> hook);
318void USD_unregister_hook(USDHook *hook);
319USDHook *USD_find_hook_name(const char idname[]);
320
321}; // namespace blender::io::usd
eEvaluationMode
@ DAG_EVAL_VIEWPORT
#define MAX_IDPROP_NAME
Definition DNA_ID.h:185
@ MOD_TRIANGULATE_QUAD_SHORTEDGE
@ MOD_TRIANGULATE_NGON_BEAUTY
eIOAxis
@ IO_AXIS_Y
@ IO_AXIS_NEGATIVE_Z
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
CacheArchiveHandle * USD_create_handle(Main *, const char *filepath, ListBase *object_paths)
CacheReader * CacheReader_open_usd_object(CacheArchiveHandle *handle, CacheReader *reader, Object *object, const char *object_path)
void USD_unregister_hook(USDHook *hook)
Definition usd_hook.cc:53
@ USD_TEX_IMPORT_NONE
Definition usd.hh:65
@ USD_TEX_IMPORT_PACK
Definition usd.hh:66
@ USD_TEX_IMPORT_COPY
Definition usd.hh:67
@ USD_XFORM_OP_TRS
Definition usd.hh:92
@ USD_XFORM_OP_TOS
Definition usd.hh:93
@ USD_XFORM_OP_MAT
Definition usd.hh:94
bool USD_mesh_topology_changed(CacheReader *reader, const Object *ob, const Mesh *existing_mesh, const double time, const char **r_err_str)
USDMeshReadParams create_mesh_read_params(const double motion_sample_time, const int read_flags)
@ USD_ATTR_IMPORT_USER
Definition usd.hh:56
@ USD_ATTR_IMPORT_ALL
Definition usd.hh:57
@ USD_ATTR_IMPORT_NONE
Definition usd.hh:55
void USD_register_hook(std::unique_ptr< USDHook > hook)
Definition usd_hook.cc:42
void USD_get_transform(CacheReader *reader, float r_mat_world[4][4], float time, float scale)
void USD_read_geometry(CacheReader *reader, const Object *ob, blender::bke::GeometrySet &geometry_set, const USDMeshReadParams params, const char **r_err_str)
@ USD_MTL_PURPOSE_FULL
Definition usd.hh:46
@ USD_MTL_PURPOSE_ALL
Definition usd.hh:44
@ USD_MTL_PURPOSE_PREVIEW
Definition usd.hh:45
bool USD_import(const bContext *C, const char *filepath, const USDImportParams *params, bool as_background_job, ReportList *reports)
eUSDTexNameCollisionMode
Definition usd.hh:74
@ USD_TEX_NAME_COLLISION_USE_EXISTING
Definition usd.hh:75
@ USD_TEX_NAME_COLLISION_OVERWRITE
Definition usd.hh:76
void USD_path_abs(char *path, const char *basepath, bool for_import)
@ USD_SUBDIV_TESSELLATE
Definition usd.hh:83
@ USD_SUBDIV_BEST_MATCH
Definition usd.hh:88
@ USD_SUBDIV_IGNORE
Definition usd.hh:81
bool USD_export(const bContext *C, const char *filepath, const USDExportParams *params, bool as_background_job, ReportList *reports)
void USD_free_handle(CacheArchiveHandle *handle)
void USD_CacheReader_free(CacheReader *reader)
@ USD_TEX_EXPORT_KEEP
Definition usd.hh:111
@ USD_TEX_EXPORT_PRESERVE
Definition usd.hh:112
@ USD_TEX_EXPORT_NEW_PATH
Definition usd.hh:113
eUSDMtlNameCollisionMode
Definition usd.hh:35
@ USD_MTL_NAME_COLLISION_MAKE_UNIQUE
Definition usd.hh:36
@ USD_MTL_NAME_COLLISION_REFERENCE_EXISTING
Definition usd.hh:37
USDHook * USD_find_hook_name(const char idname[])
Definition usd_hook.cc:59
eUSDZTextureDownscaleSize
Definition usd.hh:97
@ USD_TEXTURE_SIZE_256
Definition usd.hh:100
@ USD_TEXTURE_SIZE_CUSTOM
Definition usd.hh:98
@ USD_TEXTURE_SIZE_2048
Definition usd.hh:103
@ USD_TEXTURE_SIZE_4096
Definition usd.hh:104
@ USD_TEXTURE_SIZE_KEEP
Definition usd.hh:99
@ USD_TEXTURE_SIZE_1024
Definition usd.hh:102
@ USD_TEXTURE_SIZE_512
Definition usd.hh:101
eUSDXformOpMode xform_op_mode
Definition usd.hh:162
char custom_properties_namespace[MAX_IDPROP_NAME]
Definition usd.hh:169
eUSDZTextureDownscaleSize usdz_downscale_size
Definition usd.hh:164
enum eEvaluationMode evaluation_mode
Definition usd.hh:146
eSubdivExportMode export_subdiv
Definition usd.hh:145
wmJobWorkerStatus * worker_status
Definition usd.hh:173
ExtensionRNA rna_ext
Definition usd.hh:310
char description[1024]
Definition usd.hh:307
eUSDTexImportMode import_textures_mode
Definition usd.hh:218
eUSDAttrImportMode attr_import_mode
Definition usd.hh:222
eUSDMtlNameCollisionMode mtl_name_collision_mode
Definition usd.hh:217
eUSDTexNameCollisionMode tex_name_collision_mode
Definition usd.hh:221
wmJobWorkerStatus * worker_status
Definition usd.hh:228