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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-04-25 16:39:53 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-04-25 16:39:53 +0400
commit70d059161b81993a154d8e7c65ed940739791687 (patch)
tree606d0fa3d09bff242a55834ad42900e42fa5f6a9 /source
parent739359faabc6ea20b107b5ec694b715e2b5ad800 (diff)
workaround/fix [#27162] Running commands in python console crashes blender
Diffstat (limited to 'source')
-rw-r--r--source/blender/collada/collada.cpp16
-rw-r--r--source/blender/windowmanager/intern/wm_operators.c11
2 files changed, 22 insertions, 5 deletions
diff --git a/source/blender/collada/collada.cpp b/source/blender/collada/collada.cpp
index 0d822c63094..51caf62f6e7 100644
--- a/source/blender/collada/collada.cpp
+++ b/source/blender/collada/collada.cpp
@@ -38,6 +38,11 @@ extern "C"
#include "BKE_scene.h"
#include "BKE_context.h"
+/* make dummy file */
+#include "BLI_storage.h"
+#include "BLI_path_util.h"
+#include "BLI_fileops.h"
+
int collada_import(bContext *C, const char *filepath)
{
DocumentImporter imp (C, filepath);
@@ -48,8 +53,17 @@ extern "C"
int collada_export(Scene *sce, const char *filepath)
{
-
DocumentExporter exp;
+
+ /* annoying, collada crashes if file cant be created! [#27162] */
+ if(!BLI_exist(filepath)) {
+ BLI_make_existing_file(filepath); /* makes the dir if its not there */
+ if(BLI_touch(filepath) == 0) {
+ return 0;
+ }
+ }
+ /* end! */
+
exp.exportCurrentScene(sce, filepath);
return 1;
diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c
index 3f3a117f389..100dd914026 100644
--- a/source/blender/windowmanager/intern/wm_operators.c
+++ b/source/blender/windowmanager/intern/wm_operators.c
@@ -1948,11 +1948,14 @@ static int wm_collada_export_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_ERROR, "No filename given");
return OPERATOR_CANCELLED;
}
-
+
RNA_string_get(op->ptr, "filepath", filename);
- collada_export(CTX_data_scene(C), filename);
-
- return OPERATOR_FINISHED;
+ if(collada_export(CTX_data_scene(C), filename)) {
+ return OPERATOR_FINISHED;
+ }
+ else {
+ return OPERATOR_CANCELLED;
+ }
}
static void WM_OT_collada_export(wmOperatorType *ot)