Blender V5.3
io_alembic.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2016 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#ifdef WITH_ALEMBIC
10
11/* needed for directory lookup */
12# ifndef WIN32
13# include <dirent.h>
14# else
15# include "BLI_winstuff.hh"
16# endif
17
18# include <cerrno>
19# include <cstring>
20
21# include "DNA_modifier_types.h"
22# include "DNA_object_types.h"
23# include "DNA_scene_types.h"
24# include "DNA_space_enums.h"
25
26# include "BKE_context.hh"
27# include "BKE_file_handler.hh"
28# include "BKE_main.hh"
29# include "BKE_report.hh"
30
31# include "BLI_path_utils.hh"
32# include "BLI_string_utf8.hh"
33# include "BLI_utildefines.hh"
34# include "BLI_vector.hh"
35
36# include "BLT_translation.hh"
37
38# include "RNA_access.hh"
39# include "RNA_define.hh"
40# include "RNA_enum_types.hh"
41
42# include "ED_fileselect.hh"
43# include "ED_object.hh"
44
45# include "UI_interface.hh"
46# include "UI_resources.hh"
47
48# include "WM_api.hh"
49# include "WM_types.hh"
50
51# include "DEG_depsgraph.hh"
52
53# include "io_alembic.hh"
54# include "io_utils.hh"
55
56# include "ABC_alembic.h"
57# include "UI_interface_layout.hh"
58
59# include "CLG_log.h"
60
61namespace blender {
62
63static CLG_LogRef LOG = {"io.alembic"};
64
65static const EnumPropertyItem rna_enum_abc_export_evaluation_mode_items[] = {
67 "RENDER",
68 0,
69 "Render",
70 "Use Render settings for object visibility, modifier settings, etc"},
72 "VIEWPORT",
73 0,
74 "Viewport",
75 "Use Viewport settings for object visibility, modifier settings, etc"},
76 {0, nullptr, 0, nullptr, nullptr},
77};
78
79static wmOperatorStatus wm_alembic_export_invoke(bContext *C,
80 wmOperator *op,
81 const wmEvent * /*event*/)
82{
83 if (!RNA_struct_property_is_set(op->ptr, "as_background_job")) {
84 RNA_boolean_set(op->ptr, "as_background_job", true);
85 }
86
87 RNA_boolean_set(op->ptr, "init_scene_frame_range", true);
88
90
92
94}
95
96static wmOperatorStatus wm_alembic_export_exec(bContext *C, wmOperator *op)
97{
98 if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
99 BKE_report(op->reports, RPT_ERROR, "No filepath given");
100 return OPERATOR_CANCELLED;
101 }
102
103 char filepath[FILE_MAX];
104 RNA_string_get(op->ptr, "filepath", filepath);
105
106 AlembicExportParams params{};
107 params.frame_start = RNA_int_get(op->ptr, "start");
108 params.frame_end = RNA_int_get(op->ptr, "end");
109
110 params.frame_samples_xform = RNA_int_get(op->ptr, "xsamples");
111 params.frame_samples_shape = RNA_int_get(op->ptr, "gsamples");
112
113 params.shutter_open = RNA_float_get(op->ptr, "sh_open");
114 params.shutter_close = RNA_float_get(op->ptr, "sh_close");
115
116 params.selected_only = RNA_boolean_get(op->ptr, "selected");
117 params.uvs = RNA_boolean_get(op->ptr, "uvs");
118 params.normals = RNA_boolean_get(op->ptr, "normals");
119 params.vcolors = RNA_boolean_get(op->ptr, "vcolors");
120 params.orcos = RNA_boolean_get(op->ptr, "orcos");
121 params.apply_subdiv = RNA_boolean_get(op->ptr, "apply_subdiv");
122 params.curves_as_mesh = RNA_boolean_get(op->ptr, "curves_as_mesh");
123 params.flatten_hierarchy = RNA_boolean_get(op->ptr, "flatten");
124 params.face_sets = RNA_boolean_get(op->ptr, "face_sets");
125 params.use_subdiv_schema = RNA_boolean_get(op->ptr, "subdiv_schema");
126 params.export_hair = RNA_boolean_get(op->ptr, "export_hair");
127 params.export_particles = RNA_boolean_get(op->ptr, "export_particles");
128 params.export_custom_properties = RNA_boolean_get(op->ptr, "export_custom_properties");
129 params.use_instancing = RNA_boolean_get(op->ptr, "use_instancing");
130 params.packuv = RNA_boolean_get(op->ptr, "packuv");
131 params.triangulate = RNA_boolean_get(op->ptr, "triangulate");
132 params.quad_method = RNA_enum_get(op->ptr, "quad_method");
133 params.ngon_method = RNA_enum_get(op->ptr, "ngon_method");
134 params.evaluation_mode = eEvaluationMode(RNA_enum_get(op->ptr, "evaluation_mode"));
135
136 params.global_scale = RNA_float_get(op->ptr, "global_scale");
137
138 RNA_string_get(op->ptr, "collection", params.collection);
139
140 /* Take some defaults from the scene, if not specified explicitly. */
141 Scene *scene = CTX_data_scene(C);
142 if (params.frame_start == INT_MIN) {
143 params.frame_start = scene->r.sfra;
144 }
145 if (params.frame_end == INT_MIN) {
146 params.frame_end = scene->r.efra;
147 }
148
149 const bool as_background_job = RNA_boolean_get(op->ptr, "as_background_job");
150 bool ok = ABC_export(scene, C, filepath, &params, as_background_job);
151
152 return as_background_job || ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
153}
154
155static void ui_alembic_export_settings(const bContext *C, ui::Layout &layout, PointerRNA *ptr)
156{
157 layout.use_property_split_set(true);
158 layout.use_property_decorate_set(false);
159
160 if (ui::Layout *panel = layout.panel(C, "ABC_export_general", false, IFACE_("General"))) {
161 ui::Layout *col = &panel->column(false);
162 col->prop(ptr, "global_scale", UI_ITEM_NONE, std::nullopt, ICON_NONE);
163
164 col = &panel->column(false);
165 if (CTX_wm_space_file(C)) {
166 ui::Layout &sub = col->column(true, IFACE_("Include"));
167 sub.prop(ptr, "selected", UI_ITEM_NONE, IFACE_("Selection Only"), ICON_NONE);
168 }
169 }
170
171 /* Scene Options */
172 if (ui::Layout *panel = layout.panel(C, "ABC_export_scene", false, IFACE_("Scene"))) {
173 ui::Layout *col = &panel->column(false);
174
175 ui::Layout *sub = &col->column(true);
176 sub->prop(ptr, "start", UI_ITEM_NONE, IFACE_("Frame Start"), ICON_NONE);
177 sub->prop(ptr, "end", UI_ITEM_NONE, IFACE_("End"), ICON_NONE);
178
179 sub = &col->column(true);
180 sub->prop(ptr, "xsamples", UI_ITEM_NONE, IFACE_("Samples Transform"), ICON_NONE);
181 sub->prop(ptr, "gsamples", UI_ITEM_NONE, IFACE_("Geometry"), ICON_NONE);
182
183 sub = &col->column(true);
184 sub->prop(ptr, "sh_open", ui::ITEM_R_SLIDER, std::nullopt, ICON_NONE);
185 sub->prop(ptr,
186 "sh_close",
189 ICON_NONE);
190
191 col->separator();
192
193 col->prop(ptr, "use_instancing", UI_ITEM_NONE, IFACE_("Use Instancing"), ICON_NONE);
194 col->prop(
195 ptr, "export_custom_properties", UI_ITEM_NONE, IFACE_("Custom Properties"), ICON_NONE);
196 col->prop(ptr, "flatten", UI_ITEM_NONE, std::nullopt, ICON_NONE);
197
198 col = &panel->column(true);
199 col->prop(ptr, "evaluation_mode", UI_ITEM_NONE, std::nullopt, ICON_NONE);
200 }
201
202 /* Object Data */
203 if (ui::Layout *panel = layout.panel(C, "ABC_export_geometry", false, IFACE_("Geometry"))) {
204 ui::Layout *col = &panel->column(true);
205 col->prop(ptr, "uvs", UI_ITEM_NONE, std::nullopt, ICON_NONE);
206
207 ui::Layout &row = col->row(false);
208 row.active_set(RNA_boolean_get(ptr, "uvs"));
209 row.prop(ptr, "packuv", UI_ITEM_NONE, std::nullopt, ICON_NONE);
210
211 col->prop(ptr, "normals", UI_ITEM_NONE, std::nullopt, ICON_NONE);
212 col->prop(ptr, "vcolors", UI_ITEM_NONE, std::nullopt, ICON_NONE);
213 col->prop(ptr, "orcos", UI_ITEM_NONE, std::nullopt, ICON_NONE);
214 col->prop(ptr, "face_sets", UI_ITEM_NONE, std::nullopt, ICON_NONE);
215 col->prop(ptr, "curves_as_mesh", UI_ITEM_NONE, std::nullopt, ICON_NONE);
216
217 col->separator();
218
219 ui::Layout *sub = &col->column(true, IFACE_("Subdivision"));
220 sub->prop(ptr, "apply_subdiv", UI_ITEM_NONE, IFACE_("Apply"), ICON_NONE);
221 sub->prop(ptr, "subdiv_schema", UI_ITEM_NONE, IFACE_("Use Schema"), ICON_NONE);
222
223 col = &panel->column(false);
224 col->prop(ptr, "triangulate", UI_ITEM_NONE, std::nullopt, ICON_NONE);
225 sub = &col->column(false);
226 sub->active_set(RNA_boolean_get(ptr, "triangulate"));
227 sub->prop(ptr, "quad_method", UI_ITEM_NONE, IFACE_("Method Quads"), ICON_NONE);
228 sub->prop(ptr, "ngon_method", UI_ITEM_NONE, IFACE_("Polygons"), ICON_NONE);
229 }
230
231 /* Particle Data */
232 if (ui::Layout *panel = layout.panel(
233 C, "ABC_export_particles", false, IFACE_("Particle Systems")))
234 {
235 ui::Layout &col = panel->column(true);
236 col.prop(ptr, "export_hair", UI_ITEM_NONE, std::nullopt, ICON_NONE);
237 col.prop(ptr, "export_particles", UI_ITEM_NONE, std::nullopt, ICON_NONE);
238 }
239}
240
241static void wm_alembic_export_draw(bContext *C, wmOperator *op)
242{
243 /* Conveniently set start and end frame to match the scene's frame range. */
244 Scene *scene = CTX_data_scene(C);
245
246 if (scene != nullptr && RNA_boolean_get(op->ptr, "init_scene_frame_range")) {
247 RNA_int_set(op->ptr, "start", scene->r.sfra);
248 RNA_int_set(op->ptr, "end", scene->r.efra);
249
250 RNA_boolean_set(op->ptr, "init_scene_frame_range", false);
251 }
252
253 ui_alembic_export_settings(C, *op->layout, op->ptr);
254}
255
256static bool wm_alembic_export_check(bContext * /*C*/, wmOperator *op)
257{
258 char filepath[FILE_MAX];
259 RNA_string_get(op->ptr, "filepath", filepath);
260
261 if (!BLI_path_extension_check(filepath, ".abc")) {
262 BLI_path_extension_ensure(filepath, FILE_MAX, ".abc");
263 RNA_string_set(op->ptr, "filepath", filepath);
264 return true;
265 }
266
267 return false;
268}
269
271{
272 ot->name = "Export Alembic";
273 ot->description = "Export current scene in an Alembic archive";
274 ot->idname = "WM_OT_alembic_export";
275
276 ot->invoke = wm_alembic_export_invoke;
277 ot->exec = wm_alembic_export_exec;
278 ot->poll = WM_operator_winactive;
279 ot->ui = wm_alembic_export_draw;
280 ot->check = wm_alembic_export_check;
281 ot->flag = OPTYPE_PRESET;
282
286 FILE_SAVE,
290
291 PropertyRNA *prop = RNA_def_string(ot->srna, "filter_glob", "*.abc", 0, "", "");
293
294 RNA_def_int(ot->srna,
295 "start",
296 INT_MIN,
297 INT_MIN,
298 INT_MAX,
299 "Start Frame",
300 "Start frame of the export, use the default value to "
301 "take the start frame of the current scene",
302 INT_MIN,
303 INT_MAX);
304
305 RNA_def_int(ot->srna,
306 "end",
307 INT_MIN,
308 INT_MIN,
309 INT_MAX,
310 "End Frame",
311 "End frame of the export, use the default value to "
312 "take the end frame of the current scene",
313 INT_MIN,
314 INT_MAX);
315
316 RNA_def_int(ot->srna,
317 "xsamples",
318 1,
319 1,
320 128,
321 "Transform Samples",
322 "Number of times per frame transformations are sampled",
323 1,
324 128);
325
326 RNA_def_int(ot->srna,
327 "gsamples",
328 1,
329 1,
330 128,
331 "Geometry Samples",
332 "Number of times per frame object data are sampled",
333 1,
334 128);
335
336 RNA_def_float(ot->srna,
337 "sh_open",
338 0.0f,
339 -1.0f,
340 1.0f,
341 "Shutter Open",
342 "Time at which the shutter is open",
343 -1.0f,
344 1.0f);
345
346 RNA_def_float(ot->srna,
347 "sh_close",
348 1.0f,
349 -1.0f,
350 1.0f,
351 "Shutter Close",
352 "Time at which the shutter is closed",
353 -1.0f,
354 1.0f);
355
357 ot->srna, "selected", false, "Selected Objects Only", "Export only selected objects");
358
359 RNA_def_boolean(ot->srna,
360 "flatten",
361 false,
362 "Flatten Hierarchy",
363 "Do not preserve objects' parent/children relationship");
364
365 prop = RNA_def_string(ot->srna, "collection", nullptr, MAX_ID_NAME - 2, "Collection", nullptr);
367
368 RNA_def_boolean(ot->srna, "uvs", true, "UV Coordinates", "Export UV coordinates");
369
370 RNA_def_boolean(ot->srna, "packuv", true, "Merge UVs", "");
371
372 RNA_def_boolean(ot->srna, "normals", true, "Normals", "Export normals");
373
374 RNA_def_boolean(ot->srna, "vcolors", false, "Color Attributes", "Export color attributes");
375
376 RNA_def_boolean(ot->srna,
377 "orcos",
378 true,
379 "Generated Coordinates",
380 "Export undeformed mesh vertex coordinates");
381
383 ot->srna, "face_sets", false, "Face Sets", "Export per face shading group assignments");
384
385 RNA_def_boolean(ot->srna,
386 "subdiv_schema",
387 false,
388 "Use Subdivision Schema",
389 "Export meshes using Alembic's subdivision schema");
390
391 RNA_def_boolean(ot->srna,
392 "apply_subdiv",
393 false,
394 "Apply Subdivision Surface",
395 "Export subdivision surfaces as meshes");
396
397 RNA_def_boolean(ot->srna,
398 "curves_as_mesh",
399 false,
400 "Curves as Mesh",
401 "Export curves and NURBS surfaces as meshes");
402
403 RNA_def_boolean(ot->srna,
404 "use_instancing",
405 true,
406 "Use Instancing",
407 "Export data of duplicated objects as Alembic instances; speeds up the export "
408 "and can be disabled for compatibility with other software");
409
411 ot->srna,
412 "global_scale",
413 1.0f,
414 0.0001f,
415 1000.0f,
416 "Scale",
417 "Value by which to enlarge or shrink the objects with respect to the world's origin",
418 0.0001f,
419 1000.0f);
420
421 RNA_def_boolean(ot->srna,
422 "triangulate",
423 false,
424 "Triangulate",
425 "Export polygons (quads and n-gons) as triangles");
426
427 RNA_def_enum(ot->srna,
428 "quad_method",
431 "Quad Method",
432 "Method for splitting the quads into triangles");
433
434 RNA_def_enum(ot->srna,
435 "ngon_method",
438 "N-gon Method",
439 "Method for splitting the n-gons into triangles");
440
441 RNA_def_boolean(ot->srna,
442 "export_hair",
443 true,
444 "Export Hair",
445 "Exports hair particle systems as animated curves");
447 ot->srna, "export_particles", true, "Export Particles", "Exports non-hair particle systems");
448
449 RNA_def_boolean(ot->srna,
450 "export_custom_properties",
451 true,
452 "Export Custom Properties",
453 "Export custom properties to Alembic .userProperties");
454
456 ot->srna,
457 "as_background_job",
458 false,
459 "Run as Background Job",
460 "Enable this to run the import in the background, disable to block Blender while importing. "
461 "This option is deprecated; EXECUTE this operator to run in the foreground, and INVOKE it "
462 "to run as a background job");
463
464 RNA_def_enum(ot->srna,
465 "evaluation_mode",
466 rna_enum_abc_export_evaluation_mode_items,
468 "Settings",
469 "Determines visibility of objects, modifier settings, and other areas where there "
470 "are different settings for viewport and rendering");
471
472 /* This dummy prop is used to check whether we need to init the start and
473 * end frame values to that of the scene's, otherwise they are reset at
474 * every change, draw update. */
475 RNA_def_boolean(ot->srna, "init_scene_frame_range", true, "", "");
476}
477
478/* ************************************************************************** */
479
480/* TODO(kevin): check on de-duplicating all this with code in `image_ops.cc` */
481
482struct CacheFrame {
483 CacheFrame *next, *prev;
484 int framenr;
485};
486
487static int get_sequence_len(const char *filepath, int *ofs)
488{
489 int frame;
490 int numdigit;
491
492 if (!BLI_path_frame_get(filepath, &frame, &numdigit)) {
493 return 1;
494 }
495
496 char dirpath[FILE_MAX];
497 BLI_path_split_dir_part(filepath, dirpath, FILE_MAX);
498
499 if (dirpath[0] == '\0') {
500 /* The `filepath` had no directory component, so just use the blend files directory. */
502 }
503 else {
505 }
506
507 DIR *dir = opendir(dirpath);
508 if (dir == nullptr) {
510 "Error opening directory '%s': %s",
511 dirpath,
512 errno ? strerror(errno) : "unknown error");
513 return -1;
514 }
515
516 const char *ext = ".abc";
517 const char *basename = BLI_path_basename(filepath);
518 const int len = strlen(basename) - (numdigit + strlen(ext));
519
520 Vector<CacheFrame> frames;
521
522 dirent *fname;
523 while ((fname = readdir(dir)) != nullptr) {
524 /* do we have the right extension? */
525 if (!strstr(fname->d_name, ext)) {
526 continue;
527 }
528
529 if (!STREQLEN(basename, fname->d_name, len)) {
530 continue;
531 }
532
533 CacheFrame cache_frame{};
534
535 BLI_path_frame_get(fname->d_name, &cache_frame.framenr, &numdigit);
536
537 frames.append(cache_frame);
538 }
539
540 closedir(dir);
541
542 std::ranges::sort(
543 frames, [](const CacheFrame &a, const CacheFrame &b) { return a.framenr < b.framenr; });
544
545 if (frames.is_empty()) {
546 return -1;
547 }
548
549 int frame_curr = frames.first().framenr;
550 (*ofs) = frame_curr;
551
552 for (CacheFrame &cache_frame : frames) {
553 if (cache_frame.framenr != frame_curr) {
554 break;
555 }
556 frame_curr++;
557 }
558
559 return frame_curr - (*ofs);
560}
561
562/* ************************************************************************** */
563
564static void ui_alembic_import_settings(const bContext *C, ui::Layout *layout, PointerRNA *ptr)
565{
566 layout->use_property_split_set(true);
567 layout->use_property_decorate_set(false);
568
569 if (ui::Layout *panel = layout->panel(C, "ABC_import_general", false, IFACE_("General"))) {
570 ui::Layout &col = panel->column(false);
571 col.prop(ptr, "scale", UI_ITEM_NONE, std::nullopt, ICON_NONE);
572 }
573
574 if (ui::Layout *panel = layout->panel(C, "ABC_import_options", false, IFACE_("Options"))) {
575 ui::Layout &col = panel->column(false);
576 col.prop(ptr, "relative_path", UI_ITEM_NONE, std::nullopt, ICON_NONE);
577 col.prop(ptr, "set_frame_range", UI_ITEM_NONE, std::nullopt, ICON_NONE);
578 col.prop(ptr, "is_sequence", UI_ITEM_NONE, std::nullopt, ICON_NONE);
579 col.prop(ptr, "validate_meshes", UI_ITEM_NONE, std::nullopt, ICON_NONE);
580 col.prop(ptr, "always_add_cache_reader", UI_ITEM_NONE, std::nullopt, ICON_NONE);
581 }
582}
583
584static void wm_alembic_import_draw(bContext *C, wmOperator *op)
585{
586 ui_alembic_import_settings(C, op->layout, op->ptr);
587}
588
589/* op->invoke, opens fileselect if path property not set, otherwise executes */
590static wmOperatorStatus wm_alembic_import_invoke(bContext *C, wmOperator *op, const wmEvent *event)
591{
592 if (!RNA_struct_property_is_set(op->ptr, "as_background_job")) {
593 RNA_boolean_set(op->ptr, "as_background_job", true);
594 }
595 return ed::io::filesel_drop_import_invoke(C, op, event);
596}
597
598static wmOperatorStatus wm_alembic_import_exec(bContext *C, wmOperator *op)
599{
601 if (paths.is_empty()) {
602 BKE_report(op->reports, RPT_ERROR, "No filepath given");
603 return OPERATOR_CANCELLED;
604 }
605
606 const float scale = RNA_float_get(op->ptr, "scale");
607 const bool is_sequence = RNA_boolean_get(op->ptr, "is_sequence");
608 const bool set_frame_range = RNA_boolean_get(op->ptr, "set_frame_range");
609 const bool validate_meshes = RNA_boolean_get(op->ptr, "validate_meshes");
610 const bool always_add_cache_reader = RNA_boolean_get(op->ptr, "always_add_cache_reader");
611 const bool as_background_job = RNA_boolean_get(op->ptr, "as_background_job");
612
613 int sequence_min_frame = std::numeric_limits<int>::max();
614 int sequence_max_frame = std::numeric_limits<int>::min();
615
616 if (is_sequence) {
617 for (const std::string &path : paths) {
618 int offset = 0;
619 int sequence_len = get_sequence_len(path.c_str(), &offset);
620 if (sequence_len < 0) {
621 BKE_report(op->reports, RPT_ERROR, "Unable to determine ABC sequence length");
622 return OPERATOR_CANCELLED;
623 }
624 sequence_min_frame = std::min(sequence_min_frame, offset);
625 sequence_max_frame = std::max(sequence_max_frame, offset + (sequence_len - 1));
626 }
627 }
628
629 /* Switch out of edit mode to avoid being stuck in it (#54326). */
630 Object *obedit = CTX_data_edit_object(C);
631 if (obedit) {
633 }
634
635 AlembicImportParams params{};
636 params.paths = std::move(paths);
637 params.global_scale = scale;
638 params.sequence_min_frame = sequence_min_frame;
639 params.sequence_max_frame = sequence_max_frame;
640 params.is_sequence = is_sequence;
641 params.set_frame_range = set_frame_range;
642 params.validate_meshes = validate_meshes;
643 params.always_add_cache_reader = always_add_cache_reader;
644
645 bool ok = ABC_import(C, &params, as_background_job);
646
647 return as_background_job || ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
648}
649
651{
652 ot->name = "Import Alembic";
653 ot->description = "Load an Alembic archive";
654 ot->idname = "WM_OT_alembic_import";
655 ot->flag = OPTYPE_UNDO | OPTYPE_PRESET;
656
657 ot->invoke = wm_alembic_import_invoke;
658 ot->exec = wm_alembic_import_exec;
659 ot->poll = WM_operator_winactive;
660 ot->ui = wm_alembic_import_draw;
661
670
671 PropertyRNA *prop = RNA_def_string(ot->srna, "filter_glob", "*.abc", 0, "", "");
673
675 ot->srna,
676 "scale",
677 1.0f,
678 0.0001f,
679 1000.0f,
680 "Scale",
681 "Value by which to enlarge or shrink the objects with respect to the world's origin",
682 0.0001f,
683 1000.0f);
684
686 ot->srna,
687 "set_frame_range",
688 true,
689 "Set Frame Range",
690 "If checked, update scene's start and end frame to match those of the Alembic archive");
691
693 ot->srna,
694 "validate_meshes",
695 false,
696 "Validate Meshes",
697 "Ensure the data is valid "
698 "(when disabled, data may be imported which causes crashes displaying or editing)");
699
700 RNA_def_boolean(ot->srna,
701 "always_add_cache_reader",
702 false,
703 "Always Add Cache Reader",
704 "Add cache modifiers and constraints to imported objects even if they are not "
705 "animated so that they can be updated when reloading the Alembic archive");
706
707 RNA_def_boolean(ot->srna,
708 "is_sequence",
709 false,
710 "Is Sequence",
711 "Set to true if the cache is split into separate files");
712
714 ot->srna,
715 "as_background_job",
716 false,
717 "Run as Background Job",
718 "Enable this to run the export in the background, disable to block Blender while exporting. "
719 "This option is deprecated; EXECUTE this operator to run in the foreground, and INVOKE it "
720 "to run as a background job");
721}
722
723namespace ed::io {
725{
726 auto fh = std::make_unique<bke::FileHandlerType>();
727 STRNCPY_UTF8(fh->idname, "IO_FH_alembic");
728 STRNCPY_UTF8(fh->import_operator, "WM_OT_alembic_import");
729 STRNCPY_UTF8(fh->export_operator, "WM_OT_alembic_export");
730 STRNCPY_UTF8(fh->label, "Alembic");
731 STRNCPY_UTF8(fh->file_extensions_str, ".abc");
732 fh->poll_drop = poll_file_object_drop;
733 bke::file_handler_add(std::move(fh));
734}
735} // namespace ed::io
736} // namespace blender
737
738#endif
#define FILE_MAX
#define STRNCPY_UTF8(dst, src)
Compatibility-like things for windows.
struct __dirstream DIR
struct dirent * readdir(DIR *dp)
int closedir(DIR *dp)
DIR * opendir(const char *path)
#define CTX_IFACE_(context, msgid)
#define IFACE_(msgid)
#define BLT_I18NCONTEXT_ID_CAMERA
#define CLOG_ERROR(clg_ref,...)
Definition CLG_log.h:188
#define MAX_ID_NAME
Definition DNA_ID.h:367
Object is a sort of wrapper for general info.
#define C
Definition RandGen.cpp:29
#define UI_ITEM_NONE
#define STREQLEN(a, b, n)
#define INT_MAX
float3x3 scale(float3x3 mat, float2 scale)
#define LOG(level)
Definition log.h:97
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
Definition math_dual.h:263
void file_handler_add(std::unique_ptr< FileHandlerType > file_handler)
bool poll_file_object_drop(const bContext *C, bke::FileHandlerType *)
Definition io_utils.cc:62
void alembic_file_handler_add()
Vector< std::string > paths_from_operator_properties(PointerRNA *ptr)
Definition io_utils.cc:79
wmOperatorStatus filesel_drop_import_invoke(bContext *C, wmOperator *op, const wmEvent *)
Definition io_utils.cc:30
bool mode_set(bContext *C, eObjectMode mode)
SymEdge< T > * prev(const SymEdge< T > *se)
BMesh Iterators.
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)
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
void WM_OT_alembic_export(wmOperatorType *ot)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
bool RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, bool use_ghost)
int RNA_int_get(PointerRNA *ptr, const char *name)
void WM_OT_alembic_import(wmOperatorType *ot)
const char * BKE_main_blendfile_path_from_global()
Definition main.cc:1063
bool BLI_path_frame_get(const char *path, int *r_frame, int *r_digits_len) ATTR_NONNULL(1
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)
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
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
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:162
const EnumPropertyItem rna_enum_modifier_triangulate_quad_method_items[]
@ WM_FILESEL_DIRECTORY
Definition WM_api.hh:1330
@ WM_FILESEL_RELPATH
Definition WM_api.hh:1329
@ WM_FILESEL_SHOW_PROPS
Definition WM_api.hh:1335
@ WM_FILESEL_FILES
Definition WM_api.hh:1333
@ WM_FILESEL_FILEPATH
Definition WM_api.hh:1332
Object * CTX_data_edit_object(const bContext *C)
void ED_fileselect_ensure_default_filepath(bContext *C, wmOperator *op, const char *extension)
Definition filesel.cc:1515
@ DAG_EVAL_VIEWPORT
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
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)
bool ABC_import(struct bContext *C, const struct AlembicImportParams *params, bool as_background_job)
@ FILE_SAVE
Definition WM_api.hh:1342
@ FILE_OPENFILE
Definition WM_api.hh:1341
bool WM_operator_winactive(bContext *C)
bool BLI_path_extension_check(const char *path, const char *ext) ATTR_NONNULL(1
@ PROP_HIDDEN
Definition RNA_types.hh:408
@ MOD_TRIANGULATE_QUAD_SHORTEDGE
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)
@ OPTYPE_UNDO
Definition WM_types.hh:190
@ OPTYPE_PRESET
Definition WM_types.hh:203
std::string RNA_string_get(PointerRNA *ptr, const char *name)
const EnumPropertyItem rna_enum_modifier_triangulate_ngon_method_items[]
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, 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)
float RNA_float_get(PointerRNA *ptr, const char *name)
void WM_event_add_fileselect(bContext *C, wmOperator *op)
Vector< std::string > paths
Definition ABC_alembic.h:72
PanelLayout panel(const bContext *C, StringRef idname, bool default_closed)
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< StringRef > name_opt, int icon, std::optional< StringRef > placeholder=std::nullopt)
void active_set(bool active)
Layout & column(bool align)
Layout & row(bool align)
char * d_name