56 int apply_global_orientation;
60 int include_armatures;
61 int include_shapekeys;
62 int deform_bones_only;
64 int include_animations;
65 int include_all_actions;
67 int keep_smooth_curves;
71 int export_animation_type;
72 int use_texture_copies;
76 int use_object_instantiation;
77 int use_blender_profile;
79 int export_object_transformation_type;
80 int export_animation_transformation_type;
87 int sample_animations;
102 fprintf(stdout,
"Collada export: Can not create: %s\n", filepath);
108 fprintf(stdout,
"Collada export: Can not modify: %s\n", filepath);
116 export_mesh_type =
RNA_enum_get(op->
ptr,
"export_mesh_type_selection");
117 global_forward =
RNA_enum_get(op->
ptr,
"export_global_forward_selection");
128 export_animation_type =
RNA_enum_get(op->
ptr,
"export_animation_type_selection");
130 sampling_rate = (sample_animations) ?
RNA_int_get(op->
ptr,
"sampling_rate") : 0;
146 "export_object_transformation_type_selection");
148 op->
ptr,
"export_animation_transformation_type_selection");
163 export_settings.
filepath = filepath;
165 export_settings.apply_modifiers = apply_modifiers != 0;
168 export_settings.apply_global_orientation = apply_global_orientation != 0;
171 export_settings.selected = selected != 0;
172 export_settings.include_children = include_children != 0;
173 export_settings.include_armatures = include_armatures != 0;
174 export_settings.include_shapekeys = include_shapekeys != 0;
175 export_settings.deform_bones_only = deform_bones_only != 0;
176 export_settings.include_animations = include_animations != 0;
177 export_settings.include_all_actions = include_all_actions != 0;
178 export_settings.sampling_rate = sampling_rate;
179 export_settings.keep_keyframes = keep_keyframes != 0 || sampling_rate < 1;
180 export_settings.keep_flat_curves = keep_flat_curves != 0;
182 export_settings.active_uv_only = active_uv_only != 0;
184 export_settings.use_texture_copies = use_texture_copies != 0;
187 export_settings.use_object_instantiation = use_object_instantiation != 0;
188 export_settings.use_blender_profile = use_blender_profile != 0;
189 export_settings.sort_by_name = sort_by_name != 0;
191 export_object_transformation_type);
193 export_animation_transformation_type);
194 export_settings.keep_smooth_curves = keep_smooth_curves != 0;
203 export_settings.keep_smooth_curves =
false;
206 if (include_animations) {
207 export_settings.object_transformation_type = export_settings.animation_transformation_type;
210 export_settings.open_sim = open_sim != 0;
211 export_settings.limit_precision = limit_precision != 0;
212 export_settings.keep_bind_info = keep_bind_info != 0;
216 if (export_count == 0) {
220 if (export_count < 0) {
226 SNPRINTF(buff,
"Exported %d Objects", export_count);
234 bool include_animations =
RNA_boolean_get(imfptr,
"include_animations");
235 int ui_section =
RNA_enum_get(imfptr,
"prop_bc_export_ui_section");
238 RNA_enum_get(imfptr,
"export_animation_type_selection"));
241 RNA_enum_get(imfptr,
"export_animation_transformation_type_selection"));
265 uiItemL(row,
IFACE_(
"Global Orientation"), ICON_ORIENTATION_GLOBAL);
270 "export_global_forward_selection",
302 "export_animation_transformation_type_selection",
310 "export_object_transformation_type_selection",
319 uiItemL(box,
IFACE_(
"Armature Options"), ICON_ARMATURE_DATA);
339 "export_animation_transformation_type_selection",
347 "export_object_transformation_type_selection",
355 include_animations &&
387 uiCollada_exportSettings(op->
layout, op->
ptr);
407 {
BC_MESH_TYPE_VIEW,
"view", 0,
"Viewport",
"Apply modifier's viewport settings"},
409 {0,
nullptr, 0,
nullptr,
nullptr},
419 {0,
nullptr, 0,
nullptr,
nullptr},
429 {0,
nullptr, 0,
nullptr,
nullptr},
437 "Use <matrix> representation for exported transformations"},
442 "Use <rotate>, <translate> and <scale> representation for exported transformations"},
443 {0,
nullptr, 0,
nullptr,
nullptr}};
450 "Export Sampled points guided by sampling rate"},
455 "Export Curves (note: guided by curve keys)"},
456 {0,
nullptr, 0,
nullptr,
nullptr}};
464 {0,
nullptr, 0,
nullptr,
nullptr}};
466 ot->
name =
"Export COLLADA (Legacy)";
468 ot->
idname =
"WM_OT_collada_export";
470 ot->
invoke = wm_collada_export_invoke;
471 ot->
exec = wm_collada_export_exec;
473 ot->
check = wm_collada_export_check;
477 ot->
ui = wm_collada_export_draw;
491 "prop_bc_export_ui_section",
492 prop_bc_export_ui_section,
495 "Only for User Interface organization");
501 "Apply modifiers to exported mesh (non destructive)");
509 "Modifier resolution for export",
514 "export_mesh_type_selection",
515 prop_bc_export_mesh_type,
518 "Modifier resolution for export");
521 "export_global_forward_selection",
522 prop_bc_export_global_forward,
524 "Global Forward Axis",
525 "Global Forward axis for export");
528 "export_global_up_selection",
529 prop_bc_export_global_up,
532 "Global Up axis for export");
535 "apply_global_orientation",
537 "Apply Global Orientation",
538 "Rotate all root objects to match the global orientation settings "
539 "otherwise set the global orientation per Collada asset");
547 "Export all children of selected objects (even if not selected)");
553 "Export related armatures (even if not selected)");
558 "Include Shape Keys",
559 "Export all Shape Keys from Mesh Objects");
565 "Only export deforming bones with armatures");
569 "include_animations",
571 "Include Animations",
572 "Export animations if available (exporting animations will enforce the decomposition of "
573 "node transforms into <translation> <rotation> and <scale> components)");
576 "include_all_actions",
578 "Include all Actions",
579 "Export also unassigned actions (this allows you to export entire animation "
580 "libraries for your character(s))");
583 "export_animation_type_selection",
584 prop_bc_export_animation_type,
587 "Type for exported animations (use sample keys or Curve keys)");
595 "The distance between 2 keyframes (1 to key every frame)",
600 "keep_smooth_curves",
602 "Keep Smooth curves",
603 "Export also the curve handles (if available) (this does only work when the "
604 "inverse parent matrix "
605 "is the unity matrix, otherwise you may end up with odd results)");
611 "Use existing keyframes as additional sample points (this helps when you want "
612 "to keep manual tweaks)");
618 "Export also curves which have only one key or are totally flat");
623 "Only Selected UV Map",
624 "Export only the selected UV Map");
627 "use_texture_copies",
630 "Copy textures to same folder where the .dae file is exported");
636 "Export polygons (quads and n-gons) as triangles");
639 "use_object_instantiation",
641 "Use Object Instances",
642 "Instantiate multiple Objects from same Data");
646 "use_blender_profile",
648 "Use Blender Profile",
649 "Export additional Blender specific information (for material, shaders, bones, etc.)");
652 ot->
srna,
"sort_by_name",
false,
"Sort by Object name",
"Sort exported data by Object name");
655 "export_object_transformation_type",
660 "Object Transformation type for translation, scale and rotation",
665 "export_object_transformation_type_selection",
666 prop_bc_export_transformation_type,
669 "Object Transformation type for translation, scale and rotation");
672 "export_animation_transformation_type",
677 "Transformation type for translation, scale and rotation. "
678 "Note: The Animation transformation type in the Anim Tab "
679 "is always equal to the Object transformation type in the Geom tab",
684 "export_animation_transformation_type_selection",
685 prop_bc_export_transformation_type,
688 "Transformation type for translation, scale and rotation. "
689 "Note: The Animation transformation type in the Anim Tab "
690 "is always equal to the Object transformation type in the Geom tab");
696 "Export to SL/OpenSim",
697 "Compatibility mode for Second Life, OpenSimulator and other compatible online worlds");
703 "Reduce the precision of the exported data to 6 digits");
710 "Store Bindpose information in custom bone properties for later use during Collada export");
720 int min_chain_length;
744 import_settings.filepath = filepath;
745 import_settings.import_units = import_units != 0;
746 import_settings.custom_normals = custom_normals != 0;
747 import_settings.auto_connect = auto_connect != 0;
748 import_settings.find_chains = find_chains != 0;
749 import_settings.fix_orientation = fix_orientation != 0;
750 import_settings.min_chain_length = min_chain_length;
751 import_settings.keep_bind_info = keep_bind_info != 0;
782 uiItemL(box,
IFACE_(
"Armature Options"), ICON_ARMATURE_DATA);
797 wm_collada_import_settings(op->
layout, op->
ptr);
802 ot->
name =
"Import COLLADA (Legacy)";
804 ot->
idname =
"WM_OT_collada_import";
808 ot->
exec = wm_collada_import_exec;
811 ot->
ui = wm_collada_import_draw;
828 "If disabled match import to Blender's current Unit settings, "
829 "otherwise use the settings from the Imported scene");
835 "Import custom normals, if available (otherwise Blender will compute them)");
841 "Fix Orientation of Leaf Bones (Collada does only support Joints)");
847 "Find best matching Bone Chains and ensure bones in chain are connected");
853 "Set use_connect for parent bones which have exactly one child bone");
860 "Minimum Chain Length",
861 "When searching Bone Chains disregard chains of length below this value",
870 "Store Bindpose information in custom bone properties for later use during Collada export");
876 auto fh = std::make_unique<blender::bke::FileHandlerType>();
877 STRNCPY(fh->idname,
"IO_FH_collada");
878 STRNCPY(fh->import_operator,
"WM_OT_collada_import");
880 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)
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 STRNCPY(dst, src)
#define SNPRINTF(dst, format,...)
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)
uiLayout * uiLayoutBox(uiLayout *layout)
void uiLayoutSetEnabled(uiLayout *layout, bool enabled)
void uiItemL(uiLayout *layout, const char *name, int icon)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
uiLayout * uiLayoutRowWithHeading(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)
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()
int 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(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
bool(* check)(bContext *C, wmOperator *op)
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
void(* ui)(bContext *C, wmOperator *op)
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)