45 if (blendfile_path[0] ==
'\0') {
46 BLI_strncpy(filepath,
"untitled",
sizeof(filepath));
49 BLI_strncpy(filepath, blendfile_path,
sizeof(filepath));
68 int apply_global_orientation;
72 int include_armatures;
73 int include_shapekeys;
74 int deform_bones_only;
76 int include_animations;
77 int include_all_actions;
79 int keep_smooth_curves;
83 int export_animation_type;
84 int use_texture_copies;
88 int use_object_instantiation;
89 int use_blender_profile;
91 int export_object_transformation_type;
92 int export_animation_transformation_type;
99 int sample_animations;
114 fprintf(stdout,
"Collada export: Can not create: %s\n", filepath);
120 fprintf(stdout,
"Collada export: Can not modify: %s\n", filepath);
128 export_mesh_type =
RNA_enum_get(op->
ptr,
"export_mesh_type_selection");
129 global_forward =
RNA_enum_get(op->
ptr,
"export_global_forward_selection");
140 export_animation_type =
RNA_enum_get(op->
ptr,
"export_animation_type_selection");
142 sampling_rate = (sample_animations) ?
RNA_int_get(op->
ptr,
"sampling_rate") : 0;
158 "export_object_transformation_type_selection");
160 op->
ptr,
"export_animation_transformation_type_selection");
175 export_settings.
filepath = filepath;
183 export_settings.
selected = selected != 0;
191 export_settings.
keep_keyframes = keep_keyframes != 0 || sampling_rate < 1;
216 if (include_animations) {
220 export_settings.
open_sim = open_sim != 0;
226 if (export_count == 0) {
230 if (export_count < 0) {
236 sprintf(buff,
"Exported %d Objects", export_count);
244 bool include_animations =
RNA_boolean_get(imfptr,
"include_animations");
245 int ui_section =
RNA_enum_get(imfptr,
"prop_bc_export_ui_section");
248 "export_animation_type_selection");
251 imfptr,
"export_animation_transformation_type_selection");
269 uiItemR(sub, imfptr,
"include_children", 0,
NULL, ICON_NONE);
270 uiItemR(sub, imfptr,
"include_armatures", 0,
NULL, ICON_NONE);
271 uiItemR(sub, imfptr,
"include_shapekeys", 0,
NULL, ICON_NONE);
275 uiItemL(row,
IFACE_(
"Global Orientation"), ICON_ORIENTATION_GLOBAL);
277 uiItemR(box, imfptr,
"apply_global_orientation", 0,
IFACE_(
"Apply"), ICON_NONE);
282 "export_global_forward_selection",
297 uiItemR(row, imfptr,
"active_uv_only", 0,
IFACE_(
"Only Selected Map"), ICON_NONE);
308 uiItemR(row, imfptr,
"apply_modifiers", 0,
"", ICON_NONE);
311 uiItemR(sub, imfptr,
"export_mesh_type_selection", 0,
"", ICON_NONE);
314 uiItemR(
col, imfptr,
"export_animation_transformation_type_selection", 0,
NULL, ICON_NONE);
317 uiItemR(
col, imfptr,
"export_object_transformation_type_selection", 0,
NULL, ICON_NONE);
323 uiItemL(box,
IFACE_(
"Armature Options"), ICON_ARMATURE_DATA);
332 uiItemR(box, imfptr,
"include_animations", 0,
NULL, ICON_NONE);
341 uiItemR(box, imfptr,
"export_animation_transformation_type_selection", 0,
NULL, ICON_NONE);
344 uiItemR(box, imfptr,
"export_object_transformation_type_selection", 0,
NULL, ICON_NONE);
349 include_animations &&
352 uiItemR(row, imfptr,
"keep_smooth_curves", 0,
NULL, ICON_NONE);
356 uiItemR(sub, imfptr,
"sampling_rate", 0,
NULL, ICON_NONE);
357 uiItemR(sub, imfptr,
"keep_keyframes", 0,
NULL, ICON_NONE);
361 uiItemR(sub, imfptr,
"keep_flat_curves", 0,
NULL, ICON_NONE);
362 uiItemR(sub, imfptr,
"include_all_actions", 0,
NULL, ICON_NONE);
371 uiItemR(
col, imfptr,
"use_object_instantiation", 1,
NULL, ICON_NONE);
381 uiCollada_exportSettings(op->
layout, op->
ptr);
403 {
BC_MESH_TYPE_VIEW,
"view", 0,
"Viewport",
"Apply modifier's viewport settings"},
433 "Use <matrix> representation for exported transformations"},
438 "Use <rotate>, <translate> and <scale> representation for exported transformations"},
446 "Export Sampled points guided by sampling rate"},
451 "Export Curves (note: guided by curve keys)"},
462 ot->
name =
"Export COLLADA";
464 ot->
idname =
"WM_OT_collada_export";
466 ot->
invoke = wm_collada_export_invoke;
467 ot->
exec = wm_collada_export_exec;
469 ot->
check = wm_collada_export_check;
473 ot->
ui = wm_collada_export_draw;
487 "prop_bc_export_ui_section",
488 prop_bc_export_ui_section,
491 "Only for User Interface organization");
497 "Apply modifiers to exported mesh (non destructive))");
505 "Modifier resolution for export",
510 "export_mesh_type_selection",
511 prop_bc_export_mesh_type,
514 "Modifier resolution for export");
517 "export_global_forward_selection",
518 prop_bc_export_global_forward,
520 "Global Forward Axis",
521 "Global Forward axis for export");
524 "export_global_up_selection",
525 prop_bc_export_global_up,
528 "Global Up axis for export");
531 "apply_global_orientation",
533 "Apply Global Orientation",
534 "Rotate all root objects to match the global orientation settings "
535 "otherwise set the global orientation per Collada asset");
537 RNA_def_boolean(func,
"selected",
false,
"Selection Only",
"Export only selected elements");
543 "Export all children of selected objects (even if not selected)");
549 "Export related armatures (even if not selected)");
554 "Include Shape Keys",
555 "Export all Shape Keys from Mesh Objects");
561 "Only export deforming bones with armatures");
565 "include_animations",
567 "Include Animations",
568 "Export animations if available (exporting animations will enforce the decomposition of "
569 "node transforms into <translation> <rotation> and <scale> components)");
572 "include_all_actions",
574 "Include all Actions",
575 "Export also unassigned actions (this allows you to export entire animation "
576 "libraries for your character(s))");
579 "export_animation_type_selection",
580 prop_bc_export_animation_type,
583 "Type for exported animations (use sample keys or Curve keys)");
591 "The distance between 2 keyframes (1 to key every frame)",
596 "keep_smooth_curves",
598 "Keep Smooth curves",
599 "Export also the curve handles (if available) (this does only work when the "
600 "inverse parent matrix "
601 "is the unity matrix, otherwise you may end up with odd results)");
607 "Use existing keyframes as additional sample points (this helps when you want "
608 "to keep manual tweaks)");
614 "Export also curves which have only one key or are totally flat");
617 func,
"active_uv_only", 0,
"Only Selected UV Map",
"Export only the selected UV Map");
620 "use_texture_copies",
623 "Copy textures to same folder where the .dae file is exported");
626 func,
"triangulate", 1,
"Triangulate",
"Export polygons (quads and n-gons) as triangles");
629 "use_object_instantiation",
631 "Use Object Instances",
632 "Instantiate multiple Objects from same Data");
636 "use_blender_profile",
638 "Use Blender Profile",
639 "Export additional Blender specific information (for material, shaders, bones, etc.)");
642 func,
"sort_by_name", 0,
"Sort by Object name",
"Sort exported data by Object name");
645 "export_object_transformation_type",
650 "Object Transformation type for translation, scale and rotation",
655 "export_object_transformation_type_selection",
656 prop_bc_export_transformation_type,
659 "Object Transformation type for translation, scale and rotation");
662 "export_animation_transformation_type",
667 "Transformation type for translation, scale and rotation. "
668 "Note: The Animation transformation type in the Anim Tab "
669 "is always equal to the Object transformation type in the Geom tab",
674 "export_animation_transformation_type_selection",
675 prop_bc_export_transformation_type,
678 "Transformation type for translation, scale and rotation. "
679 "Note: The Animation transformation type in the Anim Tab "
680 "is always equal to the Object transformation type in the Geom tab");
685 "Export to SL/OpenSim",
686 "Compatibility mode for SL, OpenSim and other compatible online worlds");
692 "Reduce the precision of the exported data to 6 digits");
699 "Store Bindpose information in custom bone properties for later use during Collada export");
710 int min_chain_length;
732 import_settings.
filepath = filename;
760 uiItemR(box, imfptr,
"import_units", 0,
NULL, ICON_NONE);
763 uiItemL(box,
IFACE_(
"Armature Options"), ICON_ARMATURE_DATA);
773 uiItemR(box, imfptr,
"keep_bind_info", 0,
NULL, ICON_NONE);
778 uiCollada_importSettings(op->
layout, op->
ptr);
783 ot->
name =
"Import COLLADA";
785 ot->
idname =
"WM_OT_collada_import";
789 ot->
exec = wm_collada_import_exec;
794 ot->
ui = wm_collada_import_draw;
811 "If disabled match import to Blender's current Unit settings, "
812 "otherwise use the settings from the Imported scene");
818 "Fix Orientation of Leaf Bones (Collada does only support Joints)");
824 "Find best matching Bone Chains and ensure bones in chain are connected");
830 "Set use_connect for parent bones which have exactly one child bone");
837 "Minimum Chain Length",
838 "When searching Bone Chains disregard chains of length below this value",
847 "Store Bindpose information in custom bone properties for later use during Collada export");
struct Scene * CTX_data_scene(const bContext *C)
struct Object * CTX_data_edit_object(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
const char * BKE_main_blendfile_path(const struct Main *bmain) ATTR_NONNULL()
General operations, lookup, etc. for blender objects.
void BKE_report(ReportList *reports, eReportType type, const char *message)
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_touch(const char *file) ATTR_NONNULL()
bool BLI_make_existing_file(const char *name)
bool BLI_path_extension_ensure(char *path, size_t maxlen, const char *ext) ATTR_NONNULL()
bool BLI_path_extension_replace(char *path, size_t maxlen, const char *ext) ATTR_NONNULL()
bool BLI_path_extension_check(const char *str, const char *ext) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
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(struct ID *id, int flag)
bool ED_object_editmode_load(struct Main *bmain, struct Object *obedit)
@ BC_ANIMATION_EXPORT_KEYS
@ BC_ANIMATION_EXPORT_SAMPLES
@ BC_UI_SECTION_ANIMATION
BC_export_transformation_type
@ BC_TRANSFORMATION_TYPE_MATRIX
@ BC_TRANSFORMATION_TYPE_DECOMPOSED
uiLayout * uiLayoutRowWithHeading(uiLayout *layout, bool align, const char *heading)
void uiLayoutSetActive(uiLayout *layout, bool active)
void uiLayoutSetEnabled(uiLayout *layout, bool enabled)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiItemL(uiLayout *layout, const char *name, int icon)
uiLayout * uiLayoutBox(uiLayout *layout)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
uiLayout * uiLayoutRow(uiLayout *layout, bool align)
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
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(struct wmOperatorType *ot)
void WM_OT_collada_export(struct wmOperatorType *ot)
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_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, 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, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
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
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
void(* ui)(struct bContext *, struct wmOperator *)
bool(* check)(struct bContext *, struct wmOperator *)
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
void WM_event_add_fileselect(bContext *C, wmOperator *op)
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)
int WM_operator_filesel(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))