|
Blender
V2.93
|
#include <stddef.h>#include <math.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include "MEM_guardedalloc.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_icons.h"#include "BKE_idtype.h"#include "BKE_main.h"#include "BLO_blend_defs.h"#include "BLO_readfile.h"#include "BLO_undofile.h"#include "readfile.h"#include "BLI_sys_types.h"Go to the source code of this file.
| void BLO_blendfiledata_free | ( | BlendFileData * | bfd | ) |
Frees a BlendFileData structure and all the data associated with it (the userdef data, and the main libblock data).
| bfd | The structure to free. |
Definition at line 482 of file readblenentry.c.
References BKE_main_free(), BlendFileData::main, MEM_freeN, and BlendFileData::user.
Referenced by BKE_blendfile_read_setup_ex(), and BlendfileLoadingBaseTest::blendfile_free().
| void BLO_blendhandle_close | ( | BlendHandle * | bh | ) |
Close and free a blendhandle. The handle becomes invalid after this call.
| bh | The handle to close. |
Definition at line 350 of file readblenentry.c.
References blo_filedata_free().
Referenced by BKE_copybuffer_paste(), BKE_copybuffer_read(), BLO_library_temp_free(), BLO_main_validate_libraries(), bpy_lib_exit(), filelist_freelib(), filelist_readjob_list_lib(), IMB_thumb_load_blend(), and wm_link_do().
| BlendHandle* BLO_blendhandle_from_file | ( | const char * | filepath, |
| ReportList * | reports | ||
| ) |
Open a blendhandle from a file path.
| filepath | The file path to open. |
| reports | Report errors in opening the file (can be NULL). |
Definition at line 71 of file readblenentry.c.
References blo_filedata_from_file().
Referenced by BKE_copybuffer_paste(), BKE_copybuffer_read(), BLO_library_temp_load_id(), BLO_main_validate_libraries(), bpy_lib_enter(), filelist_readjob_list_lib(), IMB_thumb_load_blend(), and wm_link_do().
| BlendHandle* BLO_blendhandle_from_memory | ( | const void * | mem, |
| int | memsize | ||
| ) |
Open a blendhandle from memory.
| mem | The data to load from. |
| memsize | The size of the data. |
Definition at line 87 of file readblenentry.c.
References blo_filedata_from_memory(), and NULL.
Referenced by wm_link_do().
| LinkNode* BLO_blendhandle_get_datablock_info | ( | BlendHandle * | bh, |
| int | ofblocktype, | ||
| int * | r_tot_info_items | ||
| ) |
Gets the names and asset-data (if ID is an asset) of all the data-blocks in a file of a certain type (e.g. all the scene names in a file).
| bh | The blendhandle to access. |
| ofblocktype | The type of names to get. |
| tot_info_items | The length of the returned list. |
Definition at line 180 of file readblenentry.c.
References BLODataBlockInfo::asset_data, BLI_linklist_prepend(), blo_bhead_first(), blo_bhead_id_asset_data_address(), blo_bhead_id_name(), blo_bhead_next(), blo_bhead_prev(), blo_read_asset_data_block(), BHead::code, ENDB, MEM_mallocN, BLODataBlockInfo::name, NULL, and STRNCPY.
Referenced by filelist_readjob_list_lib().
| LinkNode* BLO_blendhandle_get_datablock_names | ( | BlendHandle * | bh, |
| int | ofblocktype, | ||
| const bool | use_assets_only, | ||
| int * | r_tot_names | ||
| ) |
Gets the names of all the data-blocks in a file of a certain type (e.g. all the scene names in a file).
| bh | The blendhandle to access. |
| ofblocktype | The type of names to get. |
| tot_names | The length of the returned list. |
| use_assets_only | Only list IDs marked as assets. |
Definition at line 141 of file readblenentry.c.
References BLI_linklist_prepend(), BLI_strdup(), blo_bhead_first(), blo_bhead_id_asset_data_address(), blo_bhead_id_name(), blo_bhead_next(), BHead::code, ENDB, names, and NULL.
Referenced by _bpy_names(), BLO_main_validate_libraries(), and IMB_thumb_load_blend().
| LinkNode* BLO_blendhandle_get_linkable_groups | ( | BlendHandle * | bh | ) |
Gets the names of all the linkable data-block types available in a file. (e.g. "Scene", "Mesh", "Light", etc.).
| bh | The blendhandle to access. |
Definition at line 318 of file readblenentry.c.
References BKE_idtype_idcode_is_linkable(), BKE_idtype_idcode_is_valid(), BKE_idtype_idcode_to_name(), BLI_gset_add(), BLI_gset_free(), BLI_gset_ptr_new(), BLI_linklist_prepend(), BLI_strdup(), blo_bhead_first(), blo_bhead_next(), BHead::code, ENDB, names, NULL, and str.
Referenced by filelist_readjob_list_lib().
| LinkNode* BLO_blendhandle_get_previews | ( | BlendHandle * | bh, |
| int | ofblocktype, | ||
| int * | r_tot_prev | ||
| ) |
Gets the previews of all the data-blocks in a file of a certain type (e.g. all the scene previews in a file).
| bh | The blendhandle to access. |
| ofblocktype | The type of names to get. |
| r_tot_prev | The length of the returned list. |
Definition at line 226 of file readblenentry.c.
References BKE_previewimg_finish(), BLI_assert, BLI_linklist_prepend(), blo_bhead_first(), blo_bhead_id_name(), blo_bhead_next(), BLO_library_read_struct(), BHead::code, DATA, DNA_struct_find_nr(), ENDB, FileData::filesdna, GS, PreviewImage::h, ID_AC, ID_GR, ID_IM, ID_LA, ID_MA, ID_OB, ID_SCE, ID_TE, ID_WO, BHead::len, MEM_callocN, MEM_freeN, NULL, PreviewImage::rect, BHead::SDNAnr, and PreviewImage::w.
Referenced by IMB_thumb_load_blend().
| void BLO_blendhandle_print_sizes | ( | BlendHandle * | bh, |
| void * | fp | ||
| ) |
Definition at line 96 of file readblenentry.c.
References blo_bhead_first(), blo_bhead_next(), BHead::code, ENDB, FileData::filesdna, BHead::len, BHead::nr, BHead::SDNAnr, SDNA::structs, SDNA_Struct::type, and SDNA::types.
| BlendFileData* BLO_read_from_file | ( | const char * | filepath, |
| eBLOReadSkip | skip_flags, | ||
| 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.
| filepath | The path of the file to open. |
| reports | If the return value is NULL, errors indicating the cause of the failure. |
Definition at line 367 of file readblenentry.c.
References blo_filedata_free(), blo_filedata_from_file(), blo_read_file_internal(), NULL, FileData::reports, and FileData::skip_flags.
Referenced by BKE_blendfile_read(), BKE_blendfile_userdef_read(), BKE_blendfile_workspace_config_read(), and BlendfileLoadingBaseTest::blendfile_load().
| BlendFileData* BLO_read_from_memfile | ( | Main * | oldmain, |
| const char * | filename, | ||
| MemFile * | memfile, | ||
| const struct BlendFileReadParams * | params, | ||
| ReportList * | reports | ||
| ) |
Used for undo/redo, skips part of libraries reading (assuming their data are already loaded & valid).
| oldmain | old main, from which we will keep libraries and other data-blocks that should not have changed. |
| filename | current file, only for retrieving library data. |
Definition at line 421 of file readblenentry.c.
References BLI_assert, BLI_strncpy(), blo_add_library_pointer_map(), blo_cache_storage_init(), blo_cache_storage_old_bmain_clear(), blo_clear_proxy_pointers_from_lib(), blo_filedata_free(), blo_filedata_from_memfile(), blo_join_main(), blo_make_old_idmap_from_main(), blo_read_file_internal(), BLO_READ_SKIP_UNDO_OLD_MAIN, blo_split_main(), ListBase::first, NULL, params, FileData::relabase, FileData::reports, and FileData::skip_flags.
Referenced by BKE_blendfile_read_from_memfile(), and BLO_memfile_main_get().
| BlendFileData* BLO_read_from_memory | ( | const void * | mem, |
| int | memsize, | ||
| eBLOReadSkip | skip_flags, | ||
| 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.
| mem | The file data. |
| memsize | The length of mem. |
| reports | If the return value is NULL, errors indicating the cause of the failure. |
Definition at line 394 of file readblenentry.c.
References blo_filedata_free(), blo_filedata_from_memory(), blo_read_file_internal(), NULL, FileData::reports, and FileData::skip_flags.
Referenced by BKE_blendfile_read_from_memory(), BKE_blendfile_userdef_read_from_memory(), BKE_blendfile_workspace_config_read(), and load_main_from_memory().