Blender  V3.3
Functions
BKE_blendfile.h File Reference

Go to the source code of this file.

Functions

bool BKE_blendfile_is_readable (const char *path, struct ReportList *reports)
 
void BKE_blendfile_read_setup_ex (struct bContext *C, struct BlendFileData *bfd, const struct BlendFileReadParams *params, struct BlendFileReadReport *reports, bool startup_update_defaults, const char *startup_app_template)
 
void BKE_blendfile_read_setup (struct bContext *C, struct BlendFileData *bfd, const struct BlendFileReadParams *params, struct BlendFileReadReport *reports)
 
struct BlendFileDataBKE_blendfile_read (const char *filepath, const struct BlendFileReadParams *params, struct BlendFileReadReport *reports)
 
struct BlendFileDataBKE_blendfile_read_from_memory (const void *filebuf, int filelength, const struct BlendFileReadParams *params, struct ReportList *reports)
 
struct BlendFileDataBKE_blendfile_read_from_memfile (struct Main *bmain, struct MemFile *memfile, const struct BlendFileReadParams *params, struct ReportList *reports)
 
void BKE_blendfile_read_make_empty (struct bContext *C)
 
struct UserDefBKE_blendfile_userdef_read (const char *filepath, struct ReportList *reports)
 
struct UserDefBKE_blendfile_userdef_read_from_memory (const void *filebuf, int filelength, struct ReportList *reports)
 
struct UserDefBKE_blendfile_userdef_from_defaults (void)
 
bool BKE_blendfile_userdef_write (const char *filepath, struct ReportList *reports)
 
bool BKE_blendfile_userdef_write_app_template (const char *filepath, struct ReportList *reports)
 
bool BKE_blendfile_userdef_write_all (struct ReportList *reports)
 
struct WorkspaceConfigFileDataBKE_blendfile_workspace_config_read (const char *filepath, const void *filebuf, int filelength, struct ReportList *reports)
 
bool BKE_blendfile_workspace_config_write (struct Main *bmain, const char *filepath, struct ReportList *reports)
 
void BKE_blendfile_workspace_config_data_free (struct WorkspaceConfigFileData *workspace_config)
 
void BKE_blendfile_write_partial_tag_ID (struct ID *id, bool set)
 
void BKE_blendfile_write_partial_begin (struct Main *bmain_src)
 
bool BKE_blendfile_write_partial (struct Main *bmain_src, const char *filepath, int write_flags, int remap_mode, struct ReportList *reports)
 
void BKE_blendfile_write_partial_end (struct Main *bmain_src)
 

Function Documentation

◆ BKE_blendfile_is_readable()

bool BKE_blendfile_is_readable ( const char *  path,
struct ReportList reports 
)

Check whether a given path is actually a Blender-readable, valid .blend file.

Note
Currently does attempt to open and read (part of) the given file.

Definition at line 68 of file blendfile.c.

References BLO_blendhandle_close(), BLO_blendhandle_from_file(), NULL, and BlendFileReadReport::reports.

Referenced by file_draw_hint_if_invalid().

◆ BKE_blendfile_read()

struct BlendFileData* BKE_blendfile_read ( const char *  filepath,
const struct BlendFileReadParams params,
struct BlendFileReadReport reports 
)

◆ BKE_blendfile_read_from_memfile()

struct BlendFileData* BKE_blendfile_read_from_memfile ( struct Main bmain,
struct MemFile memfile,
const struct BlendFileReadParams params,
struct ReportList reports 
)

◆ BKE_blendfile_read_from_memory()

struct BlendFileData* BKE_blendfile_read_from_memory ( const void filebuf,
int  filelength,
const struct BlendFileReadParams params,
struct ReportList reports 
)
Returns
Blend file data, this must be passed to BKE_blendfile_read_setup when non-NULL.

Definition at line 537 of file blendfile.c.

References BKE_reports_prepend(), BLO_blendfiledata_free(), BLO_read_from_memory(), Main::is_read_invalid, BlendFileData::main, NULL, and params.

Referenced by wm_homefile_read_ex().

◆ BKE_blendfile_read_make_empty()

void BKE_blendfile_read_make_empty ( struct bContext C)

Utility to make a file 'empty' used for startup to optionally give an empty file. Handy for tests.

Definition at line 582 of file blendfile.c.

References BKE_id_delete(), C, CTX_data_main(), ELEM, FOREACH_MAIN_LISTBASE_BEGIN, FOREACH_MAIN_LISTBASE_END, FOREACH_MAIN_LISTBASE_ID_BEGIN, FOREACH_MAIN_LISTBASE_ID_END, GS, id, ID_SCE, ID_SCR, ID_WM, ID_WS, and ID::name.

Referenced by wm_homefile_read_ex().

◆ BKE_blendfile_read_setup()

void BKE_blendfile_read_setup ( struct bContext C,
struct BlendFileData bfd,
const struct BlendFileReadParams params,
struct BlendFileReadReport reports 
)

Definition at line 506 of file blendfile.c.

References BKE_blendfile_read_setup_ex(), C, NULL, and params.

Referenced by BKE_memfile_undo_decode(), and WM_file_read().

◆ BKE_blendfile_read_setup_ex()

void BKE_blendfile_read_setup_ex ( struct bContext C,
struct BlendFileData bfd,
const struct BlendFileReadParams params,
struct BlendFileReadReport reports,
bool  startup_update_defaults,
const char *  startup_app_template 
)

Shared setup function that makes the data from bfd into the current blend file, replacing the contents of #G.main. This uses the bfd BKE_blendfile_read and similarly named functions.

This is done in a separate step so the caller may perform actions after it is known the file loaded correctly but before the file replaces the existing blend file contents.

Definition at line 482 of file blendfile.c.

References BKE_reports_prepend(), BLO_blendfiledata_free(), BLO_READ_SKIP_DATA, BLO_update_defaults_startup_blend(), C, Main::is_read_invalid, BlendFileData::main, params, BlendFileReadReport::reports, and setup_app_blend_file_data().

Referenced by BKE_blendfile_read_setup(), and wm_homefile_read_ex().

◆ BKE_blendfile_userdef_from_defaults()

struct UserDef* BKE_blendfile_userdef_from_defaults ( void  )

◆ BKE_blendfile_userdef_read()

struct UserDef* BKE_blendfile_userdef_read ( const char *  filepath,
struct ReportList reports 
)

◆ BKE_blendfile_userdef_read_from_memory()

struct UserDef* BKE_blendfile_userdef_read_from_memory ( const void filebuf,
int  filelength,
struct ReportList reports 
)

◆ BKE_blendfile_userdef_write()

bool BKE_blendfile_userdef_write ( const char *  filepath,
struct ReportList reports 
)

Only write the UserDef in a .blend.

Returns
success.

Definition at line 712 of file blendfile.c.

References BLO_write_file(), BlendFileData::filepath, MEM_callocN, and MEM_freeN.

Referenced by BKE_blendfile_userdef_write_all(), and BKE_blendfile_userdef_write_app_template().

◆ BKE_blendfile_userdef_write_all()

bool BKE_blendfile_userdef_write_all ( struct ReportList reports)

◆ BKE_blendfile_userdef_write_app_template()

bool BKE_blendfile_userdef_write_app_template ( const char *  filepath,
struct ReportList reports 
)

Only write the UserDef in a .blend, merging with the existing blend file.

Returns
success.
Note
In the future we should re-evaluate user preferences, possibly splitting out system/hardware specific preferences.

Definition at line 732 of file blendfile.c.

References BKE_blender_userdef_app_template_data_swap(), BKE_blender_userdef_data_free(), BKE_blendfile_userdef_read(), BKE_blendfile_userdef_write(), BlendFileData::filepath, MEM_freeN, and NULL.

Referenced by BKE_blendfile_userdef_write_all().

◆ BKE_blendfile_workspace_config_data_free()

void BKE_blendfile_workspace_config_data_free ( struct WorkspaceConfigFileData workspace_config)

Definition at line 860 of file blendfile.c.

References BKE_main_free(), WorkspaceConfigFileData::main, and MEM_freeN.

Referenced by workspace_add_menu().

◆ BKE_blendfile_workspace_config_read()

struct WorkspaceConfigFileData* BKE_blendfile_workspace_config_read ( const char *  filepath,
const void filebuf,
int  filelength,
struct ReportList reports 
)

◆ BKE_blendfile_workspace_config_write()

bool BKE_blendfile_workspace_config_write ( struct Main bmain,
const char *  filepath,
struct ReportList reports 
)

◆ BKE_blendfile_write_partial()

bool BKE_blendfile_write_partial ( struct Main bmain_src,
const char *  filepath,
int  write_flags,
int  remap_mode,
struct ReportList reports 
)

◆ BKE_blendfile_write_partial_begin()

void BKE_blendfile_write_partial_begin ( struct Main bmain_src)

◆ BKE_blendfile_write_partial_end()

void BKE_blendfile_write_partial_end ( struct Main bmain_src)

◆ BKE_blendfile_write_partial_tag_ID()

void BKE_blendfile_write_partial_tag_ID ( struct ID id,
bool  set 
)