58 int apply_global_orientation;
62 int include_armatures;
63 int include_shapekeys;
64 int deform_bones_only;
66 int include_animations;
67 int include_all_actions;
69 int keep_smooth_curves;
73 int export_animation_type;
74 int use_texture_copies;
78 int use_object_instantiation;
79 int use_blender_profile;
81 int export_object_transformation_type;
82 int export_animation_transformation_type;
89 int sample_animations;
104 fprintf(stdout,
"Collada export: Can not create: %s\n", filepath);
110 fprintf(stdout,
"Collada export: Can not modify: %s\n", filepath);
118 export_mesh_type =
RNA_enum_get(op->
ptr,
"export_mesh_type_selection");
119 global_forward =
RNA_enum_get(op->
ptr,
"export_global_forward_selection");
130 export_animation_type =
RNA_enum_get(op->
ptr,
"export_animation_type_selection");
132 sampling_rate = (sample_animations) ?
RNA_int_get(op->
ptr,
"sampling_rate") : 0;
148 "export_object_transformation_type_selection");
150 op->
ptr,
"export_animation_transformation_type_selection");
165 export_settings.
filepath = filepath;
173 export_settings.
selected = selected != 0;
181 export_settings.
keep_keyframes = keep_keyframes != 0 || sampling_rate < 1;
193 export_object_transformation_type);
195 export_animation_transformation_type);
208 if (include_animations) {
212 export_settings.
open_sim = open_sim != 0;
218 if (export_count == 0) {
222 if (export_count < 0) {
228 SNPRINTF(buff,
"Exported %d Objects", export_count);
236 bool include_animations =
RNA_boolean_get(imfptr,
"include_animations");
237 int ui_section =
RNA_enum_get(imfptr,
"prop_bc_export_ui_section");
240 RNA_enum_get(imfptr,
"export_animation_type_selection"));
243 RNA_enum_get(imfptr,
"export_animation_transformation_type_selection"));
248 row = &layout->
row(
false);
256 box = &layout->
box();
259 sub = &
col->column(
false);
261 sub->
prop(imfptr,
"include_children",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
262 sub->
prop(imfptr,
"include_armatures",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
263 sub->
prop(imfptr,
"include_shapekeys",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
265 box = &layout->
box();
266 row = &box->
row(
false);
267 row->
label(
IFACE_(
"Global Orientation"), ICON_ORIENTATION_GLOBAL);
271 "export_global_forward_selection",
278 box = &layout->
box();
279 box->
label(
IFACE_(
"Texture Options"), ICON_TEXTURE_DATA);
282 col->prop(imfptr,
"use_texture_copies",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
287 box = &layout->
box();
288 box->
label(
IFACE_(
"Export Data Options"), ICON_MESH_DATA);
292 col->prop(imfptr,
"triangulate",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
294 row = &
col->row(
true,
IFACE_(
"Apply Modifiers"));
296 sub = &row->
column(
false);
298 sub->
prop(imfptr,
"export_mesh_type_selection",
UI_ITEM_NONE,
"", ICON_NONE);
302 "export_animation_transformation_type_selection",
309 "export_object_transformation_type_selection",
317 box = &layout->
box();
318 box->
label(
IFACE_(
"Armature Options"), ICON_ARMATURE_DATA);
321 col->prop(imfptr,
"deform_bones_only",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
326 box = &layout->
box();
327 box->
prop(imfptr,
"include_animations",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
330 row = &
col->row(
false);
333 imfptr,
"export_animation_type_selection",
UI_ITEM_R_EXPAND, std::nullopt, ICON_NONE);
338 "export_animation_transformation_type_selection",
345 "export_object_transformation_type_selection",
351 row = &
col->column(
false);
353 include_animations &&
356 row->
prop(imfptr,
"keep_smooth_curves",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
358 sub = &
col->column(
false);
363 sub = &
col->column(
false);
365 sub->
prop(imfptr,
"keep_flat_curves",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
366 sub->
prop(imfptr,
"include_all_actions",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
370 box = &layout->
box();
371 row = &box->
row(
false);
372 row->
label(
IFACE_(
"Collada Options"), ICON_MODIFIER);
375 col->prop(imfptr,
"use_object_instantiation",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
376 col->prop(imfptr,
"use_blender_profile",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
377 col->prop(imfptr,
"sort_by_name",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
378 col->prop(imfptr,
"keep_bind_info",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
379 col->prop(imfptr,
"limit_precision",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
385 uiCollada_exportSettings(op->
layout, op->
ptr);
405 {
BC_MESH_TYPE_VIEW,
"view", 0,
"Viewport",
"Apply modifier's viewport settings"},
407 {0,
nullptr, 0,
nullptr,
nullptr},
417 {0,
nullptr, 0,
nullptr,
nullptr},
427 {0,
nullptr, 0,
nullptr,
nullptr},
435 "Use <matrix> representation for exported transformations"},
440 "Use <rotate>, <translate> and <scale> representation for exported transformations"},
441 {0,
nullptr, 0,
nullptr,
nullptr}};
448 "Export Sampled points guided by sampling rate"},
453 "Export Curves (note: guided by curve keys)"},
454 {0,
nullptr, 0,
nullptr,
nullptr}};
462 {0,
nullptr, 0,
nullptr,
nullptr}};
464 ot->name =
"Export COLLADA (Legacy)";
465 ot->description =
"Save a Collada file (Deprecated)";
466 ot->idname =
"WM_OT_collada_export";
468 ot->invoke = wm_collada_export_invoke;
469 ot->exec = wm_collada_export_exec;
471 ot->check = wm_collada_export_check;
475 ot->ui = wm_collada_export_draw;
489 "prop_bc_export_ui_section",
490 prop_bc_export_ui_section,
493 "Only for User Interface organization");
499 "Apply modifiers to exported mesh (non destructive)");
507 "Modifier resolution for export",
512 "export_mesh_type_selection",
513 prop_bc_export_mesh_type,
516 "Modifier resolution for export");
519 "export_global_forward_selection",
520 prop_bc_export_global_forward,
522 "Global Forward Axis",
523 "Global Forward axis for export");
526 "export_global_up_selection",
527 prop_bc_export_global_up,
530 "Global Up axis for export");
533 "apply_global_orientation",
535 "Apply Global Orientation",
536 "Rotate all root objects to match the global orientation settings "
537 "otherwise set the global orientation per Collada asset");
539 RNA_def_boolean(
ot->srna,
"selected",
false,
"Selection Only",
"Export only selected elements");
545 "Export all children of selected objects (even if not selected)");
551 "Export related armatures (even if not selected)");
556 "Include Shape Keys",
557 "Export all Shape Keys from Mesh Objects");
563 "Only export deforming bones with armatures");
567 "include_animations",
569 "Include Animations",
570 "Export animations if available (exporting animations will enforce the decomposition of "
571 "node transforms into <translation> <rotation> and <scale> components)");
574 "include_all_actions",
576 "Include all Actions",
577 "Export also unassigned actions (this allows you to export entire animation "
578 "libraries for your character(s))");
581 "export_animation_type_selection",
582 prop_bc_export_animation_type,
585 "Type for exported animations (use sample keys or Curve keys)");
593 "The distance between 2 keyframes (1 to key every frame)",
598 "keep_smooth_curves",
600 "Keep Smooth curves",
601 "Export also the curve handles (if available) (this does only work when the "
602 "inverse parent matrix "
603 "is the unity matrix, otherwise you may end up with odd results)");
609 "Use existing keyframes as additional sample points (this helps when you want "
610 "to keep manual tweaks)");
616 "Export also curves which have only one key or are totally flat");
621 "Only Selected UV Map",
622 "Export only the selected UV Map");
625 "use_texture_copies",
628 "Copy textures to same folder where the .dae file is exported");
634 "Export polygons (quads and n-gons) as triangles");
637 "use_object_instantiation",
639 "Use Object Instances",
640 "Instantiate multiple Objects from same Data");
644 "use_blender_profile",
646 "Use Blender Profile",
647 "Export additional Blender specific information (for material, shaders, bones, etc.)");
650 ot->srna,
"sort_by_name",
false,
"Sort by Object name",
"Sort exported data by Object name");
653 "export_object_transformation_type",
658 "Object Transformation type for translation, scale and rotation",
663 "export_object_transformation_type_selection",
664 prop_bc_export_transformation_type,
667 "Object Transformation type for translation, scale and rotation");
670 "export_animation_transformation_type",
675 "Transformation type for translation, scale and rotation. "
676 "Note: The Animation transformation type in the Anim Tab "
677 "is always equal to the Object transformation type in the Geom tab",
682 "export_animation_transformation_type_selection",
683 prop_bc_export_transformation_type,
686 "Transformation type for translation, scale and rotation. "
687 "Note: The Animation transformation type in the Anim Tab "
688 "is always equal to the Object transformation type in the Geom tab");
694 "Export to SL/OpenSim",
695 "Compatibility mode for Second Life, OpenSimulator and other compatible online worlds");
701 "Reduce the precision of the exported data to 6 digits");
708 "Store Bindpose information in custom bone properties for later use during Collada export");
718 int min_chain_length;
742 import_settings.
filepath = filepath;
773 box = &layout->
box();
774 box->
label(
IFACE_(
"Import Data Options"), ICON_MESH_DATA);
779 box = &layout->
box();
780 box->
label(
IFACE_(
"Armature Options"), ICON_ARMATURE_DATA);
783 col->prop(imfptr,
"fix_orientation",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
784 col->prop(imfptr,
"find_chains",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
785 col->prop(imfptr,
"auto_connect",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
786 col->prop(imfptr,
"min_chain_length",
UI_ITEM_NONE, std::nullopt, ICON_NONE);
788 box = &layout->
box();
795 wm_collada_import_settings(op->
layout, op->
ptr);
800 ot->name =
"Import COLLADA (Legacy)";
801 ot->description =
"Load a Collada file (Deprecated)";
802 ot->idname =
"WM_OT_collada_import";
806 ot->exec = wm_collada_import_exec;
809 ot->ui = wm_collada_import_draw;
826 "If disabled match import to Blender's current Unit settings, "
827 "otherwise use the settings from the Imported scene");
833 "Import custom normals, if available (otherwise Blender will compute them)");
839 "Fix Orientation of Leaf Bones (Collada does only support Joints)");
845 "Find best matching Bone Chains and ensure bones in chain are connected");
851 "Set use_connect for parent bones which have exactly one child bone");
858 "Minimum Chain Length",
859 "When searching Bone Chains disregard chains of length below this value",
868 "Store Bindpose information in custom bone properties for later use during Collada export");
874 auto fh = std::make_unique<blender::bke::FileHandlerType>();
875 STRNCPY(fh->idname,
"IO_FH_collada");
876 STRNCPY(fh->import_operator,
"WM_OT_collada_import");
878 STRNCPY(fh->file_extensions_str,
".dae");
Scene * CTX_data_scene(const bContext *C)
Object * CTX_data_edit_object(const bContext *C)
Main * CTX_data_main(const bContext *C)
void BKE_report(ReportList *reports, eReportType type, const char *message)
File and directory operations.
bool BLI_file_touch(const char *filepath) ATTR_NONNULL(1)
int BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BLI_file_is_writable(const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BLI_file_ensure_parent_dir_exists(const char *filepath) 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
#define SNPRINTF(dst, format,...)
char * STRNCPY(char(&dst)[N], const char *src)
static const BC_global_forward_axis BC_DEFAULT_FORWARD
static const BC_global_up_axis BC_DEFAULT_UP
@ BC_GLOBAL_FORWARD_MINUS_Z
@ BC_GLOBAL_FORWARD_MINUS_Y
@ BC_GLOBAL_FORWARD_MINUS_X
void DEG_id_tag_update(ID *id, unsigned int flags)
void ED_fileselect_ensure_default_filepath(bContext *C, wmOperator *op, const char *extension)
void ED_outliner_select_sync_from_object_tag(bContext *C)
@ BC_ANIMATION_EXPORT_KEYS
@ BC_ANIMATION_EXPORT_SAMPLES
@ BC_UI_SECTION_ANIMATION
BC_export_transformation_type
@ BC_TRANSFORMATION_TYPE_MATRIX
@ BC_TRANSFORMATION_TYPE_DECOMPOSED
void uiLayoutSetActive(uiLayout *layout, bool active)
void uiLayoutSetEnabled(uiLayout *layout, bool enabled)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
int collada_import(bContext *C, ImportSettings *import_settings)
int collada_export(bContext *C, ExportSettings *export_settings)
void WM_OT_collada_import(wmOperatorType *ot)
void WM_OT_collada_export(wmOperatorType *ot)
void file_handler_add(std::unique_ptr< FileHandlerType > file_handler)
bool poll_file_object_drop(const bContext *C, blender::bke::FileHandlerType *)
void collada_file_handler_add()
wmOperatorStatus filesel_drop_import_invoke(bContext *C, wmOperator *op, const wmEvent *)
bool editmode_load(Main *bmain, Object *obedit)
void triangulate(BMesh *bm)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
bool RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, bool use_ghost)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
int RNA_int_get(PointerRNA *ptr, const char *name)
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_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)
bool use_object_instantiation
BC_export_animation_type export_animation_type
bool apply_global_orientation
BC_global_forward_axis global_forward
BC_export_transformation_type animation_transformation_type
BC_export_transformation_type object_transformation_type
BC_export_mesh_type export_mesh_type
BC_global_up_axis global_up
void label(blender::StringRef name, int icon)
uiLayout & column(bool align)
uiLayout & row(bool align)
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_event_add_notifier(const bContext *C, uint type, void *reference)
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)