Blender V4.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
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 "MEM_guardedalloc.h"
22
23# include "DNA_modifier_types.h"
24# include "DNA_object_types.h"
25# include "DNA_scene_types.h"
26# include "DNA_space_types.h"
27
28# include "BKE_context.hh"
29# include "BKE_file_handler.hh"
30# include "BKE_main.hh"
31# include "BKE_report.hh"
32
33# include "BLI_path_utils.hh"
34# include "BLI_string.h"
35# include "BLI_utildefines.h"
36# include "BLI_vector.hh"
37
38# include "BLT_translation.hh"
39
40# include "RNA_access.hh"
41# include "RNA_define.hh"
42# include "RNA_enum_types.hh"
43
44# include "ED_fileselect.hh"
45# include "ED_object.hh"
46
47# include "UI_interface.hh"
48# include "UI_resources.hh"
49
50# include "WM_api.hh"
51# include "WM_types.hh"
52
53# include "DEG_depsgraph.hh"
54
55# include "io_alembic.hh"
56# include "io_utils.hh"
57
58# include "ABC_alembic.h"
59
60const EnumPropertyItem rna_enum_abc_export_evaluation_mode_items[] = {
62 "RENDER",
63 0,
64 "Render",
65 "Use Render settings for object visibility, modifier settings, etc"},
67 "VIEWPORT",
68 0,
69 "Viewport",
70 "Use Viewport settings for object visibility, modifier settings, etc"},
71 {0, nullptr, 0, nullptr, nullptr},
72};
73
74static int wm_alembic_export_invoke(bContext *C, wmOperator *op, const wmEvent * /*event*/)
75{
76 if (!RNA_struct_property_is_set(op->ptr, "as_background_job")) {
77 RNA_boolean_set(op->ptr, "as_background_job", true);
78 }
79
80 RNA_boolean_set(op->ptr, "init_scene_frame_range", true);
81
83
85
87}
88
89static int wm_alembic_export_exec(bContext *C, wmOperator *op)
90{
91 if (!RNA_struct_property_is_set_ex(op->ptr, "filepath", false)) {
92 BKE_report(op->reports, RPT_ERROR, "No filepath given");
93 return OPERATOR_CANCELLED;
94 }
95
96 char filepath[FILE_MAX];
97 RNA_string_get(op->ptr, "filepath", filepath);
98
100 params.frame_start = RNA_int_get(op->ptr, "start");
101 params.frame_end = RNA_int_get(op->ptr, "end");
102
103 params.frame_samples_xform = RNA_int_get(op->ptr, "xsamples");
104 params.frame_samples_shape = RNA_int_get(op->ptr, "gsamples");
105
106 params.shutter_open = RNA_float_get(op->ptr, "sh_open");
107 params.shutter_close = RNA_float_get(op->ptr, "sh_close");
108
109 params.selected_only = RNA_boolean_get(op->ptr, "selected");
110 params.uvs = RNA_boolean_get(op->ptr, "uvs");
111 params.normals = RNA_boolean_get(op->ptr, "normals");
112 params.vcolors = RNA_boolean_get(op->ptr, "vcolors");
113 params.orcos = RNA_boolean_get(op->ptr, "orcos");
114 params.apply_subdiv = RNA_boolean_get(op->ptr, "apply_subdiv");
115 params.curves_as_mesh = RNA_boolean_get(op->ptr, "curves_as_mesh");
116 params.flatten_hierarchy = RNA_boolean_get(op->ptr, "flatten");
117 params.visible_objects_only = RNA_boolean_get(op->ptr, "visible_objects_only");
118 params.face_sets = RNA_boolean_get(op->ptr, "face_sets");
119 params.use_subdiv_schema = RNA_boolean_get(op->ptr, "subdiv_schema");
120 params.export_hair = RNA_boolean_get(op->ptr, "export_hair");
121 params.export_particles = RNA_boolean_get(op->ptr, "export_particles");
122 params.export_custom_properties = RNA_boolean_get(op->ptr, "export_custom_properties");
123 params.use_instancing = RNA_boolean_get(op->ptr, "use_instancing");
124 params.packuv = RNA_boolean_get(op->ptr, "packuv");
125 params.triangulate = RNA_boolean_get(op->ptr, "triangulate");
126 params.quad_method = RNA_enum_get(op->ptr, "quad_method");
127 params.ngon_method = RNA_enum_get(op->ptr, "ngon_method");
128 params.evaluation_mode = eEvaluationMode(RNA_enum_get(op->ptr, "evaluation_mode"));
129
130 params.global_scale = RNA_float_get(op->ptr, "global_scale");
131
132 RNA_string_get(op->ptr, "collection", params.collection);
133
134 /* Take some defaults from the scene, if not specified explicitly. */
135 Scene *scene = CTX_data_scene(C);
136 if (params.frame_start == INT_MIN) {
137 params.frame_start = scene->r.sfra;
138 }
139 if (params.frame_end == INT_MIN) {
140 params.frame_end = scene->r.efra;
141 }
142
143 const bool as_background_job = RNA_boolean_get(op->ptr, "as_background_job");
144 bool ok = ABC_export(scene, C, filepath, &params, as_background_job);
145
146 return as_background_job || ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
147}
148
149static void ui_alembic_export_settings(const bContext *C, uiLayout *layout, PointerRNA *ptr)
150{
151 uiLayoutSetPropSep(layout, true);
152 uiLayoutSetPropDecorate(layout, false);
153
154 if (uiLayout *panel = uiLayoutPanel(C, layout, "ABC_export_general", false, IFACE_("General"))) {
155 uiLayout *col = uiLayoutColumn(panel, false);
156 uiItemR(col, ptr, "global_scale", UI_ITEM_NONE, nullptr, ICON_NONE);
157
158 col = uiLayoutColumn(panel, false);
159 if (CTX_wm_space_file(C)) {
160 uiLayout *sub = uiLayoutColumnWithHeading(col, true, IFACE_("Include"));
161 uiItemR(sub, ptr, "selected", UI_ITEM_NONE, IFACE_("Selection Only"), ICON_NONE);
162 uiItemR(sub, ptr, "visible_objects_only", UI_ITEM_NONE, IFACE_("Visible Only"), ICON_NONE);
163 }
164 }
165
166 /* Scene Options */
167 if (uiLayout *panel = uiLayoutPanel(C, layout, "ABC_export_scene", false, IFACE_("Scene"))) {
168 uiLayout *col = uiLayoutColumn(panel, false);
169
170 uiLayout *sub = uiLayoutColumn(col, true);
171 uiItemR(sub, ptr, "start", UI_ITEM_NONE, IFACE_("Frame Start"), ICON_NONE);
172 uiItemR(sub, ptr, "end", UI_ITEM_NONE, IFACE_("End"), ICON_NONE);
173
174 sub = uiLayoutColumn(col, true);
175 uiItemR(sub, ptr, "xsamples", UI_ITEM_NONE, IFACE_("Samples Transform"), ICON_NONE);
176 uiItemR(sub, ptr, "gsamples", UI_ITEM_NONE, IFACE_("Geometry"), ICON_NONE);
177
178 sub = uiLayoutColumn(col, true);
179 uiItemR(sub, ptr, "sh_open", UI_ITEM_R_SLIDER, nullptr, ICON_NONE);
180 uiItemR(sub, ptr, "sh_close", UI_ITEM_R_SLIDER, IFACE_("Close"), ICON_NONE);
181
182 uiItemS(col);
183
184 uiItemR(col, ptr, "use_instancing", UI_ITEM_NONE, IFACE_("Use Instancing"), ICON_NONE);
185 uiItemR(col,
186 ptr,
187 "export_custom_properties",
189 IFACE_("Custom Properties"),
190 ICON_NONE);
191 uiItemR(col, ptr, "flatten", UI_ITEM_NONE, nullptr, ICON_NONE);
192
193 col = uiLayoutColumn(panel, true);
194 uiItemR(col, ptr, "evaluation_mode", UI_ITEM_NONE, nullptr, ICON_NONE);
195 }
196
197 /* Object Data */
198 if (uiLayout *panel = uiLayoutPanel(C, layout, "ABC_export_geometry", false, IFACE_("Geometry")))
199 {
200 uiLayout *col = uiLayoutColumn(panel, true);
201 uiItemR(col, ptr, "uvs", UI_ITEM_NONE, nullptr, ICON_NONE);
202
203 uiLayout *row = uiLayoutRow(col, false);
205 uiItemR(row, ptr, "packuv", UI_ITEM_NONE, nullptr, ICON_NONE);
206
207 uiItemR(col, ptr, "normals", UI_ITEM_NONE, nullptr, ICON_NONE);
208 uiItemR(col, ptr, "vcolors", UI_ITEM_NONE, nullptr, ICON_NONE);
209 uiItemR(col, ptr, "orcos", UI_ITEM_NONE, nullptr, ICON_NONE);
210 uiItemR(col, ptr, "face_sets", UI_ITEM_NONE, nullptr, ICON_NONE);
211 uiItemR(col, ptr, "curves_as_mesh", UI_ITEM_NONE, nullptr, ICON_NONE);
212
213 uiItemS(col);
214
215 uiLayout *sub = uiLayoutColumnWithHeading(col, true, IFACE_("Subdivision"));
216 uiItemR(sub, ptr, "apply_subdiv", UI_ITEM_NONE, IFACE_("Apply"), ICON_NONE);
217 uiItemR(sub, ptr, "subdiv_schema", UI_ITEM_NONE, IFACE_("Use Schema"), ICON_NONE);
218
219 col = uiLayoutColumn(panel, false);
220 uiItemR(col, ptr, "triangulate", UI_ITEM_NONE, nullptr, ICON_NONE);
221 sub = uiLayoutColumn(col, false);
222 uiLayoutSetActive(sub, RNA_boolean_get(ptr, "triangulate"));
223 uiItemR(sub, ptr, "quad_method", UI_ITEM_NONE, IFACE_("Method Quads"), ICON_NONE);
224 uiItemR(sub, ptr, "ngon_method", UI_ITEM_NONE, IFACE_("Polygons"), ICON_NONE);
225 }
226
227 /* Particle Data */
228 if (uiLayout *panel = uiLayoutPanel(
229 C, layout, "ABC_export_particles", false, IFACE_("Particle Systems")))
230 {
231 uiLayout *col = uiLayoutColumn(panel, true);
232 uiItemR(col, ptr, "export_hair", UI_ITEM_NONE, nullptr, ICON_NONE);
233 uiItemR(col, ptr, "export_particles", UI_ITEM_NONE, nullptr, ICON_NONE);
234 }
235}
236
237static void wm_alembic_export_draw(bContext *C, wmOperator *op)
238{
239 /* Conveniently set start and end frame to match the scene's frame range. */
240 Scene *scene = CTX_data_scene(C);
241
242 if (scene != nullptr && RNA_boolean_get(op->ptr, "init_scene_frame_range")) {
243 RNA_int_set(op->ptr, "start", scene->r.sfra);
244 RNA_int_set(op->ptr, "end", scene->r.efra);
245
246 RNA_boolean_set(op->ptr, "init_scene_frame_range", false);
247 }
248
249 ui_alembic_export_settings(C, op->layout, op->ptr);
250}
251
252static bool wm_alembic_export_check(bContext * /*C*/, wmOperator *op)
253{
254 char filepath[FILE_MAX];
255 RNA_string_get(op->ptr, "filepath", filepath);
256
257 if (!BLI_path_extension_check(filepath, ".abc")) {
258 BLI_path_extension_ensure(filepath, FILE_MAX, ".abc");
259 RNA_string_set(op->ptr, "filepath", filepath);
260 return true;
261 }
262
263 return false;
264}
265
267{
268 ot->name = "Export Alembic";
269 ot->description = "Export current scene in an Alembic archive";
270 ot->idname = "WM_OT_alembic_export";
271
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;
278
282 FILE_SAVE,
286
287 PropertyRNA *prop = RNA_def_string(ot->srna, "filter_glob", "*.abc", 0, "", "");
289
291 "start",
292 INT_MIN,
293 INT_MIN,
294 INT_MAX,
295 "Start Frame",
296 "Start frame of the export, use the default value to "
297 "take the start frame of the current scene",
298 INT_MIN,
299 INT_MAX);
300
302 "end",
303 INT_MIN,
304 INT_MIN,
305 INT_MAX,
306 "End Frame",
307 "End frame of the export, use the default value to "
308 "take the end frame of the current scene",
309 INT_MIN,
310 INT_MAX);
311
313 "xsamples",
314 1,
315 1,
316 128,
317 "Transform Samples",
318 "Number of times per frame transformations are sampled",
319 1,
320 128);
321
323 "gsamples",
324 1,
325 1,
326 128,
327 "Geometry Samples",
328 "Number of times per frame object data are sampled",
329 1,
330 128);
331
333 "sh_open",
334 0.0f,
335 -1.0f,
336 1.0f,
337 "Shutter Open",
338 "Time at which the shutter is open",
339 -1.0f,
340 1.0f);
341
343 "sh_close",
344 1.0f,
345 -1.0f,
346 1.0f,
347 "Shutter Close",
348 "Time at which the shutter is closed",
349 -1.0f,
350 1.0f);
351
353 ot->srna, "selected", false, "Selected Objects Only", "Export only selected objects");
354
356 "visible_objects_only",
357 false,
358 "Visible Objects Only",
359 "Export only objects that are visible");
360
362 "flatten",
363 false,
364 "Flatten Hierarchy",
365 "Do not preserve objects' parent/children relationship");
366
367 prop = RNA_def_string(ot->srna, "collection", nullptr, MAX_IDPROP_NAME, "Collection", nullptr);
369
370 RNA_def_boolean(ot->srna, "uvs", true, "UV Coordinates", "Export UV coordinates");
371
372 RNA_def_boolean(ot->srna, "packuv", true, "Merge UVs", "");
373
374 RNA_def_boolean(ot->srna, "normals", true, "Normals", "Export normals");
375
376 RNA_def_boolean(ot->srna, "vcolors", false, "Color Attributes", "Export color attributes");
377
379 "orcos",
380 true,
381 "Generated Coordinates",
382 "Export undeformed mesh vertex coordinates");
383
385 ot->srna, "face_sets", false, "Face Sets", "Export per face shading group assignments");
386
388 "subdiv_schema",
389 false,
390 "Use Subdivision Schema",
391 "Export meshes using Alembic's subdivision schema");
392
394 "apply_subdiv",
395 false,
396 "Apply Subdivision Surface",
397 "Export subdivision surfaces as meshes");
398
400 "curves_as_mesh",
401 false,
402 "Curves as Mesh",
403 "Export curves and NURBS surfaces as meshes");
404
406 "use_instancing",
407 true,
408 "Use Instancing",
409 "Export data of duplicated objects as Alembic instances; speeds up the export "
410 "and can be disabled for compatibility with other software");
411
413 ot->srna,
414 "global_scale",
415 1.0f,
416 0.0001f,
417 1000.0f,
418 "Scale",
419 "Value by which to enlarge or shrink the objects with respect to the world's origin",
420 0.0001f,
421 1000.0f);
422
424 "triangulate",
425 false,
426 "Triangulate",
427 "Export polygons (quads and n-gons) as triangles");
428
430 "quad_method",
433 "Quad Method",
434 "Method for splitting the quads into triangles");
435
437 "ngon_method",
440 "N-gon Method",
441 "Method for splitting the n-gons into triangles");
442
444 "export_hair",
445 true,
446 "Export Hair",
447 "Exports hair particle systems as animated curves");
449 ot->srna, "export_particles", true, "Export Particles", "Exports non-hair particle systems");
450
452 "export_custom_properties",
453 true,
454 "Export Custom Properties",
455 "Export custom properties to Alembic .userProperties");
456
458 ot->srna,
459 "as_background_job",
460 false,
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");
465
467 "evaluation_mode",
468 rna_enum_abc_export_evaluation_mode_items,
470 "Settings",
471 "Determines visibility of objects, modifier settings, and other areas where there "
472 "are different settings for viewport and rendering");
473
474 /* This dummy prop is used to check whether we need to init the start and
475 * end frame values to that of the scene's, otherwise they are reset at
476 * every change, draw update. */
477 RNA_def_boolean(ot->srna, "init_scene_frame_range", true, "", "");
478}
479
480/* ************************************************************************** */
481
482/* TODO(kevin): check on de-duplicating all this with code in `image_ops.cc` */
483
484struct CacheFrame {
485 CacheFrame *next, *prev;
486 int framenr;
487};
488
489static int get_sequence_len(const char *filepath, int *ofs)
490{
491 int frame;
492 int numdigit;
493
494 if (!BLI_path_frame_get(filepath, &frame, &numdigit)) {
495 return 1;
496 }
497
498 char dirpath[FILE_MAX];
499 BLI_path_split_dir_part(filepath, dirpath, FILE_MAX);
500
501 if (dirpath[0] == '\0') {
502 /* The `filepath` had no directory component, so just use the blend files directory. */
504 }
505 else {
507 }
508
509 DIR *dir = opendir(dirpath);
510 if (dir == nullptr) {
511 fprintf(stderr,
512 "Error opening directory '%s': %s\n",
513 dirpath,
514 errno ? strerror(errno) : "unknown error");
515 return -1;
516 }
517
518 const char *ext = ".abc";
519 const char *basename = BLI_path_basename(filepath);
520 const int len = strlen(basename) - (numdigit + strlen(ext));
521
523
524 dirent *fname;
525 while ((fname = readdir(dir)) != nullptr) {
526 /* do we have the right extension? */
527 if (!strstr(fname->d_name, ext)) {
528 continue;
529 }
530
531 if (!STREQLEN(basename, fname->d_name, len)) {
532 continue;
533 }
534
535 CacheFrame cache_frame{};
536
537 BLI_path_frame_get(fname->d_name, &cache_frame.framenr, &numdigit);
538
539 frames.append(cache_frame);
540 }
541
542 closedir(dir);
543
544 std::sort(frames.begin(), frames.end(), [](const CacheFrame &a, const CacheFrame &b) {
545 return a.framenr < b.framenr;
546 });
547
548 if (frames.is_empty()) {
549 return -1;
550 }
551
552 int frame_curr = frames.first().framenr;
553 (*ofs) = frame_curr;
554
555 for (CacheFrame &cache_frame : frames) {
556 if (cache_frame.framenr != frame_curr) {
557 break;
558 }
559 frame_curr++;
560 }
561
562 return frame_curr - (*ofs);
563}
564
565/* ************************************************************************** */
566
567static void ui_alembic_import_settings(const bContext *C, uiLayout *layout, PointerRNA *ptr)
568{
569 uiLayoutSetPropSep(layout, true);
570 uiLayoutSetPropDecorate(layout, false);
571
572 if (uiLayout *panel = uiLayoutPanel(C, layout, "ABC_import_general", false, IFACE_("General"))) {
573 uiLayout *col = uiLayoutColumn(panel, false);
574 uiItemR(col, ptr, "scale", UI_ITEM_NONE, nullptr, ICON_NONE);
575 }
576
577 if (uiLayout *panel = uiLayoutPanel(C, layout, "ABC_import_options", false, IFACE_("Options"))) {
578 uiLayout *col = uiLayoutColumn(panel, false);
579 uiItemR(col, ptr, "relative_path", UI_ITEM_NONE, nullptr, ICON_NONE);
580 uiItemR(col, ptr, "set_frame_range", UI_ITEM_NONE, nullptr, ICON_NONE);
581 uiItemR(col, ptr, "is_sequence", UI_ITEM_NONE, nullptr, ICON_NONE);
582 uiItemR(col, ptr, "validate_meshes", UI_ITEM_NONE, nullptr, ICON_NONE);
583 uiItemR(col, ptr, "always_add_cache_reader", UI_ITEM_NONE, nullptr, ICON_NONE);
584 }
585}
586
587static void wm_alembic_import_draw(bContext *C, wmOperator *op)
588{
589 ui_alembic_import_settings(C, op->layout, op->ptr);
590}
591
592/* op->invoke, opens fileselect if path property not set, otherwise executes */
593static int wm_alembic_import_invoke(bContext *C, wmOperator *op, const wmEvent *event)
594{
595 if (!RNA_struct_property_is_set(op->ptr, "as_background_job")) {
596 RNA_boolean_set(op->ptr, "as_background_job", true);
597 }
599}
600
601static int wm_alembic_import_exec(bContext *C, wmOperator *op)
602{
604 if (paths.is_empty()) {
605 BKE_report(op->reports, RPT_ERROR, "No filepath given");
606 return OPERATOR_CANCELLED;
607 }
608
609 const float scale = RNA_float_get(op->ptr, "scale");
610 const bool is_sequence = RNA_boolean_get(op->ptr, "is_sequence");
611 const bool set_frame_range = RNA_boolean_get(op->ptr, "set_frame_range");
612 const bool validate_meshes = RNA_boolean_get(op->ptr, "validate_meshes");
613 const bool always_add_cache_reader = RNA_boolean_get(op->ptr, "always_add_cache_reader");
614 const bool as_background_job = RNA_boolean_get(op->ptr, "as_background_job");
615
616 int sequence_min_frame = std::numeric_limits<int>::max();
617 int sequence_max_frame = std::numeric_limits<int>::min();
618
619 if (is_sequence) {
620 for (const std::string &path : paths) {
621 int offset = 0;
622 int sequence_len = get_sequence_len(path.c_str(), &offset);
623 if (sequence_len < 0) {
624 BKE_report(op->reports, RPT_ERROR, "Unable to determine ABC sequence length");
625 return OPERATOR_CANCELLED;
626 }
627 sequence_min_frame = std::min(sequence_min_frame, offset);
628 sequence_max_frame = std::max(sequence_max_frame, offset + (sequence_len - 1));
629 }
630 }
631
632 /* Switch out of edit mode to avoid being stuck in it (#54326). */
633 Object *obedit = CTX_data_edit_object(C);
634 if (obedit) {
636 }
637
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;
644 params.set_frame_range = set_frame_range;
645 params.validate_meshes = validate_meshes;
646 params.always_add_cache_reader = always_add_cache_reader;
647
648 bool ok = ABC_import(C, &params, as_background_job);
649
650 return as_background_job || ok ? OPERATOR_FINISHED : OPERATOR_CANCELLED;
651}
652
654{
655 ot->name = "Import Alembic";
656 ot->description = "Load an Alembic archive";
657 ot->idname = "WM_OT_alembic_import";
659
660 ot->invoke = wm_alembic_import_invoke;
661 ot->exec = wm_alembic_import_exec;
663 ot->ui = wm_alembic_import_draw;
664
673
674 PropertyRNA *prop = RNA_def_string(ot->srna, "filter_glob", "*.abc", 0, "", "");
676
678 ot->srna,
679 "scale",
680 1.0f,
681 0.0001f,
682 1000.0f,
683 "Scale",
684 "Value by which to enlarge or shrink the objects with respect to the world's origin",
685 0.0001f,
686 1000.0f);
687
689 ot->srna,
690 "set_frame_range",
691 true,
692 "Set Frame Range",
693 "If checked, update scene's start and end frame to match those of the Alembic archive");
694
696 ot->srna,
697 "validate_meshes",
698 false,
699 "Validate Meshes",
700 "Ensure the data is valid "
701 "(when disabled, data may be imported which causes crashes displaying or editing)");
702
704 "always_add_cache_reader",
705 false,
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");
709
711 "is_sequence",
712 false,
713 "Is Sequence",
714 "Set to true if the cache is split into separate files");
715
717 ot->srna,
718 "as_background_job",
719 false,
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");
724}
725
726namespace blender::ed::io {
728{
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");
733 STRNCPY(fh->label, "Alembic");
734 STRNCPY(fh->file_extensions_str, ".abc");
735 fh->poll_drop = poll_file_object_drop;
736 bke::file_handler_add(std::move(fh));
737}
738} // namespace blender::ed::io
739
740#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:837
void BKE_report(ReportList *reports, eReportType type, const char *message)
Definition report.cc:125
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(dst, src)
Definition BLI_string.h:593
#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 IFACE_(msgid)
eEvaluationMode
@ DAG_EVAL_RENDER
@ DAG_EVAL_VIEWPORT
#define MAX_IDPROP_NAME
Definition DNA_ID.h:185
@ 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_RUNNING_MODAL
void ED_fileselect_ensure_default_filepath(bContext *C, wmOperator *op, const char *extension)
Definition filesel.cc:1466
Read Guarded memory(de)allocation.
@ PROP_HIDDEN
Definition RNA_types.hh:239
void uiLayoutSetActive(uiLayout *layout, bool active)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiItemS(uiLayout *layout)
#define UI_ITEM_NONE
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)
@ UI_ITEM_R_SLIDER
@ WM_FILESEL_FILES
Definition WM_api.hh:937
@ WM_FILESEL_DIRECTORY
Definition WM_api.hh:934
@ WM_FILESEL_RELPATH
Definition WM_api.hh:933
@ WM_FILESEL_SHOW_PROPS
Definition WM_api.hh:939
@ WM_FILESEL_FILEPATH
Definition WM_api.hh:936
@ FILE_OPENFILE
Definition WM_api.hh:945
@ FILE_SAVE
Definition WM_api.hh:946
@ OPTYPE_PRESET
Definition WM_types.hh:175
@ OPTYPE_UNDO
Definition WM_types.hh:162
static void set_frame_range(ImportJobData *data)
local_group_size(16, 16) .push_constant(Type b
int len
uint col
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
void WM_OT_alembic_import(wmOperatorType *ot)
void WM_OT_alembic_export(wmOperatorType *ot)
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:57
Vector< std::string > paths_from_operator_properties(PointerRNA *ptr)
Definition io_utils.cc:74
int filesel_drop_import_invoke(bContext *C, wmOperator *op, const wmEvent *)
Definition io_utils.cc:25
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[]
char * d_name
const char * name
Definition WM_types.hh:990
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1042
const char * idname
Definition WM_types.hh:992
bool(* check)(bContext *C, wmOperator *op)
Definition WM_types.hh:1014
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1022
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
Definition WM_types.hh:1006
const char * description
Definition WM_types.hh:996
void(* ui)(bContext *C, wmOperator *op)
Definition WM_types.hh:1053
StructRNA * srna
Definition WM_types.hh:1080
struct ReportList * reports
struct uiLayout * layout
struct PointerRNA * ptr
void WM_event_add_fileselect(bContext *C, wmOperator *op)
PointerRNA * ptr
Definition wm_files.cc:4126
wmOperatorType * ot
Definition wm_files.cc:4125
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)