Blender V2.61 - r43446
Classes | Defines | Typedefs | Enumerations | Functions

BLO_readfile.h File Reference

external readfile function prototypes. More...

Go to the source code of this file.

Classes

struct  BlendFileData

Defines

#define GROUP_MAX   32

Typedefs

typedef struct BlendHandle BlendHandle
typedef enum BlenFileType BlenFileType
typedef struct BlendFileData BlendFileData

Enumerations

enum  BlenFileType { BLENFILETYPE_BLEND = 1, BLENFILETYPE_PUB = 2, BLENFILETYPE_RUNTIME = 3 }

Functions

BlendFileDataBLO_read_from_file (const char *filepath, struct ReportList *reports)
BlendFileDataBLO_read_from_memory (void *mem, int memsize, struct ReportList *reports)
BlendFileDataBLO_read_from_memfile (struct Main *oldmain, const char *filename, struct MemFile *memfile, struct ReportList *reports)
void BLO_blendfiledata_free (BlendFileData *bfd)
BlendHandleBLO_blendhandle_from_file (char *file, struct ReportList *reports)
BlendHandleBLO_blendhandle_from_memory (void *mem, int memsize)
struct LinkNodeBLO_blendhandle_get_datablock_names (BlendHandle *bh, int ofblocktype, int *tot_names)
struct LinkNodeBLO_blendhandle_get_previews (BlendHandle *bh, int ofblocktype, int *tot_prev)
struct LinkNodeBLO_blendhandle_get_linkable_groups (BlendHandle *bh)
void BLO_blendhandle_close (BlendHandle *bh)
int BLO_has_bfile_extension (const char *str)
int BLO_is_a_library (const char *path, char *dir, char *group)
struct MainBLO_library_append_begin (struct Main *mainvar, BlendHandle **bh, const char *filepath)
struct IDBLO_library_append_named_part (struct Main *mainl, BlendHandle **bh, const char *idname, const int idcode)
struct IDBLO_library_append_named_part_ex (const struct bContext *C, struct Main *mainl, BlendHandle **bh, const char *idname, const int idcode, const short flag)
void BLO_library_append_end (const struct bContext *C, struct Main *mainl, BlendHandle **bh, int idcode, short flag)
void * BLO_library_read_struct (struct FileData *fd, struct BHead *bh, const char *blockname)
BlendFileDatablo_read_blendafterruntime (int file, const char *name, int actualsize, struct ReportList *reports)

Detailed Description

external readfile function prototypes.

Definition in file BLO_readfile.h.


Define Documentation

#define GROUP_MAX   32

Definition at line 202 of file BLO_readfile.h.

Referenced by BLO_is_a_library(), and wm_link_append_exec().


Typedef Documentation

typedef struct BlendFileData BlendFileData
typedef struct BlendHandle BlendHandle

Definition at line 52 of file BLO_readfile.h.

typedef enum BlenFileType BlenFileType

Enumeration Type Documentation

Enumerator:
BLENFILETYPE_BLEND 
BLENFILETYPE_PUB 
BLENFILETYPE_RUNTIME 

Definition at line 54 of file BLO_readfile.h.


Function Documentation

void BLO_blendfiledata_free ( BlendFileData bfd)

Free's a BlendFileData structure and _all_ the data associated with it (the userdef data, and the main libblock data).

Parameters:
bfdThe structure to free.

Definition at line 334 of file readblenentry.c.

References free_main(), BlendFileData::main, MEM_freeN(), and BlendFileData::user.

Referenced by main(), and StartKetsjiShell().

void BLO_blendhandle_close ( BlendHandle bh)

Close and free a blendhandle. The handle becomes invalid after this call.

Parameters:
bhThe handle to close.

Definition at line 243 of file readblenentry.c.

References blo_freefiledata().

Referenced by bpy_lib_exit(), filelist_freelib(), filelist_from_library(), KX_BlenderSceneConverter::LinkBlendFile(), and wm_link_append_exec().

BlendHandle* BLO_blendhandle_from_file ( char *  file,
struct ReportList reports 
)

Open a blendhandle from a file path.

Parameters:
fileThe file path to open.
reportsReport errors in opening the file (can be NULL).
Returns:
A handle on success, or NULL on failure.

Definition at line 76 of file readblenentry.c.

References blo_openblenderfile().

Referenced by bpy_lib_enter(), filelist_from_library(), KX_BlenderSceneConverter::LinkBlendFilePath(), and wm_link_append_exec().

BlendHandle* BLO_blendhandle_from_memory ( void *  mem,
int  memsize 
)

Open a blendhandle from memory.

Parameters:
memThe data to load from.
memsizeThe size of the data.
Returns:
A handle on success, or NULL on failure.

Definition at line 85 of file readblenentry.c.

References blo_openblendermemory(), and NULL.

Referenced by KX_BlenderSceneConverter::LinkBlendFileMemory().

struct LinkNode* BLO_blendhandle_get_datablock_names ( BlendHandle bh,
int  ofblocktype,
int *  tot_names 
) [read]

Gets the names of all the datablocks in a file of a certain type (ie. All the scene names in a file).

Parameters:
bhThe blendhandle to access.
ofblocktypeThe type of names to get.
tot_namesThe length of the returned list.
Returns:
A BLI_linklist of strings. The string links should be freed with malloc.

Definition at line 124 of file readblenentry.c.

References bhead_id_name(), BLI_linklist_prepend(), blo_firstbhead(), blo_nextbhead(), BHead::code, ENDB, names, and NULL.

Referenced by _bpy_names(), filelist_from_library(), and KX_BlenderSceneConverter::LinkBlendFile().

struct LinkNode* BLO_blendhandle_get_linkable_groups ( BlendHandle bh) [read]

Gets the names of all the datablock groups in a file. (ie. file contains Scene, Mesh, and Lamp datablocks).

Parameters:
bhThe blendhandle to access.
Returns:
A BLI_linklist of strings. The string links should be freed with malloc.

Definition at line 216 of file readblenentry.c.

References BKE_idcode_is_linkable(), BKE_idcode_is_valid(), BKE_idcode_to_name(), BLI_ghash_free(), BLI_ghash_haskey(), BLI_ghash_insert(), BLI_ghash_new(), BLI_ghashutil_ptrcmp(), BLI_ghashutil_ptrhash(), BLI_linklist_prepend(), blo_firstbhead(), blo_nextbhead(), BHead::code, ENDB, names, NULL, and str.

Referenced by filelist_from_library().

struct LinkNode* BLO_blendhandle_get_previews ( BlendHandle bh,
int  ofblocktype,
int *  tot_prev 
) [read]

Gets the previews of all the datablocks in a file of a certain type (ie. All the scene names in a file).

Parameters:
bhThe blendhandle to access.
ofblocktypeThe type of names to get.
tot_prevThe length of the returned list.
Returns:
A BLI_linklist of PreviewImage. The PreviewImage links should be freed with malloc.

Definition at line 145 of file readblenentry.c.

References bhead_id_name(), BLI_linklist_prepend(), blo_firstbhead(), BLO_library_read_struct(), blo_nextbhead(), BHead::code, DATA, DNA_struct_find_nr(), ENDB, FileData::filesdna, GS, PreviewImage::h, ID_IM, ID_LA, ID_MA, ID_TE, ID_WO, BHead::len, MEM_callocN(), MEM_freeN(), NULL, PreviewImage::rect, BHead::SDNAnr, and PreviewImage::w.

Referenced by filelist_from_library().

int BLO_has_bfile_extension ( const char *  str)
int BLO_is_a_library ( const char *  path,
char *  dir,
char *  group 
)
struct Main* BLO_library_append_begin ( struct Main mainvar,
BlendHandle **  bh,
const char *  filepath 
) [read]

Initialize the BlendHandle for appending or linking library data.

Parameters:
mainvarThe current main database eg G.main or CTX_data_main(C).
bhA blender file handle as returned by BLO_blendhandle_from_file or BLO_blendhandle_from_memory.
filepathUsed for relative linking, copied to the lib->name
Returns:
the library Main, to be passed to BLO_library_append_named_part as mainl.

Definition at line 14352 of file readfile.c.

References library_append_begin().

Referenced by bpy_lib_exit(), KX_BlenderSceneConverter::LinkBlendFile(), and wm_link_append_exec().

void BLO_library_append_end ( const struct bContext C,
struct Main mainl,
BlendHandle **  bh,
int  idcode,
short  flag 
)
struct ID* BLO_library_append_named_part ( struct Main mainl,
BlendHandle **  bh,
const char *  idname,
const int  idcode 
) [read]

Link/Append a named datablock from an external blend file.

Parameters:
mainlThe main database to link from (not the active one).
bhThe blender file handle.
idnameThe name of the datablock (without the 2 char ID prefix)
idcodeThe kind of datablock to link.
Returns:
the appended ID when found.

Definition at line 14301 of file readfile.c.

References append_named_part().

Referenced by bpy_lib_exit(), and KX_BlenderSceneConverter::LinkBlendFile().

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 
) [read]

Link/Append a named datablock from an external blend file. optionally instance the object in the scene when the flags are set.

Parameters:
CThe context, when NULL instancing object in the scene isnt done.
mainlThe main database to link from (not the active one).
bhThe blender file handle.
idnameThe name of the datablock (without the 2 char ID prefix)
idcodeThe kind of datablock to link.
flagOptions for linking, used for instancing.
Returns:
the appended ID when found.

Referenced by wm_link_append_exec().

void* BLO_library_read_struct ( struct FileData fd,
struct BHead bh,
const char *  blockname 
)

Definition at line 14430 of file readfile.c.

References read_struct().

Referenced by BLO_blendhandle_get_previews().

BlendFileData* blo_read_blendafterruntime ( int  file,
const char *  name,
int  actualsize,
struct ReportList reports 
)
BlendFileData* BLO_read_from_file ( const char *  filepath,
struct ReportList reports 
)

Open a blender file from a pathname. The function returns NULL and sets a report in the list if it cannot open the file.

Parameters:
filepathThe path of the file to open.
reportsIf the return value is NULL, errors indicating the cause of the failure.
Returns:
The data of the file.

Definition at line 252 of file readblenentry.c.

References blo_freefiledata(), blo_openblenderfile(), blo_read_file_internal(), NULL, and FileData::reports.

Referenced by BKE_read_file(), load_game_data(), and GPC_Engine::Start().

BlendFileData* BLO_read_from_memfile ( struct Main oldmain,
const char *  filename,
struct MemFile memfile,
struct ReportList reports 
)
BlendFileData* BLO_read_from_memory ( void *  mem,
int  memsize,
struct ReportList reports 
)

Open a blender file from memory. The function returns NULL and sets a report in the list if it cannot open the file.

Parameters:
memThe file data.
memsizeThe length of mem.
reportsIf the return value is NULL, errors indicating the cause of the failure.
Returns:
The data of the file.

Definition at line 267 of file readblenentry.c.

References blo_freefiledata(), blo_openblendermemory(), blo_read_file_internal(), NULL, and FileData::reports.

Referenced by BKE_read_file_from_memory(), ED_preview_init_dbase(), and GPC_Engine::Start().