diff options
Diffstat (limited to 'source/blender/editors/io')
-rw-r--r-- | source/blender/editors/io/io_collada.c | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c index 98c88ba5fc9..d89af5e85bd 100644 --- a/source/blender/editors/io/io_collada.c +++ b/source/blender/editors/io/io_collada.c @@ -28,7 +28,7 @@ * \ingroup collada */ #ifdef WITH_COLLADA -#include "DNA_scene_types.h" +#include "DNA_space_types.h" #include "BLT_translation.h" @@ -91,6 +91,9 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) int include_armatures; int include_shapekeys; int deform_bones_only; + + int include_animations; + int sample_animations; int sampling_rate; int include_material_textures; @@ -144,7 +147,11 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) include_children = RNA_boolean_get(op->ptr, "include_children"); include_armatures = RNA_boolean_get(op->ptr, "include_armatures"); include_shapekeys = RNA_boolean_get(op->ptr, "include_shapekeys"); - sampling_rate = RNA_int_get(op->ptr, "sampling_rate"); + + include_animations = RNA_boolean_get(op->ptr, "include_animations"); + sample_animations = RNA_boolean_get(op->ptr, "sample_animations"); + sampling_rate = (sample_animations)? RNA_int_get(op->ptr, "sampling_rate") : 0; + deform_bones_only = RNA_boolean_get(op->ptr, "deform_bones_only"); include_material_textures = RNA_boolean_get(op->ptr, "include_material_textures"); @@ -164,7 +171,11 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) /* get editmode results */ ED_object_editmode_load(CTX_data_edit_object(C)); - export_count = collada_export(C, + Scene *scene = CTX_data_scene(C); + CTX_data_eval_ctx(C, &eval_ctx); + + export_count = collada_export(&eval_ctx, + scene, filepath, apply_modifiers, export_mesh_type, @@ -173,6 +184,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) include_armatures, include_shapekeys, deform_bones_only, + include_animations, sampling_rate, active_uv_only, @@ -209,6 +221,7 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op) static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr) { uiLayout *box, *row, *col, *split; + bool include_animations = RNA_boolean_get(imfptr, "include_animations"); /* Export Options: */ box = uiLayoutBox(layout); @@ -239,9 +252,15 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr) uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected")); row = uiLayoutRow(box, false); - uiItemR(row, imfptr, "sampling_rate", 0, NULL, ICON_NONE); + uiItemR(row, imfptr, "include_animations", 0, NULL, ICON_NONE); + row = uiLayoutRow(box, false); + if (include_animations) { + uiItemR(row, imfptr, "sample_animations", 0, NULL, ICON_NONE); + row = uiLayoutColumn(box, false); + uiItemR(row, imfptr, "sampling_rate", 0, NULL, ICON_NONE); + uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "sample_animations")); + } - /* Texture options */ box = uiLayoutBox(layout); row = uiLayoutRow(box, false); @@ -284,7 +303,6 @@ static void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr) split = uiLayoutSplit(row, 0.6f, UI_LAYOUT_ALIGN_RIGHT); uiItemL(split, IFACE_("Transformation Type"), ICON_NONE); uiItemR(split, imfptr, "export_transformation_type_selection", 0, "", ICON_NONE); - row = uiLayoutRow(box, false); uiItemR(row, imfptr, "sort_by_name", 0, NULL, ICON_NONE); @@ -376,8 +394,14 @@ void WM_OT_collada_export(wmOperatorType *ot) RNA_def_boolean(func, "deform_bones_only", 0, "Deform Bones only", "Only export deforming bones with armatures"); - RNA_def_int(func, "sampling_rate", 0, -1, INT_MAX, - "Samplintg Rate", "The maximum distance of frames between 2 keyframes. Disabled when value is -1", -1, INT_MAX); + RNA_def_boolean(func, "include_animations", false, + "Include Animations", "Export Animations if available.\nExporting Animations will enforce the decomposition of node transforms\ninto <translation> <rotation> and <scale> components"); + + RNA_def_boolean(func, "sample_animations", 0, + "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)"); + + RNA_def_int(func, "sampling_rate", 1, 1, INT_MAX, + "Sampling Rate", "The distance between 2 keyframes. 1 means: Every frame is keyed", 1, INT_MAX); RNA_def_boolean(func, "active_uv_only", 0, "Only Selected UV Map", |