Cleanup: some more G.main removal from editor code.
[blender.git] / source / blender / editors / io / io_collada.c
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version. 
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2008 Blender Foundation.
19  * All rights reserved.
20  *
21  * 
22  * Contributor(s): Blender Foundation
23  *
24  * ***** END GPL LICENSE BLOCK *****
25  */
26
27 /** \file blender/editors/io/io_collada.c
28  *  \ingroup collada
29  */
30 #ifdef WITH_COLLADA
31 #include "DNA_scene_types.h"
32
33 #include "BLT_translation.h"
34
35 #include "BLI_blenlib.h"
36 #include "BLI_utildefines.h"
37
38 #include "BKE_context.h"
39 #include "BKE_depsgraph.h"
40 #include "BKE_global.h"
41 #include "BKE_main.h"
42 #include "BKE_report.h"
43 #include "BKE_object.h"
44
45 #include "ED_screen.h"
46 #include "ED_object.h"
47
48 #include "RNA_access.h"
49 #include "RNA_define.h"
50
51 #include "UI_interface.h"
52 #include "UI_resources.h"
53
54 #include "WM_api.h"
55 #include "WM_types.h"
56
57 #include "../../collada/collada.h"
58
59 #include "io_collada.h"
60
61 static int wm_collada_export_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
62 {       
63         if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
64                 char filepath[FILE_MAX];
65
66                 if (G.main->name[0] == 0)
67                         BLI_strncpy(filepath, "untitled", sizeof(filepath));
68                 else
69                         BLI_strncpy(filepath, G.main->name, sizeof(filepath));
70
71                 BLI_replace_extension(filepath, sizeof(filepath), ".dae");
72                 RNA_string_set(op->ptr, "filepath", filepath);
73         }
74
75         WM_event_add_fileselect(C, op);
76
77         return OPERATOR_RUNNING_MODAL;
78 }
79
80 /* function used for WM_OT_save_mainfile too */
81 static int wm_collada_export_exec(bContext *C, wmOperator *op)
82 {
83         char filepath[FILE_MAX];
84         int apply_modifiers;
85         int export_mesh_type;
86         int selected;
87         int include_children;
88         int include_armatures;
89         int include_shapekeys;
90         int deform_bones_only;
91
92         int include_animations;
93         int sample_animations;
94         int sampling_rate;
95
96         int export_texture_type;
97         int use_texture_copies;
98         int active_uv_only;
99
100         int triangulate;
101         int use_object_instantiation;
102         int use_blender_profile;
103         int sort_by_name;
104         int export_transformation_type;
105
106         int open_sim;
107         int limit_precision;
108         int keep_bind_info;
109
110         int export_count;
111
112         if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
113                 BKE_report(op->reports, RPT_ERROR, "No filename given");
114                 return OPERATOR_CANCELLED;
115         }
116
117         RNA_string_get(op->ptr, "filepath", filepath);
118         BLI_ensure_extension(filepath, sizeof(filepath), ".dae");
119
120
121         /* Avoid File write exceptions in Collada */
122         if (!BLI_exists(filepath)) {
123                 BLI_make_existing_file(filepath);
124                 if (!BLI_file_touch(filepath)) {
125                         BKE_report(op->reports, RPT_ERROR, "Can't create export file");
126                         fprintf(stdout, "Collada export: Can not create: %s\n", filepath);
127                         return OPERATOR_CANCELLED;
128                 }
129         }
130         else if (!BLI_file_is_writable(filepath)) {
131                 BKE_report(op->reports, RPT_ERROR, "Can't overwrite export file");
132                 fprintf(stdout, "Collada export: Can not modify: %s\n", filepath);
133                 return OPERATOR_CANCELLED;
134         }
135
136         /* Now the exporter can create and write the export file */
137
138         /* Options panel */
139         apply_modifiers          = RNA_boolean_get(op->ptr, "apply_modifiers");
140         export_mesh_type         = RNA_enum_get(op->ptr,    "export_mesh_type_selection");
141         selected                 = RNA_boolean_get(op->ptr, "selected");
142         include_children         = RNA_boolean_get(op->ptr, "include_children");
143         include_armatures        = RNA_boolean_get(op->ptr, "include_armatures");
144         include_shapekeys        = RNA_boolean_get(op->ptr, "include_shapekeys");
145
146         include_animations       = RNA_boolean_get(op->ptr, "include_animations");
147         sample_animations        = RNA_boolean_get(op->ptr, "sample_animations");
148         sampling_rate            = (sample_animations) ? RNA_int_get(op->ptr, "sampling_rate") : 0;
149
150         deform_bones_only        = RNA_boolean_get(op->ptr, "deform_bones_only");
151
152         export_texture_type      = RNA_enum_get(op->ptr, "export_texture_type_selection");
153         use_texture_copies       = RNA_boolean_get(op->ptr, "use_texture_copies");
154         active_uv_only           = RNA_boolean_get(op->ptr, "active_uv_only");
155
156         triangulate                = RNA_boolean_get(op->ptr, "triangulate");
157         use_object_instantiation   = RNA_boolean_get(op->ptr, "use_object_instantiation");
158         use_blender_profile        = RNA_boolean_get(op->ptr, "use_blender_profile");
159         sort_by_name               = RNA_boolean_get(op->ptr, "sort_by_name");
160         export_transformation_type = RNA_enum_get(op->ptr,    "export_transformation_type_selection");
161         open_sim                   = RNA_boolean_get(op->ptr, "open_sim");
162
163         limit_precision = RNA_boolean_get(op->ptr, "limit_precision");
164         keep_bind_info = RNA_boolean_get(op->ptr, "keep_bind_info");
165
166         Main *bmain = CTX_data_main(C);
167
168         /* get editmode results */
169         ED_object_editmode_load(bmain, CTX_data_edit_object(C));
170
171         EvaluationContext *eval_ctx = bmain->eval_ctx;
172         Scene *scene = CTX_data_scene(C);
173         ExportSettings export_settings;
174
175         export_settings.filepath = filepath;
176
177         export_settings.apply_modifiers = apply_modifiers != 0;
178         export_settings.export_mesh_type = export_mesh_type;
179         export_settings.selected = selected != 0;
180         export_settings.include_children = include_children != 0;
181         export_settings.include_armatures = include_armatures != 0;
182         export_settings.include_shapekeys = include_shapekeys != 0;
183         export_settings.deform_bones_only = deform_bones_only != 0;
184         export_settings.include_animations = include_animations;
185         export_settings.sampling_rate = sampling_rate;
186
187         export_settings.active_uv_only = active_uv_only != 0;
188         export_settings.export_texture_type = export_texture_type;
189         export_settings.use_texture_copies = use_texture_copies != 0;
190
191         export_settings.triangulate = triangulate != 0;
192         export_settings.use_object_instantiation = use_object_instantiation != 0;
193         export_settings.use_blender_profile = use_blender_profile != 0;
194         export_settings.sort_by_name = sort_by_name != 0;
195         export_settings.export_transformation_type = export_transformation_type;
196         export_settings.open_sim = open_sim != 0;
197         export_settings.limit_precision = limit_precision != 0;
198         export_settings.keep_bind_info = keep_bind_info != 0;
199
200         int includeFilter = OB_REL_NONE;
201         if (export_settings.include_armatures) includeFilter |= OB_REL_MOD_ARMATURE;
202         if (export_settings.include_children) includeFilter |= OB_REL_CHILDREN_RECURSIVE;
203
204
205         export_count = collada_export(eval_ctx,
206                 scene,
207                 &export_settings
208         );
209
210         if (export_count == 0) {
211                 BKE_report(op->reports, RPT_WARNING, "No objects selected -- Created empty export file");
212                 return OPERATOR_CANCELLED;
213         }
214         else if (export_count < 0) {
215                 BKE_report(op->reports, RPT_WARNING, "Error during export (see Console)");
216                 return OPERATOR_CANCELLED;
217         }
218         else {
219                 char buff[100];
220                 sprintf(buff, "Exported %d Objects", export_count);
221                 BKE_report(op->reports, RPT_INFO, buff);
222                 return OPERATOR_FINISHED;
223         }
224 }
225
226 static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
227 {
228         uiLayout *box, *row, *col, *split;
229         bool include_animations = RNA_boolean_get(imfptr, "include_animations");
230
231         /* Export Options: */
232         box = uiLayoutBox(layout);
233         row = uiLayoutRow(box, false);
234         uiItemL(row, IFACE_("Export Data Options:"), ICON_MESH_DATA);
235
236         row = uiLayoutRow(box, false);
237         split = uiLayoutSplit(row, 0.6f, UI_LAYOUT_ALIGN_RIGHT);
238         col   = uiLayoutColumn(split, false);
239         uiItemR(col, imfptr, "apply_modifiers", 0, NULL, ICON_NONE);
240         col   = uiLayoutColumn(split, false);
241         uiItemR(col, imfptr, "export_mesh_type_selection", 0, "", ICON_NONE);
242         uiLayoutSetEnabled(col, RNA_boolean_get(imfptr, "apply_modifiers"));
243
244         row = uiLayoutRow(box, false);
245         uiItemR(row, imfptr, "selected", 0, NULL, ICON_NONE);
246
247         row = uiLayoutRow(box, false);
248         uiItemR(row, imfptr, "include_children", 0, NULL, ICON_NONE);
249         uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected"));
250
251         row = uiLayoutRow(box, false);
252         uiItemR(row, imfptr, "include_armatures", 0, NULL, ICON_NONE);
253         uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected"));
254
255         row = uiLayoutRow(box, false);
256         uiItemR(row, imfptr, "include_shapekeys", 0, NULL, ICON_NONE);
257         uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected"));
258
259         row = uiLayoutRow(box, false);
260         uiItemR(row, imfptr, "include_animations", 0, NULL, ICON_NONE);
261         row = uiLayoutRow(box, false);
262         if (include_animations) {
263                 uiItemR(row, imfptr, "sample_animations", 0, NULL, ICON_NONE);
264                 row = uiLayoutColumn(box, false);
265                 uiItemR(row, imfptr, "sampling_rate", 0, NULL, ICON_NONE);
266                 uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "sample_animations"));
267         }
268
269         /* Texture options */
270         box = uiLayoutBox(layout);
271         row = uiLayoutRow(box, false);
272         uiItemL(row, IFACE_("Texture Options:"), ICON_TEXTURE_DATA);
273
274         row = uiLayoutRow(box, false);
275         uiItemR(row, imfptr, "active_uv_only", 0, NULL, ICON_NONE);
276
277         row = uiLayoutRow(box, false);
278         uiItemR(row, imfptr, "export_texture_type_selection", 0, "", ICON_NONE);
279
280         row = uiLayoutRow(box, false);
281         uiItemR(row, imfptr, "use_texture_copies", 1, NULL, ICON_NONE);
282
283
284         /* Armature options */
285         box = uiLayoutBox(layout);
286         row = uiLayoutRow(box, false);
287         uiItemL(row, IFACE_("Armature Options:"), ICON_ARMATURE_DATA);
288
289         row = uiLayoutRow(box, false);
290         uiItemR(row, imfptr, "deform_bones_only", 0, NULL, ICON_NONE);
291
292         row = uiLayoutRow(box, false);
293         uiItemR(row, imfptr, "open_sim", 0, NULL, ICON_NONE);
294
295         /* Collada options: */
296         box = uiLayoutBox(layout);
297         row = uiLayoutRow(box, false);
298         uiItemL(row, IFACE_("Collada Options:"), ICON_MODIFIER);
299
300         row = uiLayoutRow(box, false);
301         uiItemR(row, imfptr, "triangulate", 1, NULL, ICON_NONE);
302         row = uiLayoutRow(box, false);
303         uiItemR(row, imfptr, "use_object_instantiation", 1, NULL, ICON_NONE);
304         row = uiLayoutRow(box, false);
305         uiItemR(row, imfptr, "use_blender_profile", 1, NULL, ICON_NONE);
306
307         row = uiLayoutRow(box, false);
308         split = uiLayoutSplit(row, 0.6f, UI_LAYOUT_ALIGN_RIGHT);
309         uiItemL(split, IFACE_("Transformation Type"), ICON_NONE);
310         uiItemR(split, imfptr, "export_transformation_type_selection", 0, "", ICON_NONE);
311         row = uiLayoutRow(box, false);
312         uiItemR(row, imfptr, "sort_by_name", 0, NULL, ICON_NONE);
313
314         row = uiLayoutRow(box, false);
315         uiItemR(row, imfptr, "keep_bind_info", 0, NULL, ICON_NONE);
316
317         row = uiLayoutRow(box, false);
318         uiItemR(row, imfptr, "limit_precision", 0, NULL, ICON_NONE);
319
320 }
321
322 static void wm_collada_export_draw(bContext *UNUSED(C), wmOperator *op)
323 {
324         PointerRNA ptr;
325
326         RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
327         uiCollada_exportSettings(op->layout, &ptr);
328 }
329
330 static bool wm_collada_export_check(bContext *UNUSED(C), wmOperator *op)
331 {
332         char filepath[FILE_MAX];
333         RNA_string_get(op->ptr, "filepath", filepath);
334
335         if (!BLI_testextensie(filepath, ".dae")) {
336                 BLI_ensure_extension(filepath, FILE_MAX, ".dae");
337                 RNA_string_set(op->ptr, "filepath", filepath);
338                 return true;
339         }
340
341         return false;
342 }
343
344 void WM_OT_collada_export(wmOperatorType *ot)
345 {
346         struct StructRNA *func = ot->srna;
347
348         static const EnumPropertyItem prop_bc_export_mesh_type[] = {
349                 {BC_MESH_TYPE_VIEW, "view", 0, "View", "Apply modifier's view settings"},
350                 {BC_MESH_TYPE_RENDER, "render", 0, "Render", "Apply modifier's render settings"},
351                 {0, NULL, 0, NULL, NULL}
352         };
353
354         static const EnumPropertyItem prop_bc_export_transformation_type[] = {
355                 { BC_TRANSFORMATION_TYPE_MATRIX, "matrix", 0, "Matrix", "Use <matrix> to specify transformations" },
356                 { BC_TRANSFORMATION_TYPE_TRANSROTLOC, "transrotloc", 0, "TransRotLoc", "Use <translate>, <rotate>, <scale> to specify transformations" },
357                 { 0, NULL, 0, NULL, NULL }
358         };
359
360         static const EnumPropertyItem prop_bc_export_texture_type[] = {
361                 { BC_TEXTURE_TYPE_MAT, "mat", 0, "Materials", "Export Materials" },
362                 { BC_TEXTURE_TYPE_UV, "uv", 0, "UV Textures", "Export UV Textures (Face textures) as materials" },
363                 { 0, NULL, 0, NULL, NULL }
364         };
365
366         ot->name = "Export COLLADA";
367         ot->description = "Save a Collada file";
368         ot->idname = "WM_OT_collada_export";
369
370         ot->invoke = wm_collada_export_invoke;
371         ot->exec = wm_collada_export_exec;
372         ot->poll = WM_operator_winactive;
373         ot->check = wm_collada_export_check;
374
375         ot->flag |= OPTYPE_PRESET;
376
377         ot->ui = wm_collada_export_draw;
378
379         WM_operator_properties_filesel(
380                 ot, FILE_TYPE_FOLDER | FILE_TYPE_COLLADA, FILE_BLENDER, FILE_SAVE,
381                 WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
382
383         RNA_def_boolean(func,
384                         "apply_modifiers", 0, "Apply Modifiers",
385                         "Apply modifiers to exported mesh (non destructive))");
386
387         RNA_def_int(func, "export_mesh_type", 0, INT_MIN, INT_MAX,
388                     "Resolution", "Modifier resolution for export", INT_MIN, INT_MAX);
389
390         RNA_def_enum(func, "export_mesh_type_selection", prop_bc_export_mesh_type, 0,
391                      "Resolution", "Modifier resolution for export");
392
393         RNA_def_boolean(func, "selected", false, "Selection Only",
394                         "Export only selected elements");
395
396         RNA_def_boolean(func, "include_children", false, "Include Children",
397                         "Export all children of selected objects (even if not selected)");
398
399         RNA_def_boolean(func, "include_armatures", false, "Include Armatures",
400                         "Export related armatures (even if not selected)");
401
402         RNA_def_boolean(func, "include_shapekeys", false, "Include Shape Keys",
403                         "Export all Shape Keys from Mesh Objects");
404
405         RNA_def_boolean(func, "deform_bones_only", false, "Deform Bones only",
406                         "Only export deforming bones with armatures");
407
408         RNA_def_boolean(func, "include_animations", true,
409                 "Include Animations", "Export Animations if available.\nExporting Animations will enforce the decomposition of node transforms\ninto  <translation> <rotation> and <scale> components");
410
411         RNA_def_boolean(func, "sample_animations", 0,
412                 "Sample Animations", "Auto-generate keyframes with a frame distance set by 'Sampling Rate'.\nWhen disabled, export only the keyframes defined in the animation f-curves (may be less accurate)");
413
414         RNA_def_int(func, "sampling_rate", 1, 1, INT_MAX,
415                 "Sampling Rate", "The distance between 2 keyframes. 1 means: Every frame is keyed", 1, INT_MAX);
416
417         RNA_def_boolean(func, "active_uv_only", 0, "Only Selected UV Map",
418                         "Export only the selected UV Map");
419
420         RNA_def_boolean(func, "use_texture_copies", 1, "Copy",
421                         "Copy textures to same folder where the .dae file is exported");
422
423
424         RNA_def_boolean(func, "triangulate", 1, "Triangulate",
425                         "Export Polygons (Quads & NGons) as Triangles");
426
427         RNA_def_boolean(func, "use_object_instantiation", 1, "Use Object Instances",
428                 "Instantiate multiple Objects from same Data");
429
430         RNA_def_boolean(func, "use_blender_profile", 1, "Use Blender Profile",
431                 "Export additional Blender specific information (for material, shaders, bones, etc.)");
432
433         RNA_def_boolean(func, "sort_by_name", 0, "Sort by Object name",
434                         "Sort exported data by Object name");
435
436
437         RNA_def_int(func, "export_transformation_type", 0, INT_MIN, INT_MAX,
438                 "Transform", "Transformation type for translation, scale and rotation", INT_MIN, INT_MAX);
439
440         RNA_def_enum(func, "export_transformation_type_selection", prop_bc_export_transformation_type, 0,
441                 "Transform", "Transformation type for translation, scale and rotation");
442
443
444         RNA_def_int(func, "export_texture_type", 0, INT_MIN, INT_MAX,
445                 "Texture Type", "Type for exported Textures (UV or MAT)", INT_MIN, INT_MAX);
446
447         RNA_def_enum(func, "export_texture_type_selection", prop_bc_export_texture_type, 0,
448                 "Texture Type", "Type for exported Textures (UV or MAT)");
449
450
451         RNA_def_boolean(func, "open_sim", 0, "Export to SL/OpenSim",
452                         "Compatibility mode for SL, OpenSim and other compatible online worlds");
453
454         RNA_def_boolean(func, "limit_precision", 0,
455                 "Limit Precision", "Reduce the precision of the exported data to 6 digits");
456
457         RNA_def_boolean(func, "keep_bind_info", 0,
458                 "Keep Bind Info", "Store Bindpose information in custom bone properties for later use during Collada export");
459
460 }
461
462
463 /* function used for WM_OT_save_mainfile too */
464 static int wm_collada_import_exec(bContext *C, wmOperator *op)
465 {
466         char filename[FILE_MAX];
467         int import_units;
468         int find_chains;
469         int auto_connect;
470         int fix_orientation;
471         int min_chain_length;
472
473         int keep_bind_info;
474         ImportSettings import_settings;
475
476         if (!RNA_struct_property_is_set(op->ptr, "filepath")) {
477                 BKE_report(op->reports, RPT_ERROR, "No filename given");
478                 return OPERATOR_CANCELLED;
479         }
480
481         /* Options panel */
482         import_units     = RNA_boolean_get(op->ptr, "import_units");
483         find_chains      = RNA_boolean_get(op->ptr, "find_chains");
484         auto_connect     = RNA_boolean_get(op->ptr, "auto_connect");
485         fix_orientation  = RNA_boolean_get(op->ptr, "fix_orientation");
486
487         keep_bind_info = RNA_boolean_get(op->ptr, "keep_bind_info");
488
489         min_chain_length = RNA_int_get(op->ptr, "min_chain_length");
490
491         RNA_string_get(op->ptr, "filepath", filename);
492
493         import_settings.filepath = filename;
494         import_settings.import_units = import_units != 0;
495         import_settings.auto_connect = auto_connect != 0;
496         import_settings.find_chains = find_chains != 0;
497         import_settings.fix_orientation = fix_orientation != 0;
498         import_settings.min_chain_length = min_chain_length;
499         import_settings.keep_bind_info = keep_bind_info != 0;
500
501         if (collada_import(C, &import_settings)) {
502                 return OPERATOR_FINISHED;
503         }
504         else {
505                 BKE_report(op->reports, RPT_ERROR, "Errors found during parsing COLLADA document (see console for details)");
506                 return OPERATOR_CANCELLED;
507         }
508 }
509
510 static void uiCollada_importSettings(uiLayout *layout, PointerRNA *imfptr)
511 {
512         uiLayout *box, *row;
513
514         /* Import Options: */
515         box = uiLayoutBox(layout);
516         row = uiLayoutRow(box, false);
517         uiItemL(row, IFACE_("Import Data Options:"), ICON_MESH_DATA);
518
519         row = uiLayoutRow(box, false);
520         uiItemR(row, imfptr, "import_units", 0, NULL, ICON_NONE);
521
522         box = uiLayoutBox(layout);
523         row = uiLayoutRow(box, false);
524         uiItemL(row, IFACE_("Armature Options:"), ICON_MESH_DATA);
525
526         row = uiLayoutRow(box, false);
527         uiItemR(row, imfptr, "fix_orientation", 0, NULL, ICON_NONE);
528
529         row = uiLayoutRow(box, false);
530         uiItemR(row, imfptr, "find_chains", 0, NULL, ICON_NONE);
531
532         row = uiLayoutRow(box, false);
533         uiItemR(row, imfptr, "auto_connect", 0, NULL, ICON_NONE);
534
535         row = uiLayoutRow(box, false);
536         uiItemR(row, imfptr, "min_chain_length", 0, NULL, ICON_NONE);
537
538         box = uiLayoutBox(layout);
539         row = uiLayoutRow(box, false);
540
541         row = uiLayoutRow(box, false);
542         uiItemR(row, imfptr, "keep_bind_info", 0, NULL, ICON_NONE);
543
544 }
545
546 static void wm_collada_import_draw(bContext *UNUSED(C), wmOperator *op)
547 {
548         PointerRNA ptr;
549
550         RNA_pointer_create(NULL, op->type->srna, op->properties, &ptr);
551         uiCollada_importSettings(op->layout, &ptr);
552 }
553
554 void WM_OT_collada_import(wmOperatorType *ot)
555 {
556         ot->name = "Import COLLADA";
557         ot->description = "Load a Collada file";
558         ot->idname = "WM_OT_collada_import";
559
560         ot->invoke = WM_operator_filesel;
561         ot->exec = wm_collada_import_exec;
562         ot->poll = WM_operator_winactive;
563
564         //ot->flag |= OPTYPE_PRESET;
565
566         ot->ui = wm_collada_import_draw;
567
568         WM_operator_properties_filesel(
569                 ot, FILE_TYPE_FOLDER | FILE_TYPE_COLLADA, FILE_BLENDER, FILE_OPENFILE,
570                 WM_FILESEL_FILEPATH, FILE_DEFAULTDISPLAY, FILE_SORT_ALPHA);
571
572         RNA_def_boolean(ot->srna,
573                 "import_units", 0, "Import Units",
574                 "If disabled match import to Blender's current Unit settings, "
575                 "otherwise use the settings from the Imported scene");
576
577         RNA_def_boolean(ot->srna,
578                 "fix_orientation", 0, "Fix Leaf Bones",
579                 "Fix Orientation of Leaf Bones (Collada does only support Joints)");
580
581         RNA_def_boolean(ot->srna,
582                 "find_chains", 0, "Find Bone Chains",
583                 "Find best matching Bone Chains and ensure bones in chain are connected");
584
585         RNA_def_boolean(ot->srna,
586                 "auto_connect", 0, "Auto Connect",
587                 "Set use_connect for parent bones which have exactly one child bone");
588
589         RNA_def_int(ot->srna,
590                 "min_chain_length",
591                 0,
592                 0,
593                 INT_MAX,
594                 "Minimum Chain Length",
595                 "When searching Bone Chains disregard chains of length below this value",
596                 0,
597                 INT_MAX);
598
599         RNA_def_boolean(ot->srna, 
600                 "keep_bind_info", 0, "Keep Bind Info", 
601                 "Store Bindpose information in custom bone properties for later use during Collada export");
602
603 }
604 #endif