2022-02-11 09:07:11 +11:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
* Copyright 2007 Blender Foundation. All rights reserved. */
|
2011-02-25 14:04:21 +00:00
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
|
* \ingroup wm
|
2011-02-25 14:04:21 +00:00
|
|
|
*/
|
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#pragma once
|
2007-12-24 18:27:28 +00:00
|
|
|
|
2018-06-14 12:34:13 +02:00
|
|
|
struct Main;
|
2021-08-12 14:50:40 +10:00
|
|
|
struct wmFileReadPost_Params;
|
2019-05-20 16:52:49 +10:00
|
|
|
struct wmGenericCallback;
|
2016-04-19 17:08:31 +02:00
|
|
|
struct wmOperatorType;
|
|
|
|
|
|
2020-07-28 16:32:30 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2016-04-19 17:08:31 +02:00
|
|
|
/* wm_files.c */
|
2021-12-08 17:12:41 +11:00
|
|
|
|
2018-11-30 13:21:12 +11:00
|
|
|
void wm_history_file_read(void);
|
2021-08-12 14:24:27 +10:00
|
|
|
|
|
|
|
|
struct wmHomeFileRead_Params {
|
|
|
|
|
/** Load data, disable when only loading user preferences. */
|
|
|
|
|
unsigned int use_data : 1;
|
|
|
|
|
/** Load factory settings as well as startup file (disabled for "File New"). */
|
|
|
|
|
unsigned int use_userdef : 1;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Ignore on-disk startup file, use bundled `datatoc_startup_blend` instead.
|
|
|
|
|
* Used for "Restore Factory Settings".
|
|
|
|
|
*/
|
|
|
|
|
unsigned int use_factory_settings : 1;
|
|
|
|
|
/**
|
|
|
|
|
* Load the startup file without any data-blocks.
|
|
|
|
|
* Useful for automated content generation, so the file starts without data.
|
|
|
|
|
*/
|
|
|
|
|
unsigned int use_empty_data : 1;
|
|
|
|
|
/**
|
|
|
|
|
* Optional path pointing to an alternative blend file (may be NULL).
|
|
|
|
|
*/
|
|
|
|
|
const char *filepath_startup_override;
|
|
|
|
|
/**
|
|
|
|
|
* Template to use instead of the template defined in user-preferences.
|
|
|
|
|
* When not-null, this is written into the user preferences.
|
|
|
|
|
*/
|
|
|
|
|
const char *app_template_override;
|
|
|
|
|
};
|
|
|
|
|
|
2021-12-08 17:12:41 +11:00
|
|
|
/**
|
|
|
|
|
* Called on startup, (context entirely filled with NULLs)
|
|
|
|
|
* or called for 'New File' both `startup.blend` and `userpref.blend` are checked.
|
|
|
|
|
*
|
|
|
|
|
* \param r_params_file_read_post: Support 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.
|
|
|
|
|
*/
|
2021-08-12 14:24:27 +10:00
|
|
|
void wm_homefile_read_ex(struct bContext *C,
|
|
|
|
|
const struct wmHomeFileRead_Params *params_homefile,
|
|
|
|
|
struct ReportList *reports,
|
2021-08-12 14:50:40 +10:00
|
|
|
struct wmFileReadPost_Params **r_params_file_read_post);
|
2018-11-30 13:21:12 +11:00
|
|
|
void wm_homefile_read(struct bContext *C,
|
2021-08-12 14:24:27 +10:00
|
|
|
const struct wmHomeFileRead_Params *params_homefile,
|
|
|
|
|
struct ReportList *reports);
|
|
|
|
|
|
2021-12-08 17:12:41 +11:00
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
2021-08-12 14:50:40 +10:00
|
|
|
void wm_homefile_read_post(struct bContext *C,
|
|
|
|
|
const struct wmFileReadPost_Params *params_file_read_post);
|
|
|
|
|
|
2018-06-14 12:34:13 +02:00
|
|
|
void wm_file_read_report(bContext *C, struct Main *bmain);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2019-05-20 16:52:49 +10:00
|
|
|
void wm_close_file_dialog(bContext *C, struct wmGenericCallback *post_action);
|
2021-12-08 17:12:41 +11:00
|
|
|
/**
|
|
|
|
|
* \return True if the dialog was created, the calling operator should return #OPERATOR_INTERFACE
|
|
|
|
|
* then.
|
|
|
|
|
*/
|
2021-04-24 00:03:14 +10:00
|
|
|
bool wm_operator_close_file_dialog_if_needed(bContext *C,
|
|
|
|
|
wmOperator *op,
|
|
|
|
|
wmGenericCallbackFn exec_fn);
|
2021-12-08 17:12:41 +11:00
|
|
|
/**
|
|
|
|
|
* Check if there is data that would be lost when closing the current file without saving.
|
|
|
|
|
*/
|
2021-10-19 18:07:22 +02:00
|
|
|
bool wm_file_or_session_data_has_unsaved_changes(const Main *bmain, const wmWindowManager *wm);
|
2019-05-17 17:31:26 +02:00
|
|
|
|
2016-04-19 17:08:31 +02:00
|
|
|
void WM_OT_save_homefile(struct wmOperatorType *ot);
|
|
|
|
|
void WM_OT_save_userpref(struct wmOperatorType *ot);
|
2019-05-13 12:44:08 +10:00
|
|
|
void WM_OT_read_userpref(struct wmOperatorType *ot);
|
2019-05-13 13:25:51 +10:00
|
|
|
void WM_OT_read_factory_userpref(struct wmOperatorType *ot);
|
2016-04-19 17:08:31 +02:00
|
|
|
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);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-04-19 17:08:31 +02:00
|
|
|
void WM_OT_open_mainfile(struct wmOperatorType *ot);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-04-19 17:08:31 +02:00
|
|
|
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);
|
2019-04-17 06:17:24 +02:00
|
|
|
|
2016-04-19 17:08:31 +02:00
|
|
|
void WM_OT_save_as_mainfile(struct wmOperatorType *ot);
|
|
|
|
|
void WM_OT_save_mainfile(struct wmOperatorType *ot);
|
|
|
|
|
|
|
|
|
|
/* wm_files_link.c */
|
2021-12-08 17:12:41 +11:00
|
|
|
|
2016-04-19 17:08:31 +02:00
|
|
|
void WM_OT_link(struct wmOperatorType *ot);
|
|
|
|
|
void WM_OT_append(struct wmOperatorType *ot);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2016-06-22 18:05:55 +02:00
|
|
|
void WM_OT_lib_relocate(struct wmOperatorType *ot);
|
|
|
|
|
void WM_OT_lib_reload(struct wmOperatorType *ot);
|
|
|
|
|
|
2020-07-28 16:32:30 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|