[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59457] trunk/blender/source/blender: Fix 36505: Collada exporter crashes Blender when exporting to locked file
Gaia Clary
gaia.clary at machinimatrix.org
Sat Aug 24 11:51:06 CEST 2013
Revision: 59457
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59457
Author: gaiaclary
Date: 2013-08-24 09:51:05 +0000 (Sat, 24 Aug 2013)
Log Message:
-----------
Fix 36505: Collada exporter crashes Blender when exporting to locked file
Modified Paths:
--------------
trunk/blender/source/blender/collada/collada.cpp
trunk/blender/source/blender/editors/io/io_collada.c
Modified: trunk/blender/source/blender/collada/collada.cpp
===================================================================
--- trunk/blender/source/blender/collada/collada.cpp 2013-08-24 08:58:58 UTC (rev 59456)
+++ trunk/blender/source/blender/collada/collada.cpp 2013-08-24 09:51:05 UTC (rev 59457)
@@ -83,16 +83,6 @@
{
ExportSettings export_settings;
- /* annoying, collada crashes if file cant be created! [#27162] */
- if (!BLI_exists(filepath)) {
- BLI_make_existing_file(filepath); /* makes the dir if its not there */
- if (!BLI_file_touch(filepath)) {
- fprintf(stdout, "Collada export: Can not create: %s\n", filepath);
- return 0;
- }
- }
- /* end! */
-
export_settings.filepath = (char *)filepath;
export_settings.apply_modifiers = apply_modifiers != 0;
Modified: trunk/blender/source/blender/editors/io/io_collada.c
===================================================================
--- trunk/blender/source/blender/editors/io/io_collada.c 2013-08-24 08:58:58 UTC (rev 59456)
+++ trunk/blender/source/blender/editors/io/io_collada.c 2013-08-24 09:51:05 UTC (rev 59457)
@@ -106,6 +106,24 @@
RNA_string_get(op->ptr, "filepath", filepath);
BLI_ensure_extension(filepath, sizeof(filepath), ".dae");
+
+ /* Avoid File write exceptions in Collada */
+ if (!BLI_exists(filepath)) {
+ BLI_make_existing_file(filepath);
+ if (!BLI_file_touch(filepath)) {
+ BKE_report(op->reports, RPT_ERROR, "Can't create export file");
+ fprintf(stdout, "Collada export: Can not create: %s\n", filepath);
+ return OPERATOR_CANCELLED;
+ }
+ }
+ else if (!BLI_file_is_writable(filepath)) {
+ BKE_report(op->reports, RPT_ERROR, "Can't overwrite export file");
+ fprintf(stdout, "Collada export: Can not modify: %s\n", filepath);
+ return OPERATOR_CANCELLED;
+ }
+
+ /* Now the exporter can create and write the export file */
+
/* Options panel */
apply_modifiers = RNA_boolean_get(op->ptr, "apply_modifiers");
export_mesh_type = RNA_enum_get(op->ptr, "export_mesh_type_selection");
@@ -129,6 +147,8 @@
/* get editmode results */
ED_object_editmode_load(CTX_data_edit_object(C));
+
+
if (collada_export(CTX_data_scene(C),
filepath,
apply_modifiers,
More information about the Bf-blender-cvs
mailing list