65 "Use Render settings for object visibility, modifier settings, etc"},
70 "Use Viewport settings for object visibility, modifier settings, etc"},
71 {0,
nullptr, 0,
nullptr,
nullptr},
136 if (
params.frame_start == INT_MIN) {
137 params.frame_start = scene->r.sfra;
139 if (
params.frame_end == INT_MIN) {
140 params.frame_end = scene->r.efra;
187 "export_custom_properties",
189 IFACE_(
"Custom Properties"),
229 C, layout,
"ABC_export_particles",
false,
IFACE_(
"Particle Systems")))
249 ui_alembic_export_settings(C, op->
layout, op->
ptr);
268 ot->
name =
"Export Alembic";
269 ot->
description =
"Export current scene in an Alembic archive";
270 ot->
idname =
"WM_OT_alembic_export";
272 ot->
invoke = wm_alembic_export_invoke;
273 ot->
exec = wm_alembic_export_exec;
275 ot->
ui = wm_alembic_export_draw;
276 ot->
check = wm_alembic_export_check;
296 "Start frame of the export, use the default value to "
297 "take the start frame of the current scene",
307 "End frame of the export, use the default value to "
308 "take the end frame of the current scene",
318 "Number of times per frame transformations are sampled",
328 "Number of times per frame object data are sampled",
338 "Time at which the shutter is open",
348 "Time at which the shutter is closed",
353 ot->
srna,
"selected",
false,
"Selected Objects Only",
"Export only selected objects");
356 "visible_objects_only",
358 "Visible Objects Only",
359 "Export only objects that are visible");
365 "Do not preserve objects' parent/children relationship");
381 "Generated Coordinates",
382 "Export undeformed mesh vertex coordinates");
385 ot->
srna,
"face_sets",
false,
"Face Sets",
"Export per face shading group assignments");
390 "Use Subdivision Schema",
391 "Export meshes using Alembic's subdivision schema");
396 "Apply Subdivision Surface",
397 "Export subdivision surfaces as meshes");
403 "Export curves and NURBS surfaces as meshes");
409 "Export data of duplicated objects as Alembic instances; speeds up the export "
410 "and can be disabled for compatibility with other software");
419 "Value by which to enlarge or shrink the objects with respect to the world's origin",
427 "Export polygons (quads and n-gons) as triangles");
434 "Method for splitting the quads into triangles");
441 "Method for splitting the n-gons into triangles");
447 "Exports hair particle systems as animated curves");
449 ot->
srna,
"export_particles",
true,
"Export Particles",
"Exports non-hair particle systems");
452 "export_custom_properties",
454 "Export Custom Properties",
455 "Export custom properties to Alembic .userProperties");
461 "Run as Background Job",
462 "Enable this to run the import in the background, disable to block Blender while importing. "
463 "This option is deprecated; EXECUTE this operator to run in the foreground, and INVOKE it "
464 "to run as a background job");
468 rna_enum_abc_export_evaluation_mode_items,
471 "Determines visibility of objects, modifier settings, and other areas where there "
472 "are different settings for viewport and rendering");
489static int get_sequence_len(
const char *filepath,
int *ofs)
501 if (dirpath[0] ==
'\0') {
510 if (dir ==
nullptr) {
512 "Error opening directory '%s': %s\n",
514 errno ? strerror(errno) :
"unknown error");
518 const char *ext =
".abc";
520 const int len = strlen(basename) - (numdigit + strlen(ext));
525 while ((fname =
readdir(dir)) !=
nullptr) {
527 if (!strstr(fname->
d_name, ext)) {
535 CacheFrame cache_frame{};
539 frames.append(cache_frame);
544 std::sort(frames.begin(), frames.end(), [](
const CacheFrame &a,
const CacheFrame &
b) {
545 return a.framenr < b.framenr;
548 if (frames.is_empty()) {
552 int frame_curr = frames.first().framenr;
555 for (CacheFrame &cache_frame : frames) {
556 if (cache_frame.framenr != frame_curr) {
562 return frame_curr - (*ofs);
589 ui_alembic_import_settings(C, op->
layout, op->
ptr);
604 if (paths.is_empty()) {
613 const bool always_add_cache_reader =
RNA_boolean_get(op->
ptr,
"always_add_cache_reader");
616 int sequence_min_frame = std::numeric_limits<int>::max();
617 int sequence_max_frame = std::numeric_limits<int>::min();
620 for (
const std::string &path : paths) {
622 int sequence_len = get_sequence_len(path.c_str(), &offset);
623 if (sequence_len < 0) {
627 sequence_min_frame = std::min(sequence_min_frame, offset);
628 sequence_max_frame = std::max(sequence_max_frame, offset + (sequence_len - 1));
639 params.paths = std::move(paths);
640 params.global_scale = scale;
641 params.sequence_min_frame = sequence_min_frame;
642 params.sequence_max_frame = sequence_max_frame;
643 params.is_sequence = is_sequence;
645 params.validate_meshes = validate_meshes;
646 params.always_add_cache_reader = always_add_cache_reader;
655 ot->
name =
"Import Alembic";
657 ot->
idname =
"WM_OT_alembic_import";
660 ot->
invoke = wm_alembic_import_invoke;
661 ot->
exec = wm_alembic_import_exec;
663 ot->
ui = wm_alembic_import_draw;
684 "Value by which to enlarge or shrink the objects with respect to the world's origin",
693 "If checked, update scene's start and end frame to match those of the Alembic archive");
700 "Ensure the data is valid "
701 "(when disabled, data may be imported which causes crashes displaying or editing)");
704 "always_add_cache_reader",
706 "Always Add Cache Reader",
707 "Add cache modifiers and constraints to imported objects even if they are not "
708 "animated so that they can be updated when reloading the Alembic archive");
714 "Set to true if the cache is split into separate files");
720 "Run as Background Job",
721 "Enable this to run the export in the background, disable to block Blender while exporting. "
722 "This option is deprecated; EXECUTE this operator to run in the foreground, and INVOKE it "
723 "to run as a background job");
729 auto fh = std::make_unique<blender::bke::FileHandlerType>();
730 STRNCPY(fh->idname,
"IO_FH_alembic");
731 STRNCPY(fh->import_operator,
"WM_OT_alembic_import");
732 STRNCPY(fh->export_operator,
"WM_OT_alembic_export");
734 STRNCPY(fh->file_extensions_str,
".abc");
bool ABC_import(struct bContext *C, const struct AlembicImportParams *params, bool as_background_job)
bool ABC_export(struct Scene *scene, struct bContext *C, const char *filepath, const struct AlembicExportParams *params, bool as_background_job)
SpaceFile * CTX_wm_space_file(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Object * CTX_data_edit_object(const bContext *C)
const char * BKE_main_blendfile_path_from_global()
void BKE_report(ReportList *reports, eReportType type, const char *message)
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
bool BLI_path_frame_get(const char *path, int *r_frame, int *r_digits_len) ATTR_NONNULL(1
bool BLI_path_extension_check(const char *path, const char *ext) ATTR_NONNULL(1
bool BLI_path_extension_ensure(char *path, size_t path_maxncpy, const char *ext) ATTR_NONNULL(1
void void BLI_path_split_dir_part(const char *filepath, char *dir, size_t dir_maxncpy) ATTR_NONNULL(1
#define STRNCPY(dst, src)
#define STREQLEN(a, b, n)
Compatibility-like things for windows.
struct dirent * readdir(DIR *dp)
DIR * opendir(const char *path)
@ MOD_TRIANGULATE_QUAD_SHORTEDGE
@ MOD_TRIANGULATE_NGON_BEAUTY
Object is a sort of wrapper for general info.
void ED_fileselect_ensure_default_filepath(bContext *C, wmOperator *op, const char *extension)
Read Guarded memory(de)allocation.
void uiLayoutSetActive(uiLayout *layout, bool active)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiItemS(uiLayout *layout)
PanelLayout uiLayoutPanel(const bContext *C, uiLayout *layout, const char *idname, bool default_closed)
uiLayout * uiLayoutColumnWithHeading(uiLayout *layout, bool align, const char *heading)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
static void set_frame_range(ImportJobData *data)
local_group_size(16, 16) .push_constant(Type b
void WM_OT_alembic_import(wmOperatorType *ot)
void WM_OT_alembic_export(wmOperatorType *ot)
void file_handler_add(std::unique_ptr< FileHandlerType > file_handler)
void alembic_file_handler_add()
bool poll_file_object_drop(const bContext *C, blender::bke::FileHandlerType *)
Vector< std::string > paths_from_operator_properties(PointerRNA *ptr)
int filesel_drop_import_invoke(bContext *C, wmOperator *op, const wmEvent *)
bool mode_set(bContext *C, eObjectMode mode)
SymEdge< T > * prev(const SymEdge< T > *se)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
bool RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, bool use_ghost)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
int RNA_int_get(PointerRNA *ptr, const char *name)
float RNA_float_get(PointerRNA *ptr, const char *name)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
const EnumPropertyItem rna_enum_modifier_triangulate_ngon_method_items[]
const EnumPropertyItem rna_enum_modifier_triangulate_quad_method_items[]
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
bool(* check)(bContext *C, wmOperator *op)
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
void(* ui)(bContext *C, wmOperator *op)
struct ReportList * reports
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)