Blender  V3.3
Classes | Functions
wm_files.h File Reference

Go to the source code of this file.

Classes

struct  wmHomeFileRead_Params
 

Functions

void wm_history_file_read (void)
 
void wm_homefile_read_ex (struct bContext *C, const struct wmHomeFileRead_Params *params_homefile, struct ReportList *reports, struct wmFileReadPost_Params **r_params_file_read_post)
 
void wm_homefile_read (struct bContext *C, const struct wmHomeFileRead_Params *params_homefile, struct ReportList *reports)
 
void wm_homefile_read_post (struct bContext *C, const struct wmFileReadPost_Params *params_file_read_post)
 
void wm_file_read_report (bContext *C, struct Main *bmain)
 
void wm_close_file_dialog (bContext *C, struct wmGenericCallback *post_action)
 
bool wm_operator_close_file_dialog_if_needed (bContext *C, wmOperator *op, wmGenericCallbackFn exec_fn)
 
bool wm_file_or_session_data_has_unsaved_changes (const Main *bmain, const wmWindowManager *wm)
 
void wm_save_file_forwardcompat_dialog (bContext *C, wmOperator *op)
 
void WM_OT_save_homefile (struct wmOperatorType *ot)
 
void WM_OT_save_userpref (struct wmOperatorType *ot)
 
void WM_OT_read_userpref (struct wmOperatorType *ot)
 
void WM_OT_read_factory_userpref (struct wmOperatorType *ot)
 
void WM_OT_read_history (struct wmOperatorType *ot)
 
void WM_OT_read_homefile (struct wmOperatorType *ot)
 
void WM_OT_read_factory_settings (struct wmOperatorType *ot)
 
void WM_OT_open_mainfile (struct wmOperatorType *ot)
 
void WM_OT_revert_mainfile (struct wmOperatorType *ot)
 
void WM_OT_recover_last_session (struct wmOperatorType *ot)
 
void WM_OT_recover_auto_save (struct wmOperatorType *ot)
 
void WM_OT_save_as_mainfile (struct wmOperatorType *ot)
 
void WM_OT_save_mainfile (struct wmOperatorType *ot)
 
void WM_OT_link (struct wmOperatorType *ot)
 
void WM_OT_append (struct wmOperatorType *ot)
 
void WM_OT_lib_relocate (struct wmOperatorType *ot)
 
void WM_OT_lib_reload (struct wmOperatorType *ot)
 

Function Documentation

◆ wm_close_file_dialog()

void wm_close_file_dialog ( bContext C,
struct wmGenericCallback post_action 
)

◆ wm_file_or_session_data_has_unsaved_changes()

bool wm_file_or_session_data_has_unsaved_changes ( const Main bmain,
const wmWindowManager wm 
)

Check if there is data that would be lost when closing the current file without saving.

Definition at line 160 of file wm_files.c.

References BKE_asset_library_has_any_unsaved_catalogs(), ED_image_should_save_modified(), and wmWindowManager::file_saved.

Referenced by wm_operator_close_file_dialog_if_needed(), and wm_quit_with_optional_confirmation_prompt().

◆ wm_file_read_report()

void wm_file_read_report ( bContext C,
struct Main bmain 
)

◆ wm_history_file_read()

void wm_history_file_read ( void  )

◆ wm_homefile_read()

void wm_homefile_read ( struct bContext C,
const struct wmHomeFileRead_Params params_homefile,
struct ReportList reports 
)

Definition at line 1371 of file wm_files.c.

References C, NULL, and wm_homefile_read_ex().

Referenced by wm_homefile_read_exec(), and wm_userpref_read_exec().

◆ wm_homefile_read_ex()

void wm_homefile_read_ex ( struct bContext C,
const struct wmHomeFileRead_Params params_homefile,
struct ReportList reports,
struct wmFileReadPost_Params **  r_params_file_read_post 
)

Called on startup, (context entirely filled with NULLs) or called for 'New File' both startup.blend and userpref.blend are checked.

Parameters
r_params_file_read_postSupport postponed initialization, needed for initial startup when only some sub-systems have been initialized. When non-null, wm_file_read_post doesn't run, instead it's arguments are stored in this return argument. The caller is responsible for calling wm_homefile_read_post with this return argument.

Definition at line 1048 of file wm_files.c.

References app_template, wmHomeFileRead_Params::app_template_override, BKE_appdir_app_template_id_search(), BKE_appdir_folder_id(), BKE_blender_userdef_app_template_data_set_and_free(), BKE_blender_userdef_data_set_and_free(), BKE_blendfile_read(), BKE_blendfile_read_from_memory(), BKE_blendfile_read_make_empty(), BKE_blendfile_read_setup_ex(), BKE_blendfile_userdef_from_defaults(), BKE_blendfile_userdef_read(), BKE_reportf(), BLENDER_STARTUP_FILE, BLENDER_USER_CONFIG, BLENDER_USERPREF_FILE, BLI_access(), BLI_assert, BLI_exists(), BLI_listbase_is_empty(), BLI_path_join(), BLI_strncpy(), BLO_READ_SKIP_DATA, BLO_READ_SKIP_USERDEF, BPY_run_string_eval(), C, CTX_data_main(), CTX_py_init_get(), CTX_wm_window_set(), datatoc_startup_blend, datatoc_startup_blend_size, FILE_MAX, Main::filepath, wmHomeFileRead_Params::filepath_startup_override, G, G_FILE_NO_UI, G_FLAG_SCRIPT_AUTOEXEC, G_FLAG_SCRIPT_OVERRIDE_PREF, G_MAIN, wmFileReadPost_Params::is_factory_startup, KEYCONF_INIT_DEFAULT, LISTBASE_FOREACH, MEM_mallocN, NULL, params, BlendFileReadReport::reports, wmFileReadPost_Params::reset_app_template, RPT_ERROR, RPT_WARNING, SET_FLAG_FROM_TEST, BlendFileReadParams::skip_flags, STREQ, wmFileReadPost_Params::use_data, wmHomeFileRead_Params::use_data, wmHomeFileRead_Params::use_empty_data, wmHomeFileRead_Params::use_factory_settings, wmFileReadPost_Params::use_userdef, wmHomeFileRead_Params::use_userdef, USER_SCRIPT_AUTOEXEC_DISABLE, Main::wm, WM_check(), wm_clear_default_size(), wm_file_read_post(), wm_file_read_pre(), wm_init_userdef(), wm_window_match_do(), and wm_window_match_init().

Referenced by wm_homefile_read(), and WM_init().

◆ wm_homefile_read_post()

void wm_homefile_read_post ( struct bContext C,
const struct wmFileReadPost_Params params_file_read_post 
)

Special case, support deferred execution of wm_file_read_post, Needed when loading for the first time to workaround order of initialization bug, see T89046.

Definition at line 1378 of file wm_files.c.

References C, MEM_freeN, and wm_file_read_post().

Referenced by WM_init().

◆ wm_operator_close_file_dialog_if_needed()

bool wm_operator_close_file_dialog_if_needed ( bContext C,
wmOperator op,
wmGenericCallbackFn  exec_fn 
)

◆ WM_OT_append()

void WM_OT_append ( struct wmOperatorType ot)

◆ WM_OT_lib_reload()

void WM_OT_lib_reload ( struct wmOperatorType ot)

◆ WM_OT_lib_relocate()

void WM_OT_lib_relocate ( struct wmOperatorType ot)

◆ WM_OT_link()

void WM_OT_link ( struct wmOperatorType ot)

◆ WM_OT_open_mainfile()

void WM_OT_open_mainfile ( struct wmOperatorType ot)

◆ WM_OT_read_factory_settings()

void WM_OT_read_factory_settings ( struct wmOperatorType ot)

◆ WM_OT_read_factory_userpref()

void WM_OT_read_factory_userpref ( struct wmOperatorType ot)

◆ WM_OT_read_history()

void WM_OT_read_history ( struct wmOperatorType ot)

◆ WM_OT_read_homefile()

void WM_OT_read_homefile ( struct wmOperatorType ot)

◆ WM_OT_read_userpref()

void WM_OT_read_userpref ( struct wmOperatorType ot)

◆ WM_OT_recover_auto_save()

void WM_OT_recover_auto_save ( struct wmOperatorType ot)

◆ WM_OT_recover_last_session()

void WM_OT_recover_last_session ( struct wmOperatorType ot)

◆ WM_OT_revert_mainfile()

void WM_OT_revert_mainfile ( struct wmOperatorType ot)

◆ WM_OT_save_as_mainfile()

void WM_OT_save_as_mainfile ( struct wmOperatorType ot)

◆ WM_OT_save_homefile()

void WM_OT_save_homefile ( struct wmOperatorType ot)

◆ WM_OT_save_mainfile()

void WM_OT_save_mainfile ( struct wmOperatorType ot)

◆ WM_OT_save_userpref()

void WM_OT_save_userpref ( struct wmOperatorType ot)

◆ wm_save_file_forwardcompat_dialog()

void wm_save_file_forwardcompat_dialog ( bContext C,
wmOperator op 
)

Confirmation dialog when user is about to save the current blend file, and it was prviously created by a newer version of Blender.

Important to ask confirmation, as this is a very common scenario of data loss.

Definition at line 3721 of file wm_files.c.

References block_create_save_file_forwardcompat_dialog(), C, callback, CTX_wm_screen(), free_post_file_close_action(), IDP_CopyProperty(), MEM_callocN, NULL, wmOperator::properties, save_file_forwardcompat_dialog_name, UI_popup_block_invoke(), UI_popup_block_name_exists(), and wm_free_operator_properties_callback().

Referenced by wm_save_mainfile_invoke().