Blender V2.61 - r43446

BLO_readfile.h

Go to the documentation of this file.
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  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 #ifndef BLO_READFILE_H
00028 #define BLO_READFILE_H
00029 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00039 struct bScreen;
00040 struct direntry;
00041 struct LinkNode;
00042 struct Main;
00043 struct MemFile;
00044 struct ReportList;
00045 struct Scene;
00046 struct SpaceFile;
00047 struct UserDef;
00048 struct bContext;
00049 struct BHead;
00050 struct FileData;
00051 
00052 typedef struct BlendHandle  BlendHandle;
00053 
00054 typedef enum BlenFileType {
00055     BLENFILETYPE_BLEND= 1, 
00056     BLENFILETYPE_PUB= 2, 
00057     BLENFILETYPE_RUNTIME= 3
00058 } BlenFileType;
00059 
00060 typedef struct BlendFileData {
00061     struct Main*    main;
00062     struct UserDef* user;
00063 
00064     int winpos;
00065     int fileflags;
00066     int displaymode;
00067     int globalf;
00068     char filename[240]; /* 240 = FILE_MAX */
00069     
00070     struct bScreen* curscreen;
00071     struct Scene*   curscene;
00072     
00073     BlenFileType    type;
00074 } BlendFileData;
00075 
00086 BlendFileData*  BLO_read_from_file(const char *filepath, struct ReportList *reports);
00087 
00099 BlendFileData*  BLO_read_from_memory(void *mem, int memsize, struct ReportList *reports);
00100 
00105 BlendFileData *BLO_read_from_memfile(struct Main *oldmain, const char *filename, struct MemFile *memfile, struct ReportList *reports);
00106 
00114     void
00115 BLO_blendfiledata_free(
00116     BlendFileData *bfd);
00117     
00125     BlendHandle*
00126 BLO_blendhandle_from_file(
00127     char *file,
00128     struct ReportList *reports);
00129 
00138     BlendHandle*
00139 BLO_blendhandle_from_memory(
00140     void *mem,
00141     int memsize);
00142 
00154     struct LinkNode*
00155 BLO_blendhandle_get_datablock_names(
00156     BlendHandle *bh, 
00157     int ofblocktype,
00158     int *tot_names);
00159 
00171     struct LinkNode*
00172 BLO_blendhandle_get_previews(
00173     BlendHandle *bh, 
00174     int ofblocktype,
00175     int *tot_prev);
00176 
00186     struct LinkNode*
00187 BLO_blendhandle_get_linkable_groups(
00188     BlendHandle *bh);
00189 
00196     void
00197 BLO_blendhandle_close(
00198     BlendHandle *bh);
00199     
00200     /***/
00201 
00202 #define GROUP_MAX 32
00203 
00204 int BLO_has_bfile_extension(const char *str);
00205 
00206 /* return ok when a blenderfile, in dir is the filename,
00207  * in group the type of libdata
00208  */
00209 int BLO_is_a_library(const char *path, char *dir, char *group);
00210 
00211 
00220 struct Main* BLO_library_append_begin(struct Main *mainvar, BlendHandle** bh, const char *filepath);
00221 
00222 
00232 struct ID *BLO_library_append_named_part(struct Main *mainl, BlendHandle** bh, const char *idname, const int idcode);
00233 
00246 struct ID *BLO_library_append_named_part_ex(const struct bContext *C, struct Main *mainl, BlendHandle** bh, const char *idname, const int idcode, const short flag);
00247 
00248 void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendHandle** bh, int idcode, short flag);
00249 
00250 void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char *blockname);
00251 
00252 BlendFileData* blo_read_blendafterruntime(int file, const char *name, int actualsize, struct ReportList *reports);
00253 
00254 #ifdef __cplusplus
00255 } 
00256 #endif
00257 
00258 #endif
00259