Blender V5.0
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.h"
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.h"
33# include "BLI_utildefines.h"
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
61static CLG_LogRef LOG = {"io.alembic"};
62
63static const EnumPropertyItem rna_enum_abc_export_evaluation_mode_items[] = {
65 "RENDER",
66 0,
67 "Render",
68 "Use Render settings for object visibility, modifier settings, etc"},
70 "VIEWPORT",
71 0,
72 "Viewport",
73 "Use Viewport settings for object visibility, modifier settings, etc"},
74 {0, nullptr, 0, nullptr, nullptr},
75};
76
77static wmOperatorStatus wm_alembic_export_invoke(bContext *C,
78 wmOperator *op,
79 const wmEvent * /*event*/)
80{
81 if (!RNA_struct_property_is_set(op->ptr, "as_background_job")) {
82 RNA_boolean_set(op->ptr, "as_background_job", true);
83 }
84
85 RNA_boolean_set(op->ptr, "init_scene_frame_range", true);
86
88
90
92}
93
94static wmOperatorStatus wm_alembic_export_exec(bContext *C, wmOperator *op)
95{
96 if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
97 BKE_report(op->reports, RPT_ERROR, "No filepath given");
98 return OPERATOR_CANCELLED;
99 }
100
101 char filepath[FILE_MAX];
102 RNA_string_get(op->ptr, "filepath", filepath);
103
105 params.frame_start = RNA_int_get(op->ptr, "start");
106 params.frame_end = RNA_int_get(op->ptr, "end");
107
108 params.frame_samples_xform = RNA_int_get(op->ptr, "xsamples");
109 params.frame_samples_shape = RNA_int_get(op->ptr, "gsamples");
110
111 params.shutter_open = RNA_float_get(op->ptr, "sh_open");
112 params.shutter_close = RNA_float_get(op->ptr, "sh_close");
113
114 params.selected_only = RNA_boolean_get(op->ptr, "selected");
115 params.uvs = RNA_boolean_get(op->ptr, "uvs");
116 params.normals = RNA_boolean_get(op->ptr, "normals");
117 params.vcolors = RNA_boolean_get(op->ptr, "vcolors");
118 params.orcos = RNA_boolean_get(op->ptr, "orcos");
119 params.apply_subdiv = RNA_boolean_get(op->ptr, "apply_subdiv");
120 params.curves_as_mesh = RNA_boolean_get(op->ptr, "curves_as_mesh");
121 params.flatten_hierarchy = RNA_boolean_get(op->ptr, "flatten");
122 params.face_sets = RNA_boolean_get(op->ptr, "face_sets");
123 params.use_subdiv_schema = RNA_boolean_get(op->ptr, "subdiv_schema");
124 params.export_hair = RNA_boolean_get(op->ptr, "export_hair");
125 params.export_particles = RNA_boolean_get(op->ptr, "export_particles");
126 params.export_custom_properties = RNA_boolean_get(op->ptr, "export_custom_properties");
127 params.use_instancing = RNA_boolean_get(op->ptr, "use_instancing");
128 params.packuv = RNA_boolean_get(op->ptr, "packuv");
129 params.triangulate = RNA_boolean_get(op->ptr, "triangulate");
130 params.quad_method = RNA_enum_get(op->ptr, "quad_method");
131 params.ngon_method = RNA_enum_get(op->ptr, "ngon_method");
132 params.evaluation_mode = eEvaluationMode(RNA_enum_get(op->ptr, "evaluation_mode"));
133
134 params.global_scale = RNA_float_get(op->ptr, "global_scale");
135
136 RNA_string_get(op->ptr, "collection", params.collection);
137
138 /* Take some defaults from the scene, if not specified explicitly. */
139 Scene *scene = CTX_data_scene(C);
140 if (params.frame_start == INT_MIN) {
141 params.frame_start = scene->r.sfra;
142 }
143 if (params.frame_end == INT_MIN) {
144 params.frame_end = scene->r.efra;
145 }
146
147 const bool as_background_job = RNA_boolean_get(op->ptr, "as_background_job");
148 bool ok = ABC_export(scene, C, filepath, &params, as_background_job);
149
150 return as_background_job || ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
151}
152
153static void ui_alembic_export_settings(const bContext *C, uiLayout *layout, PointerRNA *ptr)
154{
155 layout->use_property_split_set(true);
156 layout->use_property_decorate_set(false);
157
158 if (uiLayout *panel = layout->panel(C, "ABC_export_general", false, IFACE_("General"))) {
159 uiLayout *col = &panel->column(false);
160 col->prop(ptr, "global_scale", UI_ITEM_NONE, std::nullopt, ICON_NONE);
161
162 col = &panel->column(false);
163 if (CTX_wm_space_file(C)) {
164 uiLayout *sub = &col->column(true, IFACE_("Include"));
165 sub->prop(ptr, "selected", UI_ITEM_NONE, IFACE_("Selection Only"), ICON_NONE);
166 }
167 }
168
169 /* Scene Options */
170 if (uiLayout *panel = layout->panel(C, "ABC_export_scene", false, IFACE_("Scene"))) {
171 uiLayout *col = &panel->column(false);
172
173 uiLayout *sub = &col->column(true);
174 sub->prop(ptr, "start", UI_ITEM_NONE, IFACE_("Frame Start"), ICON_NONE);
175 sub->prop(ptr, "end", UI_ITEM_NONE, IFACE_("End"), ICON_NONE);
176
177 sub = &col->column(true);
178 sub->prop(ptr, "xsamples", UI_ITEM_NONE, IFACE_("Samples Transform"), ICON_NONE);
179 sub->prop(ptr, "gsamples", UI_ITEM_NONE, IFACE_("Geometry"), ICON_NONE);
180
181 sub = &col->column(true);
182 sub->prop(ptr, "sh_open", UI_ITEM_R_SLIDER, std::nullopt, ICON_NONE);
183 sub->prop(ptr,
184 "sh_close",
187 ICON_NONE);
188
189 col->separator();
190
191 col->prop(ptr, "use_instancing", UI_ITEM_NONE, IFACE_("Use Instancing"), ICON_NONE);
192 col->prop(
193 ptr, "export_custom_properties", UI_ITEM_NONE, IFACE_("Custom Properties"), ICON_NONE);
194 col->prop(ptr, "flatten", UI_ITEM_NONE, std::nullopt, ICON_NONE);
195
196 col = &panel->column(true);
197 col->prop(ptr, "evaluation_mode", UI_ITEM_NONE, std::nullopt, ICON_NONE);
198 }
199
200 /* Object Data */
201 if (uiLayout *panel = layout->panel(C, "ABC_export_geometry", false, IFACE_("Geometry"))) {
202 uiLayout *col = &panel->column(true);
203 col->prop(ptr, "uvs", UI_ITEM_NONE, std::nullopt, ICON_NONE);
204
205 uiLayout *row = &col->row(false);
206 row->active_set(RNA_boolean_get(ptr, "uvs"));
207 row->prop(ptr, "packuv", UI_ITEM_NONE, std::nullopt, ICON_NONE);
208
209 col->prop(ptr, "normals", UI_ITEM_NONE, std::nullopt, ICON_NONE);
210 col->prop(ptr, "vcolors", UI_ITEM_NONE, std::nullopt, ICON_NONE);
211 col->prop(ptr, "orcos", UI_ITEM_NONE, std::nullopt, ICON_NONE);
212 col->prop(ptr, "face_sets", UI_ITEM_NONE, std::nullopt, ICON_NONE);
213 col->prop(ptr, "curves_as_mesh", UI_ITEM_NONE, std::nullopt, ICON_NONE);
214
215 col->separator();
216
217 uiLayout *sub = &col->column(true, IFACE_("Subdivision"));
218 sub->prop(ptr, "apply_subdiv", UI_ITEM_NONE, IFACE_("Apply"), ICON_NONE);
219 sub->prop(ptr, "subdiv_schema", UI_ITEM_NONE, IFACE_("Use Schema"), ICON_NONE);
220
221 col = &panel->column(false);
222 col->prop(ptr, "triangulate", UI_ITEM_NONE, std::nullopt, ICON_NONE);
223 sub = &col->column(false);
224 sub->active_set(RNA_boolean_get(ptr, "triangulate"));
225 sub->prop(ptr, "quad_method", UI_ITEM_NONE, IFACE_("Method Quads"), ICON_NONE);
226 sub->prop(ptr, "ngon_method", UI_ITEM_NONE, IFACE_("Polygons"), ICON_NONE);
227 }
228
229 /* Particle Data */
230 if (uiLayout *panel = layout->panel(
231 C, "ABC_export_particles", false, IFACE_("Particle Systems")))
232 {
233 uiLayout *col = &panel->column(true);
234 col->prop(ptr, "export_hair", UI_ITEM_NONE, std::nullopt, ICON_NONE);
235 col->prop(ptr, "export_particles", UI_ITEM_NONE, std::nullopt, ICON_NONE);
236 }
237}
238
239static void wm_alembic_export_draw(bContext *C, wmOperator *op)
240{
241 /* Conveniently set start and end frame to match the scene's frame range. */
242 Scene *scene = CTX_data_scene(C);
243
244 if (scene != nullptr && RNA_boolean_get(op->ptr, "init_scene_frame_range")) {
245 RNA_int_set(op->ptr, "start", scene->r.sfra);
246 RNA_int_set(op->ptr, "end", scene->r.efra);
247
248 RNA_boolean_set(op->ptr, "init_scene_frame_range", false);
249 }
250
251 ui_alembic_export_settings(C, op->layout, op->ptr);
252}
253
254static bool wm_alembic_export_check(bContext * /*C*/, wmOperator *op)
255{
256 char filepath[FILE_MAX];
257 RNA_string_get(op->ptr, "filepath", filepath);
258
259 if (!BLI_path_extension_check(filepath, ".abc")) {
260 BLI_path_extension_ensure(filepath, FILE_MAX, ".abc");
261 RNA_string_set(op->ptr, "filepath", filepath);
262 return true;
263 }
264
265 return false;
266}
267
269{
270 ot->name = "Export Alembic";
271 ot->description = "Export current scene in an Alembic archive";
272 ot->idname = "WM_OT_alembic_export";
273
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;
279 ot->flag = OPTYPE_PRESET;
280
284 FILE_SAVE,
288
289 PropertyRNA *prop = RNA_def_string(ot->srna, "filter_glob", "*.abc", 0, "", "");
291
292 RNA_def_int(ot->srna,
293 "start",
294 INT_MIN,
295 INT_MIN,
296 INT_MAX,
297 "Start Frame",
298 "Start frame of the export, use the default value to "
299 "take the start frame of the current scene",
300 INT_MIN,
301 INT_MAX);
302
303 RNA_def_int(ot->srna,
304 "end",
305 INT_MIN,
306 INT_MIN,
307 INT_MAX,
308 "End Frame",
309 "End frame of the export, use the default value to "
310 "take the end frame of the current scene",
311 INT_MIN,
312 INT_MAX);
313
314 RNA_def_int(ot->srna,
315 "xsamples",
316 1,
317 1,
318 128,
319 "Transform Samples",
320 "Number of times per frame transformations are sampled",
321 1,
322 128);
323
324 RNA_def_int(ot->srna,
325 "gsamples",
326 1,
327 1,
328 128,
329 "Geometry Samples",
330 "Number of times per frame object data are sampled",
331 1,
332 128);
333
334 RNA_def_float(ot->srna,
335 "sh_open",
336 0.0f,
337 -1.0f,
338 1.0f,
339 "Shutter Open",
340 "Time at which the shutter is open",
341 -1.0f,
342 1.0f);
343
344 RNA_def_float(ot->srna,
345 "sh_close",
346 1.0f,
347 -1.0f,
348 1.0f,
349 "Shutter Close",
350 "Time at which the shutter is closed",
351 -1.0f,
352 1.0f);
353
355 ot->srna, "selected", false, "Selected Objects Only", "Export only selected objects");
356
357 RNA_def_boolean(ot->srna,
358 "flatten",
359 false,
360 "Flatten Hierarchy",
361 "Do not preserve objects' parent/children relationship");
362
363 prop = RNA_def_string(ot->srna, "collection", nullptr, MAX_ID_NAME - 2, "Collection", nullptr);
365
366 RNA_def_boolean(ot->srna, "uvs", true, "UV Coordinates", "Export UV coordinates");
367
368 RNA_def_boolean(ot->srna, "packuv", true, "Merge UVs", "");
369
370 RNA_def_boolean(ot->srna, "normals", true, "Normals", "Export normals");
371
372 RNA_def_boolean(ot->srna, "vcolors", false, "Color Attributes", "Export color attributes");
373
374 RNA_def_boolean(ot->srna,
375 "orcos",
376 true,
377 "Generated Coordinates",
378 "Export undeformed mesh vertex coordinates");
379
381 ot->srna, "face_sets", false, "Face Sets", "Export per face shading group assignments");
382
383 RNA_def_boolean(ot->srna,
384 "subdiv_schema",
385 false,
386 "Use Subdivision Schema",
387 "Export meshes using Alembic's subdivision schema");
388
389 RNA_def_boolean(ot->srna,
390 "apply_subdiv",
391 false,
392 "Apply Subdivision Surface",
393 "Export subdivision surfaces as meshes");
394
395 RNA_def_boolean(ot->srna,
396 "curves_as_mesh",
397 false,
398 "Curves as Mesh",
399 "Export curves and NURBS surfaces as meshes");
400
401 RNA_def_boolean(ot->srna,
402 "use_instancing",
403 true,
404 "Use Instancing",
405 "Export data of duplicated objects as Alembic instances; speeds up the export "
406 "and can be disabled for compatibility with other software");
407
409 ot->srna,
410 "global_scale",
411 1.0f,
412 0.0001f,
413 1000.0f,
414 "Scale",
415 "Value by which to enlarge or shrink the objects with respect to the world's origin",
416 0.0001f,
417 1000.0f);
418
419 RNA_def_boolean(ot->srna,
420 "triangulate",
421 false,
422 "Triangulate",
423 "Export polygons (quads and n-gons) as triangles");
424
425 RNA_def_enum(ot->srna,
426 "quad_method",
429 "Quad Method",
430 "Method for splitting the quads into triangles");
431
432 RNA_def_enum(ot->srna,
433 "ngon_method",
436 "N-gon Method",
437 "Method for splitting the n-gons into triangles");
438
439 RNA_def_boolean(ot->srna,
440 "export_hair",
441 true,
442 "Export Hair",
443 "Exports hair particle systems as animated curves");
445 ot->srna, "export_particles", true, "Export Particles", "Exports non-hair particle systems");
446
447 RNA_def_boolean(ot->srna,
448 "export_custom_properties",
449 true,
450 "Export Custom Properties",
451 "Export custom properties to Alembic .userProperties");
452
454 ot->srna,
455 "as_background_job",
456 false,
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");
461
462 RNA_def_enum(ot->srna,
463 "evaluation_mode",
464 rna_enum_abc_export_evaluation_mode_items,
466 "Settings",
467 "Determines visibility of objects, modifier settings, and other areas where there "
468 "are different settings for viewport and rendering");
469
470 /* This dummy prop is used to check whether we need to init the start and
471 * end frame values to that of the scene's, otherwise they are reset at
472 * every change, draw update. */
473 RNA_def_boolean(ot->srna, "init_scene_frame_range", true, "", "");
474}
475
476/* ************************************************************************** */
477
478/* TODO(kevin): check on de-duplicating all this with code in `image_ops.cc` */
479
480struct CacheFrame {
481 CacheFrame *next, *prev;
482 int framenr;
483};
484
485static int get_sequence_len(const char *filepath, int *ofs)
486{
487 int frame;
488 int numdigit;
489
490 if (!BLI_path_frame_get(filepath, &frame, &numdigit)) {
491 return 1;
492 }
493
494 char dirpath[FILE_MAX];
495 BLI_path_split_dir_part(filepath, dirpath, FILE_MAX);
496
497 if (dirpath[0] == '\0') {
498 /* The `filepath` had no directory component, so just use the blend files directory. */
500 }
501 else {
503 }
504
505 DIR *dir = opendir(dirpath);
506 if (dir == nullptr) {
508 "Error opening directory '%s': %s",
509 dirpath,
510 errno ? strerror(errno) : "unknown error");
511 return -1;
512 }
513
514 const char *ext = ".abc";
515 const char *basename = BLI_path_basename(filepath);
516 const int len = strlen(basename) - (numdigit + strlen(ext));
517
519
520 dirent *fname;
521 while ((fname = readdir(dir)) != nullptr) {
522 /* do we have the right extension? */
523 if (!strstr(fname->d_name, ext)) {
524 continue;
525 }
526
527 if (!STREQLEN(basename, fname->d_name, len)) {
528 continue;
529 }
530
531 CacheFrame cache_frame{};
532
533 BLI_path_frame_get(fname->d_name, &cache_frame.framenr, &numdigit);
534
535 frames.append(cache_frame);
536 }
537
538 closedir(dir);
539
540 std::sort(frames.begin(), frames.end(), [](const CacheFrame &a, const CacheFrame &b) {
541 return a.framenr < b.framenr;
542 });
543
544 if (frames.is_empty()) {
545 return -1;
546 }
547
548 int frame_curr = frames.first().framenr;
549 (*ofs) = frame_curr;
550
551 for (CacheFrame &cache_frame : frames) {
552 if (cache_frame.framenr != frame_curr) {
553 break;
554 }
555 frame_curr++;
556 }
557
558 return frame_curr - (*ofs);
559}
560
561/* ************************************************************************** */
562
563static void ui_alembic_import_settings(const bContext *C, uiLayout *layout, PointerRNA *ptr)
564{
565 layout->use_property_split_set(true);
566 layout->use_property_decorate_set(false);
567
568 if (uiLayout *panel = layout->panel(C, "ABC_import_general", false, IFACE_("General"))) {
569 uiLayout *col = &panel->column(false);
570 col->prop(ptr, "scale", UI_ITEM_NONE, std::nullopt, ICON_NONE);
571 }
572
573 if (uiLayout *panel = layout->panel(C, "ABC_import_options", false, IFACE_("Options"))) {
574 uiLayout *col = &panel->column(false);
575 col->prop(ptr, "relative_path", UI_ITEM_NONE, std::nullopt, ICON_NONE);
576 col->prop(ptr, "set_frame_range", UI_ITEM_NONE, std::nullopt, ICON_NONE);
577 col->prop(ptr, "is_sequence", UI_ITEM_NONE, std::nullopt, ICON_NONE);
578 col->prop(ptr, "validate_meshes", UI_ITEM_NONE, std::nullopt, ICON_NONE);
579 col->prop(ptr, "always_add_cache_reader", UI_ITEM_NONE, std::nullopt, ICON_NONE);
580 }
581}
582
583static void wm_alembic_import_draw(bContext *C, wmOperator *op)
584{
585 ui_alembic_import_settings(C, op->layout, op->ptr);
586}
587
588/* op->invoke, opens fileselect if path property not set, otherwise executes */
589static wmOperatorStatus wm_alembic_import_invoke(bContext *C, wmOperator *op, const wmEvent *event)
590{
591 if (!RNA_struct_property_is_set(op->ptr, "as_background_job")) {
592 RNA_boolean_set(op->ptr, "as_background_job", true);
593 }
595}
596
597static wmOperatorStatus wm_alembic_import_exec(bContext *C, wmOperator *op)
598{
600 if (paths.is_empty()) {
601 BKE_report(op->reports, RPT_ERROR, "No filepath given");
602 return OPERATOR_CANCELLED;
603 }
604
605 const float scale = RNA_float_get(op->ptr, "scale");
606 const bool is_sequence = RNA_boolean_get(op->ptr, "is_sequence");
607 const bool set_frame_range = RNA_boolean_get(op->ptr, "set_frame_range");
608 const bool validate_meshes = RNA_boolean_get(op->ptr, "validate_meshes");
609 const bool always_add_cache_reader = RNA_boolean_get(op->ptr, "always_add_cache_reader");
610 const bool as_background_job = RNA_boolean_get(op->ptr, "as_background_job");
611
612 int sequence_min_frame = std::numeric_limits<int>::max();
613 int sequence_max_frame = std::numeric_limits<int>::min();
614
615 if (is_sequence) {
616 for (const std::string &path : paths) {
617 int offset = 0;
618 int sequence_len = get_sequence_len(path.c_str(), &offset);
619 if (sequence_len < 0) {
620 BKE_report(op->reports, RPT_ERROR, "Unable to determine ABC sequence length");
621 return OPERATOR_CANCELLED;
622 }
623 sequence_min_frame = std::min(sequence_min_frame, offset);
624 sequence_max_frame = std::max(sequence_max_frame, offset + (sequence_len - 1));
625 }
626 }
627
628 /* Switch out of edit mode to avoid being stuck in it (#54326). */
629 Object *obedit = CTX_data_edit_object(C);
630 if (obedit) {
632 }
633
635 params.paths = std::move(paths);
636 params.global_scale = scale;
637 params.sequence_min_frame = sequence_min_frame;
638 params.sequence_max_frame = sequence_max_frame;
639 params.is_sequence = is_sequence;
640 params.set_frame_range = set_frame_range;
641 params.validate_meshes = validate_meshes;
642 params.always_add_cache_reader = always_add_cache_reader;
643
644 bool ok = ABC_import(C, &params, as_background_job);
645
646 return as_background_job || ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
647}
648
650{
651 ot->name = "Import Alembic";
652 ot->description = "Load an Alembic archive";
653 ot->idname = "WM_OT_alembic_import";
654 ot->flag = OPTYPE_UNDO | OPTYPE_PRESET;
655
656 ot->invoke = wm_alembic_import_invoke;
657 ot->exec = wm_alembic_import_exec;
659 ot->ui = wm_alembic_import_draw;
660
669
670 PropertyRNA *prop = RNA_def_string(ot->srna, "filter_glob", "*.abc", 0, "", "");
672
674 ot->srna,
675 "scale",
676 1.0f,
677 0.0001f,
678 1000.0f,
679 "Scale",
680 "Value by which to enlarge or shrink the objects with respect to the world's origin",
681 0.0001f,
682 1000.0f);
683
685 ot->srna,
686 "set_frame_range",
687 true,
688 "Set Frame Range",
689 "If checked, update scene's start and end frame to match those of the Alembic archive");
690
692 ot->srna,
693 "validate_meshes",
694 false,
695 "Validate Meshes",
696 "Ensure the data is valid "
697 "(when disabled, data may be imported which causes crashes displaying or editing)");
698
699 RNA_def_boolean(ot->srna,
700 "always_add_cache_reader",
701 false,
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");
705
706 RNA_def_boolean(ot->srna,
707 "is_sequence",
708 false,
709 "Is Sequence",
710 "Set to true if the cache is split into separate files");
711
713 ot->srna,
714 "as_background_job",
715 false,
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");
720}
721
722namespace blender::ed::io {
724{
725 auto fh = std::make_unique<blender::bke::FileHandlerType>();
726 STRNCPY_UTF8(fh->idname, "IO_FH_alembic");
727 STRNCPY_UTF8(fh->import_operator, "WM_OT_alembic_import");
728 STRNCPY_UTF8(fh->export_operator, "WM_OT_alembic_export");
729 STRNCPY_UTF8(fh->label, "Alembic");
730 STRNCPY_UTF8(fh->file_extensions_str, ".abc");
731 fh->poll_drop = poll_file_object_drop;
732 bke::file_handler_add(std::move(fh));
733}
734} // namespace blender::ed::io
735
736#endif
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()
Definition main.cc:892
@ RPT_ERROR
Definition BKE_report.hh:39
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:153
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
#define FILE_MAX
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 __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
eEvaluationMode
@ DAG_EVAL_RENDER
@ DAG_EVAL_VIEWPORT
#define MAX_ID_NAME
Definition DNA_ID.h:373
@ MOD_TRIANGULATE_QUAD_SHORTEDGE
@ MOD_TRIANGULATE_NGON_BEAUTY
@ OB_MODE_OBJECT
Object is a sort of wrapper for general info.
@ FILE_SORT_DEFAULT
@ FILE_BLENDER
@ FILE_TYPE_ALEMBIC
@ FILE_TYPE_FOLDER
@ FILE_DEFAULTDISPLAY
@ OPERATOR_CANCELLED
@ OPERATOR_FINISHED
@ OPERATOR_RUNNING_MODAL
void ED_fileselect_ensure_default_filepath(bContext *C, wmOperator *op, const char *extension)
Definition filesel.cc:1470
@ PROP_HIDDEN
Definition RNA_types.hh:338
#define C
Definition RandGen.cpp:29
@ UI_ITEM_R_SLIDER
#define UI_ITEM_NONE
@ WM_FILESEL_FILES
Definition WM_api.hh:1125
@ WM_FILESEL_DIRECTORY
Definition WM_api.hh:1122
@ WM_FILESEL_RELPATH
Definition WM_api.hh:1121
@ WM_FILESEL_SHOW_PROPS
Definition WM_api.hh:1127
@ WM_FILESEL_FILEPATH
Definition WM_api.hh:1124
@ FILE_OPENFILE
Definition WM_api.hh:1133
@ FILE_SAVE
Definition WM_api.hh:1134
@ OPTYPE_PRESET
Definition WM_types.hh:195
@ OPTYPE_UNDO
Definition WM_types.hh:182
static void set_frame_range(ImportJobData *data)
void append(const T &value)
bool is_empty() const
const T & first() const
uint col
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void WM_OT_alembic_import(wmOperatorType *ot)
void WM_OT_alembic_export(wmOperatorType *ot)
#define LOG(level)
Definition log.h:97
static ulong * next
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 *)
Definition io_utils.cc:58
Vector< std::string > paths_from_operator_properties(PointerRNA *ptr)
Definition io_utils.cc:75
wmOperatorStatus filesel_drop_import_invoke(bContext *C, wmOperator *op, const wmEvent *)
Definition io_utils.cc:26
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[]
struct RenderData r
char * d_name
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
struct uiLayout * layout
struct PointerRNA * ptr
uint len
void WM_event_add_fileselect(bContext *C, wmOperator *op)
PointerRNA * ptr
Definition wm_files.cc:4238
wmOperatorType * ot
Definition wm_files.cc:4237
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)