2002-10-12 11:37:38 +00:00
|
|
|
/*
|
|
|
|
* $Id$
|
|
|
|
*
|
2008-01-07 19:13:47 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
2008-01-07 19:13:47 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
2008-01-07 19:13:47 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
* external readfile function prototypes
|
|
|
|
*/
|
|
|
|
#ifndef BLO_READFILE_H
|
|
|
|
#define BLO_READFILE_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2008-12-19 00:50:21 +00:00
|
|
|
struct bScreen;
|
|
|
|
struct direntry;
|
2007-09-02 17:25:03 +00:00
|
|
|
struct FileList;
|
2002-10-12 11:37:38 +00:00
|
|
|
struct LinkNode;
|
|
|
|
struct Main;
|
2004-09-05 13:43:51 +00:00
|
|
|
struct MemFile;
|
2008-12-19 00:50:21 +00:00
|
|
|
struct ReportList;
|
|
|
|
struct Scene;
|
|
|
|
struct SpaceFile;
|
|
|
|
struct SpaceImaSel;
|
|
|
|
struct UserDef;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
typedef struct BlendHandle BlendHandle;
|
|
|
|
|
|
|
|
typedef enum BlenFileType {
|
|
|
|
BLENFILETYPE_BLEND= 1,
|
|
|
|
BLENFILETYPE_PUB= 2,
|
|
|
|
BLENFILETYPE_RUNTIME= 3
|
|
|
|
} BlenFileType;
|
|
|
|
|
|
|
|
typedef struct BlendFileData {
|
|
|
|
struct Main* main;
|
|
|
|
struct UserDef* user;
|
|
|
|
|
|
|
|
int winpos;
|
|
|
|
int fileflags;
|
|
|
|
int displaymode;
|
2003-07-21 19:41:07 +00:00
|
|
|
int globalf;
|
2007-12-24 18:53:37 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
struct bScreen* curscreen;
|
|
|
|
struct Scene* curscene;
|
|
|
|
|
|
|
|
BlenFileType type;
|
|
|
|
} BlendFileData;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Open a blender file from a pathname. The function
|
2008-12-19 00:50:21 +00:00
|
|
|
* returns NULL and sets a report in the list if
|
2002-10-12 11:37:38 +00:00
|
|
|
* it cannot open the file.
|
|
|
|
*
|
|
|
|
* @param file The path of the file to open.
|
2008-12-19 00:50:21 +00:00
|
|
|
* @param reports If the return value is NULL, errors
|
|
|
|
* indicating the cause of the failure.
|
2002-10-12 11:37:38 +00:00
|
|
|
* @return The data of the file.
|
|
|
|
*/
|
2008-12-19 00:50:21 +00:00
|
|
|
BlendFileData* BLO_read_from_file (char *file, struct ReportList *reports);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Open a blender file from memory. The function
|
2008-12-19 00:50:21 +00:00
|
|
|
* returns NULL and sets a report in the list if
|
2002-10-12 11:37:38 +00:00
|
|
|
* it cannot open the file.
|
|
|
|
*
|
|
|
|
* @param mem The file data.
|
|
|
|
* @param memsize The length of @a mem.
|
2008-12-19 00:50:21 +00:00
|
|
|
* @param reports If the return value is NULL, errors
|
|
|
|
* indicating the cause of the failure.
|
2002-10-12 11:37:38 +00:00
|
|
|
* @return The data of the file.
|
|
|
|
*/
|
2008-12-19 00:50:21 +00:00
|
|
|
BlendFileData* BLO_read_from_memory(void *mem, int memsize, struct ReportList *reports);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2006-01-05 14:12:07 +00:00
|
|
|
/**
|
2008-12-19 16:36:15 +00:00
|
|
|
* oldmain is old main, from which we will keep libraries, images, ..
|
2006-01-05 14:12:07 +00:00
|
|
|
* file name is current file, only for retrieving library data */
|
|
|
|
|
2008-12-19 16:36:15 +00:00
|
|
|
BlendFileData *BLO_read_from_memfile(struct Main *oldmain, const char *filename, struct MemFile *memfile, struct ReportList *reports);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Free's a BlendFileData structure and _all_ the
|
|
|
|
* data associated with it (the userdef data, and
|
|
|
|
* the main libblock data).
|
|
|
|
*
|
|
|
|
* @param bfd The structure to free.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
BLO_blendfiledata_free(
|
|
|
|
BlendFileData *bfd);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert an idcode into a name.
|
|
|
|
*
|
|
|
|
* @param code The code to convert.
|
|
|
|
* @return A static string representing the name of
|
|
|
|
* the code.
|
|
|
|
*/
|
|
|
|
char*
|
|
|
|
BLO_idcode_to_name(
|
|
|
|
int code);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Convert a name into an idcode (ie. ID_SCE)
|
|
|
|
*
|
|
|
|
* @param name The name to convert.
|
|
|
|
* @return The code for the name, or 0 if invalid.
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
BLO_idcode_from_name(
|
|
|
|
char *name);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Open a blendhandle from a file path.
|
|
|
|
*
|
|
|
|
* @param file The file path to open.
|
|
|
|
* @return A handle on success, or NULL on failure.
|
|
|
|
*/
|
|
|
|
BlendHandle*
|
|
|
|
BLO_blendhandle_from_file(
|
|
|
|
char *file);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the names of all the datablocks in a file
|
|
|
|
* of a certain type (ie. All the scene names in
|
|
|
|
* a file).
|
|
|
|
*
|
|
|
|
* @param bh The blendhandle to access.
|
|
|
|
* @param ofblocktype The type of names to get.
|
|
|
|
* @return A BLI_linklist of strings. The string links
|
|
|
|
* should be freed with malloc.
|
|
|
|
*/
|
|
|
|
struct LinkNode*
|
|
|
|
BLO_blendhandle_get_datablock_names(
|
|
|
|
BlendHandle *bh,
|
|
|
|
int ofblocktype);
|
|
|
|
|
2007-09-02 17:25:03 +00:00
|
|
|
/**
|
|
|
|
* Gets the previews of all the datablocks in a file
|
|
|
|
* of a certain type (ie. All the scene names in
|
|
|
|
* a file).
|
|
|
|
*
|
|
|
|
* @param bh The blendhandle to access.
|
|
|
|
* @param ofblocktype The type of names to get.
|
|
|
|
* @return A BLI_linklist of PreviewImage. The PreviewImage links
|
|
|
|
* should be freed with malloc.
|
|
|
|
*/
|
|
|
|
struct LinkNode*
|
|
|
|
BLO_blendhandle_get_previews(
|
|
|
|
BlendHandle *bh,
|
|
|
|
int ofblocktype);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
/**
|
|
|
|
* Gets the names of all the datablock groups in a
|
|
|
|
* file. (ie. file contains Scene, Mesh, and Lamp
|
|
|
|
* datablocks).
|
|
|
|
*
|
|
|
|
* @param bh The blendhandle to access.
|
|
|
|
* @return A BLI_linklist of strings. The string links
|
|
|
|
* should be freed with malloc.
|
|
|
|
*/
|
|
|
|
struct LinkNode*
|
|
|
|
BLO_blendhandle_get_linkable_groups(
|
|
|
|
BlendHandle *bh);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Close and free a blendhandle. The handle
|
|
|
|
* becomes invalid after this call.
|
|
|
|
*
|
|
|
|
* @param bh The handle to close.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
BLO_blendhandle_close(
|
|
|
|
BlendHandle *bh);
|
|
|
|
|
|
|
|
/***/
|
|
|
|
|
|
|
|
char *BLO_gethome(void);
|
|
|
|
int BLO_has_bfile_extension(char *str);
|
2007-12-24 18:53:37 +00:00
|
|
|
|
2009-01-06 14:42:54 +00:00
|
|
|
void BLO_library_append(BlendHandle **libfiledata, struct direntry* filelist, int totfile,
|
2008-12-29 13:38:08 +00:00
|
|
|
char *dir, char* file, short flag, int idcode, struct Main *mainvar, struct Scene *scene, struct ReportList *reports);
|
|
|
|
void BLO_script_library_append(BlendHandle **bh, char *dir, char *name, int idcode, short flag, struct Main *mainvar, struct Scene *scene, struct ReportList *reports);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2008-12-19 00:50:21 +00:00
|
|
|
BlendFileData* blo_read_blendafterruntime(int file, char *name, int actualsize, struct ReportList *reports);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|
2002-10-30 02:07:20 +00:00
|
|
|
|