Blender  V2.93
Functions
BKE_blendfile.h File Reference

Go to the source code of this file.

Functions

void BKE_blendfile_read_setup_ex (struct bContext *C, struct BlendFileData *bfd, const struct BlendFileReadParams *params, struct ReportList *reports, const 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 ReportList *reports)
 
struct BlendFileDataBKE_blendfile_read (const char *filepath, const struct BlendFileReadParams *params, struct ReportList *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, const int write_flags, const int remap_mode, struct ReportList *reports)
 
void BKE_blendfile_write_partial_end (struct Main *bmain_src)
 

Function Documentation

◆ BKE_blendfile_read()

struct BlendFileData* BKE_blendfile_read ( const char *  filepath,
const struct BlendFileReadParams params,
ReportList reports 
)
Returns
Blend file data, this must be passed to BKE_blendfile_read_setup when non-NULL.

Definition at line 470 of file blendfile.c.

References BKE_reports_prependf(), BLO_read_from_file(), handle_subversion_warning(), BlendFileData::main, and params.

Referenced by BKE_memfile_undo_decode(), WM_file_read(), and wm_homefile_read().

◆ BKE_blendfile_read_from_memfile()

struct BlendFileData* BKE_blendfile_read_from_memfile ( Main bmain,
struct MemFile memfile,
const struct BlendFileReadParams params,
ReportList reports 
)
Returns
Blend file data, this must be passed to BKE_blendfile_read_setup when non-NULL.
Note
memfile is the undo buffer.

Definition at line 511 of file blendfile.c.

References BKE_main_blendfile_path(), BKE_reports_prepend(), BLI_assert, BLI_listbase_is_empty(), BLO_read_from_memfile(), BlendFileData::main, params, Main::screens, Main::wm, and Main::workspaces.

Referenced by BKE_memfile_undo_decode().

◆ BKE_blendfile_read_from_memory()

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

Definition at line 492 of file blendfile.c.

References BKE_reports_prepend(), BLO_read_from_memory(), and params.

Referenced by wm_homefile_read().

◆ BKE_blendfile_read_make_empty()

void BKE_blendfile_read_make_empty ( bContext C)

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

Definition at line 537 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().

◆ BKE_blendfile_read_setup()

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

Definition at line 459 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 ( bContext C,
BlendFileData bfd,
const struct BlendFileReadParams params,
ReportList reports,
const 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 442 of file blendfile.c.

References BLO_blendfiledata_free(), BLO_READ_SKIP_DATA, BLO_update_defaults_startup_blend(), C, BlendFileData::main, params, and setup_app_blend_file_data().

Referenced by BKE_blendfile_read_setup(), and wm_homefile_read().

◆ 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,
ReportList reports 
)

Only write the userdef in a .blend

Returns
success

Definition at line 673 of file blendfile.c.

References BLO_write_file(), 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,
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 prefs.

Definition at line 700 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(), 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 825 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 ( Main bmain_src,
const char *  filepath,
const int  write_flags,
const int  remap_mode,
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 
)