4 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version. The Blender
10 * Foundation also sells licenses for use in proprietary software under
11 * the Blender License. See http://www.blender.org/BL/ for information
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
24 * All rights reserved.
26 * The Original Code is: all of this file.
28 * Contributor(s): none yet.
30 * ***** END GPL/BL DUAL LICENSE BLOCK *****
31 * external readfile function prototypes
33 #ifndef BLO_READFILE_H
34 #define BLO_READFILE_H
48 typedef struct BlendHandle BlendHandle;
50 typedef enum BlenFileType {
51 BLENFILETYPE_BLEND= 1,
53 BLENFILETYPE_RUNTIME= 3
79 typedef struct BlendFileData {
88 struct bScreen* curscreen;
89 struct Scene* curscene;
95 * Open a blender file from a pathname. The function
96 * returns NULL and sets the @a error_r argument if
97 * it cannot open the file.
99 * @param file The path of the file to open.
100 * @param error_r If the return value is NULL, an error
101 * code indicating the cause of the failure.
102 * @return The data of the file.
104 BlendFileData* BLO_read_from_file (char *file, BlendReadError *error_r);
107 * Open a blender file from memory. The function
108 * returns NULL and sets the @a error_r argument if
109 * it cannot open the file.
111 * @param mem The file data.
112 * @param memsize The length of @a mem.
113 * @param error_r If the return value is NULL, an error
114 * code indicating the cause of the failure.
115 * @return The data of the file.
117 BlendFileData* BLO_read_from_memory(void *mem, int memsize, BlendReadError *error_r);
120 * file name is current file, only for retrieving library data */
122 BlendFileData *BLO_read_from_memfile(const char *filename, struct MemFile *memfile, BlendReadError *error_r);
125 * Convert a BlendReadError to a human readable string.
126 * The string is static and does not need to be free'd.
128 * @param error The error to return a string for.
129 * @return A static human readable string representation
135 BlendReadError error);
138 * Free's a BlendFileData structure and _all_ the
139 * data associated with it (the userdef data, and
140 * the main libblock data).
142 * @param bfd The structure to free.
145 BLO_blendfiledata_free(
149 * Convert an idcode into a name.
151 * @param code The code to convert.
152 * @return A static string representing the name of
160 * Convert a name into an idcode (ie. ID_SCE)
162 * @param name The name to convert.
163 * @return The code for the name, or 0 if invalid.
166 BLO_idcode_from_name(
170 * Open a blendhandle from a file path.
172 * @param file The file path to open.
173 * @return A handle on success, or NULL on failure.
176 BLO_blendhandle_from_file(
180 * Gets the names of all the datablocks in a file
181 * of a certain type (ie. All the scene names in
184 * @param bh The blendhandle to access.
185 * @param ofblocktype The type of names to get.
186 * @return A BLI_linklist of strings. The string links
187 * should be freed with malloc.
190 BLO_blendhandle_get_datablock_names(
195 * Gets the names of all the datablock groups in a
196 * file. (ie. file contains Scene, Mesh, and Lamp
199 * @param bh The blendhandle to access.
200 * @return A BLI_linklist of strings. The string links
201 * should be freed with malloc.
204 BLO_blendhandle_get_linkable_groups(
208 * Close and free a blendhandle. The handle
209 * becomes invalid after this call.
211 * @param bh The handle to close.
214 BLO_blendhandle_close(
219 char *BLO_gethome(void);
220 int BLO_has_bfile_extension(char *str);
221 void BLO_library_append(struct SpaceFile *sfile, char *dir, int idcode);
222 void BLO_script_library_append(BlendHandle *bh, char *dir, char *name, int idcode, short flag);
224 BlendFileData* blo_read_blendafterruntime(int file, int actualsize, BlendReadError *error_r);