63 "Use Render settings for object visibility, modifier settings, etc"},
68 "Use Viewport settings for object visibility, modifier settings, etc"},
69 {0,
nullptr, 0,
nullptr,
nullptr},
136 if (
params.frame_start == INT_MIN) {
139 if (
params.frame_end == INT_MIN) {
158 col = &panel->column(
false);
174 sub = &
col->column(
true);
178 sub = &
col->column(
true);
193 col = &panel->column(
true);
218 col = &panel->column(
false);
220 sub = &
col->column(
false);
228 C,
"ABC_export_particles",
false,
IFACE_(
"Particle Systems")))
248 ui_alembic_export_settings(
C, op->
layout, op->
ptr);
267 ot->name =
"Export Alembic";
268 ot->description =
"Export current scene in an Alembic archive";
269 ot->idname =
"WM_OT_alembic_export";
271 ot->invoke = wm_alembic_export_invoke;
272 ot->exec = wm_alembic_export_exec;
274 ot->ui = wm_alembic_export_draw;
275 ot->check = wm_alembic_export_check;
295 "Start frame of the export, use the default value to "
296 "take the start frame of the current scene",
306 "End frame of the export, use the default value to "
307 "take the end frame of the current scene",
317 "Number of times per frame transformations are sampled",
327 "Number of times per frame object data are sampled",
337 "Time at which the shutter is open",
347 "Time at which the shutter is closed",
352 ot->srna,
"selected",
false,
"Selected Objects Only",
"Export only selected objects");
355 "visible_objects_only",
357 "Visible Objects Only",
358 "Export only objects that are visible");
364 "Do not preserve objects' parent/children relationship");
369 RNA_def_boolean(
ot->srna,
"uvs",
true,
"UV Coordinates",
"Export UV coordinates");
375 RNA_def_boolean(
ot->srna,
"vcolors",
false,
"Color Attributes",
"Export color attributes");
380 "Generated Coordinates",
381 "Export undeformed mesh vertex coordinates");
384 ot->srna,
"face_sets",
false,
"Face Sets",
"Export per face shading group assignments");
389 "Use Subdivision Schema",
390 "Export meshes using Alembic's subdivision schema");
395 "Apply Subdivision Surface",
396 "Export subdivision surfaces as meshes");
402 "Export curves and NURBS surfaces as meshes");
408 "Export data of duplicated objects as Alembic instances; speeds up the export "
409 "and can be disabled for compatibility with other software");
418 "Value by which to enlarge or shrink the objects with respect to the world's origin",
426 "Export polygons (quads and n-gons) as triangles");
433 "Method for splitting the quads into triangles");
440 "Method for splitting the n-gons into triangles");
446 "Exports hair particle systems as animated curves");
448 ot->srna,
"export_particles",
true,
"Export Particles",
"Exports non-hair particle systems");
451 "export_custom_properties",
453 "Export Custom Properties",
454 "Export custom properties to Alembic .userProperties");
460 "Run as Background Job",
461 "Enable this to run the import in the background, disable to block Blender while importing. "
462 "This option is deprecated; EXECUTE this operator to run in the foreground, and INVOKE it "
463 "to run as a background job");
467 rna_enum_abc_export_evaluation_mode_items,
470 "Determines visibility of objects, modifier settings, and other areas where there "
471 "are different settings for viewport and rendering");
488static int get_sequence_len(
const char *filepath,
int *ofs)
500 if (dirpath[0] ==
'\0') {
509 if (dir ==
nullptr) {
511 "Error opening directory '%s': %s\n",
513 errno ? strerror(errno) :
"unknown error");
517 const char *ext =
".abc";
519 const int len = strlen(basename) - (numdigit + strlen(ext));
524 while ((fname =
readdir(dir)) !=
nullptr) {
526 if (!strstr(fname->
d_name, ext)) {
534 CacheFrame cache_frame{};
538 frames.
append(cache_frame);
543 std::sort(frames.
begin(), frames.
end(), [](
const CacheFrame &a,
const CacheFrame &
b) {
544 return a.framenr < b.framenr;
551 int frame_curr = frames.
first().framenr;
554 for (CacheFrame &cache_frame : frames) {
555 if (cache_frame.framenr != frame_curr) {
561 return frame_curr - (*ofs);
588 ui_alembic_import_settings(
C, op->
layout, op->
ptr);
612 const bool always_add_cache_reader =
RNA_boolean_get(op->
ptr,
"always_add_cache_reader");
615 int sequence_min_frame = std::numeric_limits<int>::max();
616 int sequence_max_frame = std::numeric_limits<int>::min();
619 for (
const std::string &path : paths) {
621 int sequence_len = get_sequence_len(path.c_str(), &offset);
622 if (sequence_len < 0) {
626 sequence_min_frame = std::min(sequence_min_frame, offset);
627 sequence_max_frame = std::max(sequence_max_frame, offset + (sequence_len - 1));
638 params.paths = std::move(paths);
640 params.sequence_min_frame = sequence_min_frame;
641 params.sequence_max_frame = sequence_max_frame;
642 params.is_sequence = is_sequence;
644 params.validate_meshes = validate_meshes;
645 params.always_add_cache_reader = always_add_cache_reader;
654 ot->name =
"Import Alembic";
655 ot->description =
"Load an Alembic archive";
656 ot->idname =
"WM_OT_alembic_import";
659 ot->invoke = wm_alembic_import_invoke;
660 ot->exec = wm_alembic_import_exec;
662 ot->ui = wm_alembic_import_draw;
683 "Value by which to enlarge or shrink the objects with respect to the world's origin",
692 "If checked, update scene's start and end frame to match those of the Alembic archive");
699 "Ensure the data is valid "
700 "(when disabled, data may be imported which causes crashes displaying or editing)");
703 "always_add_cache_reader",
705 "Always Add Cache Reader",
706 "Add cache modifiers and constraints to imported objects even if they are not "
707 "animated so that they can be updated when reloading the Alembic archive");
713 "Set to true if the cache is split into separate files");
719 "Run as Background Job",
720 "Enable this to run the export in the background, disable to block Blender while exporting. "
721 "This option is deprecated; EXECUTE this operator to run in the foreground, and INVOKE it "
722 "to run as a background job");
728 auto fh = std::make_unique<blender::bke::FileHandlerType>();
729 STRNCPY(fh->idname,
"IO_FH_alembic");
730 STRNCPY(fh->import_operator,
"WM_OT_alembic_import");
731 STRNCPY(fh->export_operator,
"WM_OT_alembic_export");
733 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
char * STRNCPY(char(&dst)[N], const char *src)
#define STREQLEN(a, b, n)
Compatibility-like things for windows.
struct dirent * readdir(DIR *dp)
DIR * opendir(const char *path)
#define CTX_IFACE_(context, msgid)
#define BLT_I18NCONTEXT_ID_CAMERA
@ MOD_TRIANGULATE_NGON_BEAUTY
@ MOD_TRIANGULATE_QUAD_SHORTEDGE
Object is a sort of wrapper for general info.
void ED_fileselect_ensure_default_filepath(bContext *C, wmOperator *op, const char *extension)
void uiLayoutSetActive(uiLayout *layout, bool active)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
static void set_frame_range(ImportJobData *data)
void append(const T &value)
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)
wmOperatorStatus filesel_drop_import_invoke(bContext *C, wmOperator *op, const wmEvent *)
bool mode_set(bContext *C, eObjectMode mode)
MatBase< T, NumCol, NumRow > scale(const MatBase< T, NumCol, NumRow > &mat, const VectorT &scale)
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[]
PanelLayout panel(const bContext *C, blender::StringRef idname, bool default_closed)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)
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)