Blender  V2.59
BLO_readfile.h
Go to the documentation of this file.
00001 /*
00002  * $Id: BLO_readfile.h 39044 2011-08-05 05:26:19Z campbellbarton $
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  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00021  * All rights reserved.
00022  *
00023  * The Original Code is: all of this file.
00024  *
00025  * Contributor(s): none yet.
00026  *
00027  * ***** END GPL LICENSE BLOCK *****
00028  */
00029 #ifndef BLO_READFILE_H
00030 #define BLO_READFILE_H
00031 
00037 #ifdef __cplusplus
00038 extern "C" {
00039 #endif
00040 
00041 struct bScreen;
00042 struct direntry;
00043 struct LinkNode;
00044 struct Main;
00045 struct MemFile;
00046 struct ReportList;
00047 struct Scene;
00048 struct SpaceFile;
00049 struct SpaceImaSel;
00050 struct UserDef;
00051 struct bContext;
00052 struct BHead;
00053 struct FileData;
00054 
00055 typedef struct BlendHandle      BlendHandle;
00056 
00057 typedef enum BlenFileType {
00058         BLENFILETYPE_BLEND= 1, 
00059         BLENFILETYPE_PUB= 2, 
00060         BLENFILETYPE_RUNTIME= 3
00061 } BlenFileType;
00062 
00063 typedef struct BlendFileData {
00064         struct Main*    main;
00065         struct UserDef* user;
00066 
00067         int winpos;
00068         int fileflags;
00069         int displaymode;
00070         int globalf;
00071         char filename[240];     /* 240 = FILE_MAX */
00072         
00073         struct bScreen* curscreen;
00074         struct Scene*   curscene;
00075         
00076         BlenFileType    type;
00077 } BlendFileData;
00078 
00089 BlendFileData*  BLO_read_from_file(const char *filepath, struct ReportList *reports);
00090 
00102 BlendFileData*  BLO_read_from_memory(void *mem, int memsize, struct ReportList *reports);
00103 
00108 BlendFileData *BLO_read_from_memfile(struct Main *oldmain, const char *filename, struct MemFile *memfile, struct ReportList *reports);
00109 
00117         void
00118 BLO_blendfiledata_free(
00119         BlendFileData *bfd);
00120         
00128         BlendHandle*
00129 BLO_blendhandle_from_file(
00130         char *file,
00131         struct ReportList *reports);
00132 
00141         BlendHandle*
00142 BLO_blendhandle_from_memory(
00143         void *mem,
00144         int memsize);
00145 
00157         struct LinkNode*
00158 BLO_blendhandle_get_datablock_names(
00159         BlendHandle *bh, 
00160         int ofblocktype,
00161         int *tot_names);
00162 
00174         struct LinkNode*
00175 BLO_blendhandle_get_previews(
00176         BlendHandle *bh, 
00177         int ofblocktype,
00178         int *tot_prev);
00179 
00189         struct LinkNode*
00190 BLO_blendhandle_get_linkable_groups(
00191         BlendHandle *bh);
00192 
00199         void
00200 BLO_blendhandle_close(
00201         BlendHandle *bh);
00202         
00203         /***/
00204 
00205 #define GROUP_MAX 32
00206 
00207 int BLO_has_bfile_extension(char *str);
00208 
00209 /* return ok when a blenderfile, in dir is the filename,
00210  * in group the type of libdata
00211  */
00212 int BLO_is_a_library(const char *path, char *dir, char *group);
00213 
00214 
00223 struct Main* BLO_library_append_begin(struct Main *mainvar, BlendHandle** bh, const char *filepath);
00224 
00225 
00235 struct ID *BLO_library_append_named_part(struct Main *mainl, BlendHandle** bh, const char *idname, const int idcode);
00236 
00249 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);
00250 
00251 void BLO_library_append_end(const struct bContext *C, struct Main *mainl, BlendHandle** bh, int idcode, short flag);
00252 
00253 void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char *blockname);
00254 
00255 BlendFileData* blo_read_blendafterruntime(int file, char *name, int actualsize, struct ReportList *reports);
00256 
00257 #ifdef __cplusplus
00258 } 
00259 #endif
00260 
00261 #endif
00262