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