Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKévin Dietrich <kevin.dietrich@mailoo.org>2016-08-19 05:42:12 +0300
committerKévin Dietrich <kevin.dietrich@mailoo.org>2016-08-19 05:42:45 +0300
commitbf4875001de10d0053fc9377fa98349bd6e1e8a9 (patch)
tree125b6fd31ad0005d03a4766873c3aae79c3c790f /source/blender/editors/io/io_collada.c
parent4d8ac1eaa5dac249577bcda5df963b802812fc2d (diff)
Fix T49111: Automatically add file path suffix for Alembic and Collada
export. This aligns the behaviour of the file selection with the other exporters. The Alembic case would fail if the filepath did not have an extension set. Also set a default file name for the Alembic export operator in case the Blender file was not saved before exporting.
Diffstat (limited to 'source/blender/editors/io/io_collada.c')
-rw-r--r--source/blender/editors/io/io_collada.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index d62651cef81..8659100df87 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -280,6 +280,20 @@ static void wm_collada_export_draw(bContext *UNUSED(C), wmOperator *op)
uiCollada_exportSettings(op->layout, &ptr);
}
+static bool wm_collada_export_check(bContext *UNUSED(C), wmOperator *op)
+{
+ char filepath[FILE_MAX];
+ RNA_string_get(op->ptr, "filepath", filepath);
+
+ if (!BLI_testextensie(filepath, ".dae")) {
+ BLI_ensure_extension(filepath, FILE_MAX, ".dae");
+ RNA_string_set(op->ptr, "filepath", filepath);
+ return true;
+ }
+
+ return false;
+}
+
void WM_OT_collada_export(wmOperatorType *ot)
{
static EnumPropertyItem prop_bc_export_mesh_type[] = {
@@ -302,6 +316,7 @@ void WM_OT_collada_export(wmOperatorType *ot)
ot->invoke = wm_collada_export_invoke;
ot->exec = wm_collada_export_exec;
ot->poll = WM_operator_winactive;
+ ot->check = wm_collada_export_check;
ot->flag |= OPTYPE_PRESET;