Blender V2.61 - r43446
|
00001 /* 00002 * ***** BEGIN GPL LICENSE BLOCK ***** 00003 * 00004 * This program is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU General Public License 00006 * as published by the Free Software Foundation; either version 2 00007 * of the License, or (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program; if not, write to the Free Software Foundation, 00016 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00017 * 00018 * Contributor(s): Chingiz Dyussenov, Arystanbek Dyussenov. 00019 * 00020 * ***** END GPL LICENSE BLOCK ***** 00021 */ 00022 00028 /* COLLADABU_ASSERT, may be able to remove later */ 00029 #include "COLLADABUPlatform.h" 00030 00031 #include "ExportSettings.h" 00032 #include "DocumentExporter.h" 00033 #include "DocumentImporter.h" 00034 00035 extern "C" 00036 { 00037 #include "BKE_scene.h" 00038 #include "BKE_context.h" 00039 00040 /* make dummy file */ 00041 #include "BLI_fileops.h" 00042 #include "BLI_path_util.h" 00043 00044 int collada_import(bContext *C, const char *filepath) 00045 { 00046 DocumentImporter imp (C, filepath); 00047 if(imp.import()) return 1; 00048 00049 return 0; 00050 } 00051 00052 int collada_export(Scene *sce, const char *filepath, int selected) 00053 { 00054 ExportSettings export_settings; 00055 00056 export_settings.selected = selected != 0; 00057 export_settings.filepath = (char *)filepath; 00058 00059 /* annoying, collada crashes if file cant be created! [#27162] */ 00060 if(!BLI_exists(filepath)) { 00061 BLI_make_existing_file(filepath); /* makes the dir if its not there */ 00062 if(BLI_file_touch(filepath) == 0) { 00063 return 0; 00064 } 00065 } 00066 /* end! */ 00067 00068 DocumentExporter exporter(&export_settings); 00069 exporter.exportCurrentScene(sce); 00070 00071 return 1; 00072 } 00073 }