68 "Use Render settings for object visibility, modifier settings, etc"},
73 "Use Viewport settings for object visibility, modifier settings, etc"},
74 {0,
nullptr, 0,
nullptr,
nullptr},
140 if (
params.frame_start == INT_MIN) {
143 if (
params.frame_end == INT_MIN) {
162 col = &panel->column(
false);
177 sub = &
col->column(
true);
181 sub = &
col->column(
true);
196 col = &panel->column(
true);
221 col = &panel->column(
false);
223 sub = &
col->column(
false);
231 C,
"ABC_export_particles",
false,
IFACE_(
"Particle Systems")))
251 ui_alembic_export_settings(
C, op->
layout, op->
ptr);
270 ot->name =
"Export Alembic";
271 ot->description =
"Export current scene in an Alembic archive";
272 ot->idname =
"WM_OT_alembic_export";
274 ot->invoke = wm_alembic_export_invoke;
275 ot->exec = wm_alembic_export_exec;
277 ot->ui = wm_alembic_export_draw;
278 ot->check = wm_alembic_export_check;
298 "Start frame of the export, use the default value to "
299 "take the start frame of the current scene",
309 "End frame of the export, use the default value to "
310 "take the end frame of the current scene",
320 "Number of times per frame transformations are sampled",
330 "Number of times per frame object data are sampled",
340 "Time at which the shutter is open",
350 "Time at which the shutter is closed",
355 ot->srna,
"selected",
false,
"Selected Objects Only",
"Export only selected objects");
361 "Do not preserve objects' parent/children relationship");
366 RNA_def_boolean(
ot->srna,
"uvs",
true,
"UV Coordinates",
"Export UV coordinates");
372 RNA_def_boolean(
ot->srna,
"vcolors",
false,
"Color Attributes",
"Export color attributes");
377 "Generated Coordinates",
378 "Export undeformed mesh vertex coordinates");
381 ot->srna,
"face_sets",
false,
"Face Sets",
"Export per face shading group assignments");
386 "Use Subdivision Schema",
387 "Export meshes using Alembic's subdivision schema");
392 "Apply Subdivision Surface",
393 "Export subdivision surfaces as meshes");
399 "Export curves and NURBS surfaces as meshes");
405 "Export data of duplicated objects as Alembic instances; speeds up the export "
406 "and can be disabled for compatibility with other software");
415 "Value by which to enlarge or shrink the objects with respect to the world's origin",
423 "Export polygons (quads and n-gons) as triangles");
430 "Method for splitting the quads into triangles");
437 "Method for splitting the n-gons into triangles");
443 "Exports hair particle systems as animated curves");
445 ot->srna,
"export_particles",
true,
"Export Particles",
"Exports non-hair particle systems");
448 "export_custom_properties",
450 "Export Custom Properties",
451 "Export custom properties to Alembic .userProperties");
457 "Run as Background Job",
458 "Enable this to run the import in the background, disable to block Blender while importing. "
459 "This option is deprecated; EXECUTE this operator to run in the foreground, and INVOKE it "
460 "to run as a background job");
464 rna_enum_abc_export_evaluation_mode_items,
467 "Determines visibility of objects, modifier settings, and other areas where there "
468 "are different settings for viewport and rendering");
485static int get_sequence_len(
const char *filepath,
int *ofs)
497 if (dirpath[0] ==
'\0') {
506 if (dir ==
nullptr) {
508 "Error opening directory '%s': %s",
510 errno ? strerror(errno) :
"unknown error");
514 const char *ext =
".abc";
516 const int len = strlen(basename) - (numdigit + strlen(ext));
521 while ((fname =
readdir(dir)) !=
nullptr) {
523 if (!strstr(fname->
d_name, ext)) {
531 CacheFrame cache_frame{};
535 frames.
append(cache_frame);
540 std::sort(frames.
begin(), frames.
end(), [](
const CacheFrame &a,
const CacheFrame &
b) {
541 return a.framenr < b.framenr;
548 int frame_curr = frames.
first().framenr;
551 for (CacheFrame &cache_frame : frames) {
552 if (cache_frame.framenr != frame_curr) {
558 return frame_curr - (*ofs);
585 ui_alembic_import_settings(
C, op->
layout, op->
ptr);
609 const bool always_add_cache_reader =
RNA_boolean_get(op->
ptr,
"always_add_cache_reader");
612 int sequence_min_frame = std::numeric_limits<int>::max();
613 int sequence_max_frame = std::numeric_limits<int>::min();
616 for (
const std::string &path : paths) {
618 int sequence_len = get_sequence_len(path.c_str(), &offset);
619 if (sequence_len < 0) {
623 sequence_min_frame = std::min(sequence_min_frame, offset);
624 sequence_max_frame = std::max(sequence_max_frame, offset + (sequence_len - 1));
635 params.paths = std::move(paths);
637 params.sequence_min_frame = sequence_min_frame;
638 params.sequence_max_frame = sequence_max_frame;
639 params.is_sequence = is_sequence;
641 params.validate_meshes = validate_meshes;
642 params.always_add_cache_reader = always_add_cache_reader;
651 ot->name =
"Import Alembic";
652 ot->description =
"Load an Alembic archive";
653 ot->idname =
"WM_OT_alembic_import";
656 ot->invoke = wm_alembic_import_invoke;
657 ot->exec = wm_alembic_import_exec;
659 ot->ui = wm_alembic_import_draw;
680 "Value by which to enlarge or shrink the objects with respect to the world's origin",
689 "If checked, update scene's start and end frame to match those of the Alembic archive");
696 "Ensure the data is valid "
697 "(when disabled, data may be imported which causes crashes displaying or editing)");
700 "always_add_cache_reader",
702 "Always Add Cache Reader",
703 "Add cache modifiers and constraints to imported objects even if they are not "
704 "animated so that they can be updated when reloading the Alembic archive");
710 "Set to true if the cache is split into separate files");
716 "Run as Background Job",
717 "Enable this to run the export in the background, disable to block Blender while exporting. "
718 "This option is deprecated; EXECUTE this operator to run in the foreground, and INVOKE it "
719 "to run as a background job");
725 auto fh = std::make_unique<blender::bke::FileHandlerType>();
727 STRNCPY_UTF8(fh->import_operator,
"WM_OT_alembic_import");
728 STRNCPY_UTF8(fh->export_operator,
"WM_OT_alembic_export");
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_UTF8(dst, 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
#define CLOG_ERROR(clg_ref,...)
@ 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)
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)
int RNA_int_get(PointerRNA *ptr, const char *name)
float RNA_float_get(PointerRNA *ptr, const char *name)
std::string RNA_string_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[]
void use_property_decorate_set(bool is_sep)
PanelLayout panel(const bContext *C, blender::StringRef idname, bool default_closed)
void active_set(bool active)
void use_property_split_set(bool value)
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)