2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): none yet.
25 * ***** END GPL LICENSE BLOCK *****
26 * blenloader readfile private function prototypes
29 /** \file blender/blenloader/intern/readfile.h
43 typedef struct FileData {
44 // linked list of BHeadN's
50 int (*read)(struct FileData *filedata, void *buffer, unsigned int size);
52 // variables needed for reading from memory / stream
54 // variables needed for reading from memfile (undo)
55 struct MemFile *memfile;
57 // variables needed for reading from file
61 // now only in use for library appending
62 char relabase[FILE_MAX];
64 // variables needed for reading from stream
68 // general reading variables
69 struct SDNA *filesdna;
74 int id_name_offs; /* used to retrieve ID names from (bhead+1) */
75 int globalf, fileflags; /* for do_versions patching */
77 struct OldNewMap *datamap;
78 struct OldNewMap *globmap;
79 struct OldNewMap *libmap;
80 struct OldNewMap *imamap;
81 struct OldNewMap *movieclipmap;
83 struct bheadsort *bheadmap;
88 /* ick ick, used to return
89 * data through streamglue.
91 BlendFileData **bfd_r;
92 struct ReportList *reports;
95 typedef struct BHeadN {
96 struct BHeadN *next, *prev;
101 #define FD_FLAGS_SWITCH_ENDIAN (1<<0)
102 #define FD_FLAGS_FILE_POINTSIZE_IS_4 (1<<1)
103 #define FD_FLAGS_POINTSIZE_DIFFERS (1<<2)
104 #define FD_FLAGS_FILE_OK (1<<3)
105 #define FD_FLAGS_NOT_MY_BUFFER (1<<4)
106 #define FD_FLAGS_NOT_MY_LIBMAP (1<<5)
108 #define SIZEOFBLENDERHEADER 12
112 void blo_join_main(ListBase *mainlist);
113 void blo_split_main(ListBase *mainlist, struct Main *main);
115 BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath);
117 FileData *blo_openblenderfile(const char *filepath, struct ReportList *reports);
118 FileData *blo_openblendermemory(void *buffer, int buffersize, struct ReportList *reports);
119 FileData *blo_openblendermemfile(struct MemFile *memfile, struct ReportList *reports);
121 void blo_clear_proxy_pointers_from_lib(Main *oldmain);
122 void blo_make_image_pointer_map(FileData *fd, Main *oldmain);
123 void blo_end_image_pointer_map(FileData *fd, Main *oldmain);
124 void blo_make_movieclip_pointer_map(FileData *fd, Main *oldmain);
125 void blo_end_movieclip_pointer_map(FileData *fd, Main *oldmain);
126 void blo_add_library_pointer_map(ListBase *mainlist, FileData *fd);
128 void blo_freefiledata( FileData *fd);
130 BHead *blo_firstbhead(FileData *fd);
131 BHead *blo_nextbhead(FileData *fd, BHead *thisblock);
132 BHead *blo_prevbhead(FileData *fd, BHead *thisblock);
134 char *bhead_id_name(FileData *fd, BHead *bhead);