Blender V2.61 - r43446
Functions

readblenentry.c File Reference

#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <math.h>
#include "MEM_guardedalloc.h"
#include "BLI_fileops.h"
#include "BLI_ghash.h"
#include "BLI_linklist.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "DNA_genfile.h"
#include "DNA_sdna_types.h"
#include "BKE_main.h"
#include "BKE_library.h"
#include "BKE_idcode.h"
#include "BKE_report.h"
#include "BKE_utildefines.h"
#include "BLO_readfile.h"
#include "BLO_undofile.h"
#include "readfile.h"
#include "BLO_sys_types.h"

Go to the source code of this file.

Functions

void BLO_blendhandle_print_sizes (BlendHandle *, void *)
BlendHandleBLO_blendhandle_from_file (char *file, ReportList *reports)
BlendHandleBLO_blendhandle_from_memory (void *mem, int memsize)
LinkNodeBLO_blendhandle_get_datablock_names (BlendHandle *bh, int ofblocktype, int *tot_names)
LinkNodeBLO_blendhandle_get_previews (BlendHandle *bh, int ofblocktype, int *tot_prev)
LinkNodeBLO_blendhandle_get_linkable_groups (BlendHandle *bh)
void BLO_blendhandle_close (BlendHandle *bh)
BlendFileDataBLO_read_from_file (const char *filepath, ReportList *reports)
BlendFileDataBLO_read_from_memory (void *mem, int memsize, ReportList *reports)
BlendFileDataBLO_read_from_memfile (Main *oldmain, const char *filename, MemFile *memfile, ReportList *reports)
void BLO_blendfiledata_free (BlendFileData *bfd)

Detailed Description

Definition in file readblenentry.c.


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().

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().

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().

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().

void BLO_blendhandle_print_sizes ( BlendHandle bh,
void *  fp 
)
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().