51 "Use Render settings for object visibility, modifier settings, etc"},
56 "Use Viewport settings for object visibility, modifier settings, etc"},
65 "Import each USD material as a unique Blender material"},
70 "If a material with the same name already exists, reference that instead of importing"},
76 enum { AS_BACKGROUND_JOB = 1 };
77 typedef struct eUSDOperatorOptions {
78 bool as_background_job;
79 } eUSDOperatorOptions;
83 eUSDOperatorOptions *
options =
MEM_callocN(
sizeof(eUSDOperatorOptions),
"eUSDOperatorOptions");
84 options->as_background_job =
true;
92 if (main_blendfile_path[0] ==
'\0') {
93 BLI_strncpy(filepath,
"untitled",
sizeof(filepath));
96 BLI_strncpy(filepath, main_blendfile_path,
sizeof(filepath));
132 const bool generate_preview_surface =
RNA_boolean_get(op->
ptr,
"generate_preview_surface");
228 ot->
exec = wm_usd_export_exec;
230 ot->
ui = wm_usd_export_draw;
231 ot->
check = wm_usd_export_check;
247 "selected_objects_only",
250 "Only export selected objects. Unselected parents of selected objects are "
251 "exported as empty transform");
254 "visible_objects_only",
257 "Only export visible objects. Invisible parents of exported objects are "
258 "exported as empty transforms");
265 "Export all frames in the render frame range, rather than only the current frame");
267 ot->
srna,
"export_hair",
false,
"Hair",
"Export hair particle systems as USD curves");
269 ot->
srna,
"export_uvmaps",
true,
"UV Maps",
"Include all mesh UV maps in the export");
274 "Include normals of exported meshes in the export");
279 "Export viewport settings of materials as USD preview materials, and export "
280 "material assignments as geometry subsets");
286 "Export instanced objects as references in USD rather than real objects");
290 rna_enum_usd_export_evaluation_mode_items,
293 "Determines visibility of objects, modifier settings, and other areas where there "
294 "are different settings for viewport and rendering");
297 "generate_preview_surface",
299 "To USD Preview Surface",
300 "Generate an approximate USD Preview Surface shader "
301 "representation of a Principled BSDF node network");
307 "If exporting materials, export textures referenced by material nodes "
308 "to a 'textures' directory in the same directory as the USD file");
311 "overwrite_textures",
313 "Overwrite Textures",
314 "Allow overwriting existing texture files when exporting textures");
320 "Use relative paths to reference external files (i.e. textures, volumes) in "
321 "USD, otherwise use absolute paths");
328 eUSDOperatorOptions *
options =
MEM_callocN(
sizeof(eUSDOperatorOptions),
"eUSDOperatorOptions");
329 options->as_background_job =
true;
360 if (read_mesh_colors) {
373 const bool import_instance_proxies =
RNA_boolean_get(op->
ptr,
"import_instance_proxies");
379 char *prim_path_mask = malloc(1024);
389 const float light_intensity_scale =
RNA_float_get(op->
ptr,
"light_intensity_scale");
392 "mtl_name_collision_mode");
395 const bool is_sequence =
false;
397 int sequence_len = 1;
405 const bool validate_meshes =
false;
406 const bool use_instancing =
false;
494 ot->
exec = wm_usd_import_exec;
496 ot->
ui = wm_usd_import_draw;
518 "Value by which to enlarge or shrink the objects with respect to the world's origin",
526 "Update the scene's start and end frame to match those of the USD archive");
538 "Import Subdivision Scheme",
539 "Create subdivision surface modifiers based on the USD "
540 "SubdivisionScheme attribute");
543 "import_instance_proxies",
545 "Import Instance Proxies",
546 "Create unique Blender objects for USD instances");
549 "import_visible_only",
551 "Visible Primitives Only",
552 "Do not import invisible USD primitives. "
553 "Only applies to primitives with a non-animated visibility attribute. "
554 "Primitives with animated visibility will always be imported");
560 "Add all imported objects to a new collection");
565 ot->
srna,
"read_mesh_colors",
false,
"Color Attributes",
"Read mesh color attributes");
572 "Import only the subset of the USD scene rooted at the given primitive");
581 "import_usd_preview",
583 "Import USD Preview",
584 "Convert UsdPreviewSurface shaders to Principled BSDF shader networks");
587 "set_material_blend",
589 "Set Material Blend",
590 "If the Import USD Preview option is enabled, "
591 "the material blend method will automatically be set based on the "
592 "shader's opacity and opacityThreshold inputs");
595 "light_intensity_scale",
599 "Light Intensity Scale",
600 "Scale for the intensity of imported lights",
606 "mtl_name_collision_mode",
607 rna_enum_usd_mtl_name_collision_mode_items,
609 "Material Name Collision",
610 "Behavior when the name of an imported material conflicts with an existing material");
struct Object * CTX_data_edit_object(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
const char * BKE_main_blendfile_path(const struct Main *bmain) ATTR_NONNULL()
void BKE_report(ReportList *reports, eReportType type, const char *message)
bool BLI_path_extension_ensure(char *path, size_t maxlen, const char *ext) ATTR_NONNULL()
bool BLI_path_extension_replace(char *path, size_t maxlen, const char *ext) ATTR_NONNULL()
bool BLI_path_extension_check_n(const char *str,...) ATTR_NONNULL(1) ATTR_SENTINEL(0)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
bool ED_object_mode_set(struct bContext *C, eObjectMode mode)
Read Guarded memory(de)allocation.
void uiLayoutSetActive(uiLayout *layout, bool active)
uiLayout * uiLayoutColumnWithHeading(uiLayout *layout, bool align, const char *heading)
void uiLayoutSetEnabled(uiLayout *layout, bool enabled)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiItemL(uiLayout *layout, const char *name, int icon)
uiLayout * uiLayoutBox(uiLayout *layout)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
CCL_NAMESPACE_BEGIN struct Options options
void WM_OT_usd_import(struct wmOperatorType *ot)
void WM_OT_usd_export(struct wmOperatorType *ot)
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
void *(* MEM_callocN)(size_t len, const char *str)
static const pxr::TfToken preview("preview", pxr::TfToken::Immortal)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
bool RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, bool use_ghost)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
float RNA_float_get(PointerRNA *ptr, const char *name)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
enum eEvaluationMode evaluation_mode
bool selected_objects_only
bool visible_objects_only
bool generate_preview_surface
float light_intensity_scale
bool import_instance_proxies
eUSDMtlNameCollisionMode mtl_name_collision_mode
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
void(* ui)(struct bContext *, struct wmOperator *)
bool(* check)(struct bContext *, struct wmOperator *)
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
@ USD_MTL_NAME_COLLISION_REFERENCE_EXISTING
@ USD_MTL_NAME_COLLISION_MAKE_UNIQUE
bool USD_export(bContext *C, const char *filepath, const USDExportParams *params, bool as_background_job)
bool USD_import(struct bContext *C, const char *filepath, const USDImportParams *params, bool as_background_job)
void WM_event_add_fileselect(bContext *C, wmOperator *op)
void WM_operator_properties_filesel(wmOperatorType *ot, const int filter, const short type, const eFileSel_Action action, const eFileSel_Flag flag, const short display, const short sort)
bool WM_operator_winactive(bContext *C)
int WM_operator_filesel(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))