61 if (blendfile_path[0] ==
'\0') {
62 BLI_strncpy(filepath,
"untitled",
sizeof(filepath));
65 BLI_strncpy(filepath, blendfile_path,
sizeof(filepath));
84 int apply_global_orientation;
88 int include_armatures;
89 int include_shapekeys;
90 int deform_bones_only;
92 int include_animations;
93 int include_all_actions;
95 int keep_smooth_curves;
99 int export_animation_type;
100 int use_texture_copies;
104 int use_object_instantiation;
105 int use_blender_profile;
107 int export_object_transformation_type;
108 int export_animation_transformation_type;
115 int sample_animations;
130 fprintf(stdout,
"Collada export: Can not create: %s\n", filepath);
136 fprintf(stdout,
"Collada export: Can not modify: %s\n", filepath);
144 export_mesh_type =
RNA_enum_get(op->
ptr,
"export_mesh_type_selection");
145 global_forward =
RNA_enum_get(op->
ptr,
"export_global_forward_selection");
156 export_animation_type =
RNA_enum_get(op->
ptr,
"export_animation_type_selection");
158 sampling_rate = (sample_animations) ?
RNA_int_get(op->
ptr,
"sampling_rate") : 0;
174 "export_object_transformation_type_selection");
176 op->
ptr,
"export_animation_transformation_type_selection");
191 export_settings.
filepath = filepath;
199 export_settings.
selected = selected != 0;
207 export_settings.
keep_keyframes = keep_keyframes != 0 || sampling_rate < 1;
232 if (include_animations) {
236 export_settings.
open_sim = open_sim != 0;
250 if (export_count == 0) {
254 if (export_count < 0) {
260 sprintf(buff,
"Exported %d Objects", export_count);
268 bool include_animations =
RNA_boolean_get(imfptr,
"include_animations");
269 int ui_section =
RNA_enum_get(imfptr,
"prop_bc_export_ui_section");
272 "export_animation_type_selection");
275 imfptr,
"export_animation_transformation_type_selection");
293 uiItemR(sub, imfptr,
"include_children", 0,
NULL, ICON_NONE);
294 uiItemR(sub, imfptr,
"include_armatures", 0,
NULL, ICON_NONE);
295 uiItemR(sub, imfptr,
"include_shapekeys", 0,
NULL, ICON_NONE);
299 uiItemL(row,
IFACE_(
"Global Orientation"), ICON_ORIENTATION_GLOBAL);
301 uiItemR(box, imfptr,
"apply_global_orientation", 0,
IFACE_(
"Apply"), ICON_NONE);
306 "export_global_forward_selection",
321 uiItemR(row, imfptr,
"active_uv_only", 0,
IFACE_(
"Only Selected Map"), ICON_NONE);
332 uiItemR(row, imfptr,
"apply_modifiers", 0,
"", ICON_NONE);
335 uiItemR(sub, imfptr,
"export_mesh_type_selection", 0,
"", ICON_NONE);
338 uiItemR(
col, imfptr,
"export_animation_transformation_type_selection", 0,
NULL, ICON_NONE);
341 uiItemR(
col, imfptr,
"export_object_transformation_type_selection", 0,
NULL, ICON_NONE);
347 uiItemL(box,
IFACE_(
"Armature Options"), ICON_ARMATURE_DATA);
356 uiItemR(box, imfptr,
"include_animations", 0,
NULL, ICON_NONE);
365 uiItemR(box, imfptr,
"export_animation_transformation_type_selection", 0,
NULL, ICON_NONE);
368 uiItemR(box, imfptr,
"export_object_transformation_type_selection", 0,
NULL, ICON_NONE);
373 include_animations &&
376 uiItemR(row, imfptr,
"keep_smooth_curves", 0,
NULL, ICON_NONE);
380 uiItemR(sub, imfptr,
"sampling_rate", 0,
NULL, ICON_NONE);
381 uiItemR(sub, imfptr,
"keep_keyframes", 0,
NULL, ICON_NONE);
385 uiItemR(sub, imfptr,
"keep_flat_curves", 0,
NULL, ICON_NONE);
386 uiItemR(sub, imfptr,
"include_all_actions", 0,
NULL, ICON_NONE);
395 uiItemR(
col, imfptr,
"use_object_instantiation", 1,
NULL, ICON_NONE);
409 uiCollada_exportSettings(op->
layout, &
ptr);
431 {
BC_MESH_TYPE_VIEW,
"view", 0,
"Viewport",
"Apply modifier's viewport settings"},
461 "Use <matrix> representation for exported transformations"},
466 "Use <rotate>, <translate> and <scale> representation for exported transformations"},
474 "Export Sampled points guided by sampling rate"},
479 "Export Curves (note: guided by curve keys)"},
490 ot->
name =
"Export COLLADA";
492 ot->
idname =
"WM_OT_collada_export";
494 ot->
invoke = wm_collada_export_invoke;
495 ot->
exec = wm_collada_export_exec;
497 ot->
check = wm_collada_export_check;
501 ot->
ui = wm_collada_export_draw;
512 "prop_bc_export_ui_section",
513 prop_bc_export_ui_section,
516 "Only for User Interface organization");
522 "Apply modifiers to exported mesh (non destructive))");
530 "Modifier resolution for export",
535 "export_mesh_type_selection",
536 prop_bc_export_mesh_type,
539 "Modifier resolution for export");
542 "export_global_forward_selection",
543 prop_bc_export_global_forward,
545 "Global Forward Axis",
546 "Global Forward axis for export");
549 "export_global_up_selection",
550 prop_bc_export_global_up,
553 "Global Up axis for export");
556 "apply_global_orientation",
558 "Apply Global Orientation",
559 "Rotate all root objects to match the global orientation settings "
560 "otherwise set the global orientation per Collada asset");
562 RNA_def_boolean(func,
"selected",
false,
"Selection Only",
"Export only selected elements");
568 "Export all children of selected objects (even if not selected)");
574 "Export related armatures (even if not selected)");
579 "Include Shape Keys",
580 "Export all Shape Keys from Mesh Objects");
586 "Only export deforming bones with armatures");
590 "include_animations",
592 "Include Animations",
593 "Export animations if available (exporting animations will enforce the decomposition of "
594 "node transforms into <translation> <rotation> and <scale> components)");
597 "include_all_actions",
599 "Include all Actions",
600 "Export also unassigned actions (this allows you to export entire animation "
601 "libraries for your character(s))");
604 "export_animation_type_selection",
605 prop_bc_export_animation_type,
608 "Type for exported animations (use sample keys or Curve keys)");
616 "The distance between 2 keyframes (1 to key every frame)",
621 "keep_smooth_curves",
623 "Keep Smooth curves",
624 "Export also the curve handles (if available) (this does only work when the "
625 "inverse parent matrix "
626 "is the unity matrix, otherwise you may end up with odd results)");
632 "Use existing keyframes as additional sample points (this helps when you want "
633 "to keep manual tweaks)");
639 "Export also curves which have only one key or are totally flat");
642 func,
"active_uv_only", 0,
"Only Selected UV Map",
"Export only the selected UV Map");
645 "use_texture_copies",
648 "Copy textures to same folder where the .dae file is exported");
651 func,
"triangulate", 1,
"Triangulate",
"Export polygons (quads and n-gons) as triangles");
654 "use_object_instantiation",
656 "Use Object Instances",
657 "Instantiate multiple Objects from same Data");
661 "use_blender_profile",
663 "Use Blender Profile",
664 "Export additional Blender specific information (for material, shaders, bones, etc.)");
667 func,
"sort_by_name", 0,
"Sort by Object name",
"Sort exported data by Object name");
670 "export_object_transformation_type",
675 "Object Transformation type for translation, scale and rotation",
680 "export_object_transformation_type_selection",
681 prop_bc_export_transformation_type,
684 "Object Transformation type for translation, scale and rotation");
687 "export_animation_transformation_type",
692 "Transformation type for translation, scale and rotation. "
693 "Note: The Animation transformation type in the Anim Tab "
694 "is always equal to the Object transformation type in the Geom tab",
699 "export_animation_transformation_type_selection",
700 prop_bc_export_transformation_type,
703 "Transformation type for translation, scale and rotation. "
704 "Note: The Animation transformation type in the Anim Tab "
705 "is always equal to the Object transformation type in the Geom tab");
710 "Export to SL/OpenSim",
711 "Compatibility mode for SL, OpenSim and other compatible online worlds");
717 "Reduce the precision of the exported data to 6 digits");
724 "Store Bindpose information in custom bone properties for later use during Collada export");
735 int min_chain_length;
757 import_settings.
filepath = filename;
785 uiItemR(box, imfptr,
"import_units", 0,
NULL, ICON_NONE);
788 uiItemL(box,
IFACE_(
"Armature Options"), ICON_ARMATURE_DATA);
798 uiItemR(box, imfptr,
"keep_bind_info", 0,
NULL, ICON_NONE);
807 uiCollada_importSettings(op->
layout, &
ptr);
812 ot->
name =
"Import COLLADA";
814 ot->
idname =
"WM_OT_collada_import";
818 ot->
exec = wm_collada_import_exec;
823 ot->
ui = wm_collada_import_draw;
837 "If disabled match import to Blender's current Unit settings, "
838 "otherwise use the settings from the Imported scene");
844 "Fix Orientation of Leaf Bones (Collada does only support Joints)");
850 "Find best matching Bone Chains and ensure bones in chain are connected");
856 "Set use_connect for parent bones which have exactly one child bone");
863 "Minimum Chain Length",
864 "When searching Bone Chains disregard chains of length below this value",
873 "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 wmWindowManager * CTX_wm_manager(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.
@ OB_REL_CHILDREN_RECURSIVE
void BKE_report(ReportList *reports, ReportType type, const char *message)
int BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BLI_file_touch(const char *file) ATTR_NONNULL()
bool BLI_file_is_writable(const char *file) ATTR_WARN_UNUSED_RESULT 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, const 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)
#define WM_FILESEL_SHOW_PROPS
#define WM_FILESEL_FILEPATH
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_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
int RNA_int_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_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
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
struct wmOperatorType * type
void WM_event_add_fileselect(bContext *C, wmOperator *op)
void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, short action, short flag, short display, short sort)
bool WM_operator_winactive(bContext *C)
int WM_operator_filesel(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))