41 # define _WIN32_IE 0x0400
59 #include BLI_SYSTEM_PID_H
278 if (screen->
winid == 0) {
284 bmain, workspace, layout_old, win);
290 win_screen->
winid = win->winid;
294 *r_new_wm_list = *current_wm_list;
334 bool has_match =
false;
360 if (oldwin->winid == win->winid) {
374 *r_new_wm_list = *readfile_wm_list;
397 *r_new_wm_list = bmain->
wm;
401 *r_new_wm_list = *readfile_wm_list;
410 C, current_wm_list, (
G.fileflags &
G_FILE_NO_UI) == 0, r_new_wm_list);
461 #define BKE_READ_EXOTIC_FAIL_PATH -3
462 #define BKE_READ_EXOTIC_FAIL_FORMAT -2
463 #define BKE_READ_EXOTIC_FAIL_OPEN -1
464 #define BKE_READ_EXOTIC_OK_BLEND 0
466 # define BKE_READ_EXOTIC_OK_OTHER 1
489 if (
len > 0 &&
ELEM(name[
len - 1],
'/',
'\\')) {
494 if (gzfile ==
NULL) {
498 len = gzread(gzfile, header,
sizeof(header));
500 if (
len ==
sizeof(header) &&
STREQLEN(header,
"BLENDER", 7)) {
511 if (is_foo_format(name)) {
513 retval = BKE_READ_EXOTIC_OK_OTHER;
557 if (reports ==
NULL) {
563 "Engine '%s' not available for scene '%s' (an add-on may need to be installed "
600 const bool is_startup_file,
601 const bool is_factory_startup,
603 const bool use_userdef,
604 const bool reset_app_template)
606 bool addons_loaded =
false;
618 if (is_startup_file) {
624 bool reset_all = use_userdef;
625 if (use_userdef || reset_app_template) {
629 C, (
const char *[]){
"bl_app_template_utils",
NULL},
"bl_app_template_utils.reset()");
636 (
const char *[]){
"bpy",
"addon_utils",
NULL},
641 "bpy.utils.refresh_script_paths()\n"
643 "addon_utils.reset_all()");
648 addons_loaded =
true;
656 addons_loaded =
true;
665 if (is_factory_startup) {
674 if (is_factory_startup) {
739 const bool do_history_file_update = (
G.background ==
false) &&
741 bool success =
false;
743 const bool use_data =
true;
744 const bool use_userdef =
false;
777 const int G_f_orig =
G.f;
781 if (
G.f != G_f_orig) {
784 G.f = (
G.f & ~flags_keep) | (G_f_orig & flags_keep);
804 if (do_history_file_update) {
814 else if (retval == BKE_READ_EXOTIC_OK_OTHER) {
815 BKE_undo_write(
C,
"Import file");
821 "Cannot read file '%s': %s",
823 errno ? strerror(errno) :
TIP_(
"unable to open the file"));
836 if (success ==
false) {
838 if (do_history_file_update) {
906 bool use_factory_settings,
910 const char *filepath_startup_override,
911 const char *app_template_override,
912 bool *r_is_factory_startup)
916 bool success =
false;
918 bool filepath_startup_is_factory =
true;
931 if (use_data ==
false) {
934 if (use_userdef ==
false) {
940 bool is_factory_startup =
true;
943 bool update_defaults =
false;
945 if (filepath_startup_override !=
NULL) {
948 else if (app_template_override) {
952 else if (!use_factory_settings &&
U.app_template[0]) {
956 const bool reset_app_template = ((!
app_template &&
U.app_template[0]) ||
960 BLI_assert((use_factory_settings && filepath_startup_override) == 0);
967 if (reset_app_template) {
973 if (use_userdef || reset_app_template) {
1000 filepath_startup[0] =
'\0';
1001 filepath_userdef[0] =
'\0';
1002 app_template_system[0] =
'\0';
1003 app_template_config[0] =
'\0';
1006 if (!use_factory_settings) {
1010 filepath_startup_is_factory =
false;
1017 use_factory_settings =
true;
1020 if (filepath_startup_override) {
1022 filepath_startup_is_factory =
false;
1028 if (!use_factory_settings &&
BLI_exists(filepath_userdef)) {
1030 if (userdef !=
NULL) {
1035 printf(
"Read prefs: %s\n", filepath_userdef);
1042 app_template, app_template_system,
sizeof(app_template_system))) {
1051 if (!use_factory_settings) {
1054 sizeof(filepath_startup),
1055 app_template_config,
1058 filepath_startup_is_factory =
false;
1059 if (
BLI_access(filepath_startup, R_OK) != 0) {
1060 filepath_startup[0] =
'\0';
1064 filepath_startup[0] =
'\0';
1067 if (filepath_startup[0] ==
'\0') {
1069 sizeof(filepath_startup),
1070 app_template_system,
1073 filepath_startup_is_factory =
true;
1076 update_defaults =
true;
1080 if (!use_factory_settings || (filepath_startup[0] !=
'\0')) {
1081 if (
BLI_access(filepath_startup, R_OK) == 0) {
1095 is_factory_startup = filepath_startup_is_factory;
1107 if (success ==
false && filepath_startup_override && reports) {
1112 if (success ==
false) {
1129 if (use_empty_data) {
1136 if (app_template_system[0] !=
'\0') {
1138 temp_path[0] =
'\0';
1139 if (!use_factory_settings) {
1143 temp_path[0] =
'\0';
1147 if (temp_path[0] ==
'\0') {
1158 if (userdef_template ==
NULL) {
1162 if (userdef_template) {
1164 userdef_template =
NULL;
1169 if (app_template_override) {
1170 BLI_strncpy(
U.app_template, app_template_override,
sizeof(
U.app_template));
1189 if (wm->defaultconf) {
1198 bmain->
name[0] =
'\0';
1204 wm_file_read_post(
C,
true, is_factory_startup, use_data, use_userdef, reset_app_template);
1206 if (r_is_factory_startup) {
1207 *r_is_factory_startup = is_factory_startup;
1235 for (
l = lines, num = 0;
l && (num <
U.recent_files);
l =
l->
next) {
1281 const char *user_config_dir;
1287 if (!user_config_dir) {
1296 fprintf(fp,
"%s\n", recent->filepath);
1311 if (blendfile_name[0] ==
'\0') {
1315 recent =
G.recent_files.first;
1325 for (recent =
BLI_findlink(&
G.recent_files,
U.recent_files - 1); recent;
1326 recent = recent_next) {
1327 recent_next = recent->
next;
1360 const float pixelsize_old =
U.pixelsize;
1362 char err_out[256] =
"unknown";
1384 v3d =
area->spacedata.first;
1430 U.pixelsize = pixelsize_old;
1433 if (windrawable_old) {
1447 CLOG_WARN(&
LOG,
"failed to create thumbnail: %s", err_out);
1465 printf(
"written: %s\n", path);
1468 printf(
"failed: %s\n", path);
1479 bool use_save_as_copy,
1558 .remap_mode = remap_mode,
1559 .use_save_versions =
true,
1560 .use_save_as_copy = use_save_as_copy,
1564 const bool do_history_file_update = (
G.background ==
false) &&
1567 if (use_save_as_copy ==
false) {
1568 G.relbase_valid = 1;
1577 if (do_history_file_update) {
1599 if (thumb && thumb != main_thumb) {
1616 const int pid =
abs(getpid());
1619 const char *savedir;
1622 if (
G_MAIN &&
G.relbase_valid) {
1628 BLI_snprintf(path,
sizeof(path),
"%d_autosave.blend", pid);
1659 if (memfile !=
NULL) {
1665 CLOG_WARN(&
LOG,
"undo-data not found for writing, fallback to regular file write!");
1806 if (cfgdir ==
NULL) {
1823 printf(
"Writing homefile: '%s' ",
filepath);
1839 .use_save_as_copy =
true,
1857 ot->
name =
"Save Startup File";
1858 ot->
idname =
"WM_OT_save_homefile";
1859 ot->
description =
"Make the current file the default .blend file";
1886 ot->
name =
"Save Preferences";
1887 ot->
idname =
"WM_OT_save_userpref";
1905 #define USERDEF_RESTORE(member) \
1907 userdef_curr->member = userdef_prev->member; \
1914 #undef USERDEF_RESTORE
1971 const bool use_data =
false;
1972 const bool use_userdef =
true;
1973 const bool use_factory_settings =
STREQ(op->
type->
idname,
"WM_OT_read_factory_userpref");
1979 use_factory_settings,
1994 if (use_factory_settings) {
1995 U.runtime.is_dirty =
true;
2008 ot->
name =
"Load Preferences";
2009 ot->
idname =
"WM_OT_read_userpref";
2018 ot->
name =
"Load Factory Preferences";
2019 ot->
idname =
"WM_OT_read_factory_userpref";
2021 "Load factory default preferences. "
2022 "To make changes to preferences permanent, use \"Save Preferences\"";
2043 ot->
name =
"Reload History File";
2065 "WM_OT_read_factory_settings");
2066 const bool use_factory_settings = use_factory_startup_and_userdef ||
2068 bool use_userdef =
false;
2073 if (!use_factory_settings) {
2092 if (use_factory_startup_and_userdef) {
2100 char app_template_buf[
sizeof(
U.app_template)];
2103 const bool use_splash = !use_factory_settings &&
RNA_boolean_get(op->
ptr,
"use_splash");
2110 if (!use_factory_settings) {
2124 bool use_data =
true;
2127 use_factory_settings,
2142 if (use_factory_settings) {
2143 U.runtime.is_dirty =
true;
2194 ot->
name =
"Reload Start-Up File";
2195 ot->
idname =
"WM_OT_read_homefile";
2196 ot->
description =
"Open the default file (doesn't save the current file)";
2202 ot->
srna,
"filepath",
NULL,
FILE_MAX,
"File Path",
"Path to an alternative start-up file");
2207 ot->
srna,
"load_ui",
true,
"Load UI",
"Load user interface setup from the .blend file");
2227 ot->
name =
"Load Factory Settings";
2228 ot->
idname =
"WM_OT_read_factory_settings";
2230 "Load factory default startup file and preferences. "
2231 "To make changes permanent, use \"Save Startup File\" and \"Save Preferences\"";
2295 for (
int i = 0; targets[i].
run; i++) {
2298 return target.
run(
C, op);
2362 if (
G.recent_files.first) {
2440 if (
BLI_stat(path, &stats) == -1) {
2447 bool is_today, is_yesterday;
2449 NULL, (
int64_t)stats.st_mtime,
false, time_st, date_st, &is_today, &is_yesterday);
2450 if (is_today || is_yesterday) {
2451 BLI_strncpy(date_st, is_today ?
N_(
"Today") :
N_(
"Yesterday"),
sizeof(date_st));
2459 "%s\n\n%s: %s %s\n%s: %s", path,
N_(
"Modified"), date_st, time_st,
N_(
"Size"), size_str);
2467 "Struct must not exceed pointer size");
2482 *(lslash + 1) =
'\0';
2504 const char *autoexec_text;
2510 autoexec_text =
IFACE_(
"Trusted Source [Untrusted Path]");
2515 autoexec_text =
IFACE_(
"Trusted Source");
2518 uiItemR(
col, op->
ptr,
"use_scripts", 0, autoexec_text, ICON_NONE);
2527 "Allow .blend file to execute scripts automatically, default available from "
2528 "system preferences");
2534 ot->
idname =
"WM_OT_open_mainfile";
2553 ot->
srna,
"load_ui",
true,
"Load UI",
"Load user interface setup in the .blend file");
2558 ot->
srna,
"display_file_selector",
true,
"Display File Selector",
"");
2591 return G.relbase_valid;
2597 ot->
idname =
"WM_OT_revert_mainfile";
2628 if (!
G.background) {
2650 ot->
name =
"Recover Last Session";
2651 ot->
idname =
"WM_OT_recover_last_session";
2683 if (!
G.background) {
2709 ot->
name =
"Recover Auto Save";
2710 ot->
idname =
"WM_OT_recover_auto_save";
2711 ot->
description =
"Open an automatically saved file to recover it";
2737 if (
G.save_over ==
false) {
2815 const int fileflags_orig =
G.fileflags;
2816 int fileflags =
G.fileflags;
2827 G.fileflags = fileflags_orig;
2872 "Save the current file in the desired location but do not make the saved file active");
2882 ot->
idname =
"WM_OT_save_as_mainfile";
2883 ot->
description =
"Save the current file in the desired location";
2904 "Remap relative paths when saving to a different directory");
2910 "Save a copy of the actual working state but does not make saved file active");
2952 ot->
name =
"Save Blender File";
2953 ot->
idname =
"WM_OT_save_mainfile";
2974 "Remap relative paths when saving to a different directory");
3051 TIP_(
"For security reasons, automatic execution of Python scripts "
3052 "in this file was disabled:"),
3057 uiItemL(
col,
TIP_(
"This may lead to unexpected behavior"), ICON_NONE);
3065 "use_scripts_auto_execute",
3067 TIP_(
"Permanently allow execution of scripts"),
3090 IFACE_(
"Allow Execution"),
3100 TIP_(
"Reload file with execution of Python scripts enabled"));
3108 IFACE_(
"Allow Execution"),
3118 TIP_(
"Enable scripts"));
3138 TIP_(
"Continue using file without Python scripts"));
3253 bool execute_callback =
true;
3266 execute_callback =
false;
3272 if (file_has_been_saved_before) {
3277 execute_callback =
false;
3280 if (execute_callback) {
3289 block,
UI_BTYPE_BUT, 0, 0,
IFACE_(
"Cancel"), 0, 0, 0,
UI_UNIT_Y, 0, 0, 0, 0, 0,
"");
3297 block,
UI_BTYPE_BUT, 0, 0,
IFACE_(
"Don't Save"), 0, 0, 0,
UI_UNIT_Y, 0, 0, 0, 0, 0,
"");
3305 block,
UI_BTYPE_BUT, 0, 0,
IFACE_(
"Save"), 0, 0, 0,
UI_UNIT_Y, 0, 0, 0, 0, 0,
"");
3328 uiItemL_ex(layout,
TIP_(
"Save changes before closing?"), ICON_NONE,
true,
false);
3333 if (blendfile_pathpath[0] !=
'\0') {
3339 uiItemL(layout, filename, ICON_NONE);
3354 char *message =
BLI_strdupn(report->message, report->len);
3355 char *path_info = strstr(message,
": ");
3358 path_info[1] =
'\0';
3362 uiItemL_ex(row, message, ICON_NONE,
false,
true);
3364 uiItemL_ex(row, path_info, ICON_NONE,
false,
true);
3370 if (modified_images_count > 0) {
3372 BLI_snprintf(message,
sizeof(message),
"Save %u modified image(s)", modified_images_count);
3393 uiItemS_ex(layout, modified_images_count > 0 ? 2.0f : 4.0f);
3397 const bool windows_layout =
true;
3399 const bool windows_layout =
false;
3402 if (windows_layout) {
bool BKE_addon_remove_safe(struct ListBase *addon_list, const char *module)
bool BKE_appdir_app_template_any(void)
const char * BKE_appdir_folder_id_create(const int folder_id, const char *subfolder)
void BKE_tempdir_init(const char *userdir)
#define BLENDER_USERPREF_FILE
bool BKE_appdir_app_template_has_userpref(const char *app_template)
const char * BKE_appdir_folder_id(const int folder_id, const char *subfolder)
#define BLENDER_HISTORY_FILE
#define BLENDER_STARTUP_FILE
bool BKE_appdir_app_template_id_search(const char *app_template, char *path, size_t path_len)
#define BLENDER_QUIT_FILE
const char * BKE_tempdir_base(void)
bool BKE_autoexec_match(const char *path)
void BKE_blender_userdef_data_set_and_free(struct UserDef *userdef)
void BKE_blender_userdef_app_template_data_set_and_free(struct UserDef *userdef)
void BKE_blendfile_read_setup(struct bContext *C, struct BlendFileData *bfd, const struct BlendFileReadParams *params, struct ReportList *reports)
struct UserDef * BKE_blendfile_userdef_read(const char *filepath, struct ReportList *reports)
struct BlendFileData * BKE_blendfile_read_from_memory(const void *filebuf, int filelength, const struct BlendFileReadParams *params, struct ReportList *reports)
struct UserDef * BKE_blendfile_userdef_from_defaults(void)
void BKE_blendfile_read_make_empty(struct bContext *C)
struct BlendFileData * BKE_blendfile_read(const char *filepath, const struct BlendFileReadParams *params, struct ReportList *reports)
bool BKE_blendfile_userdef_write_all(struct ReportList *reports)
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_callback_exec_null(struct Main *bmain, eCbEvent evt)
@ BKE_CB_EVT_LOAD_FACTORY_STARTUP_POST
@ BKE_CB_EVT_LOAD_FACTORY_USERDEF_POST
@ BKE_CB_EVT_VERSION_UPDATE
struct Scene * CTX_data_scene(const bContext *C)
bool CTX_py_init_get(bContext *C)
void CTX_wm_menu_set(bContext *C, struct ARegion *menu)
struct wmWindowManager * CTX_wm_manager(const bContext *C)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct bScreen * CTX_wm_screen(const bContext *C)
void CTX_wm_window_set(bContext *C, struct wmWindow *win)
struct ReportList * CTX_wm_reports(const bContext *C)
struct wmMsgBus * CTX_wm_message_bus(const bContext *C)
void CTX_wm_manager_set(bContext *C, struct wmWindowManager *wm)
struct Main * CTX_data_main(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
#define G_FLAG_ALL_READFILE
@ G_FLAG_SCRIPT_OVERRIDE_PREF
@ G_FLAG_SCRIPT_AUTOEXEC_FAIL_QUIET
@ G_FLAG_USERPREF_NO_SAVE_ON_EXIT
@ G_FLAG_SCRIPT_AUTOEXEC_FAIL
#define G_FLAG_ALL_RUNTIME
void IDP_FreeProperty(struct IDProperty *prop)
struct IDProperty * IDP_CopyProperty(const struct IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BKE_lib_override_library_main_operations_create(struct Main *bmain, const bool force_auto)
void void BKE_libblock_remap(struct Main *bmain, void *old_idv, void *new_idv, const short remap_flags) ATTR_NONNULL(1
@ ID_REMAP_SKIP_USER_CLEAR
@ ID_REMAP_SKIP_INDIRECT_USAGE
struct ImBuf * BKE_main_thumbnail_to_imbuf(struct Main *bmain, struct BlendThumbnail *data)
const char * BKE_main_blendfile_path(const struct Main *bmain) ATTR_NONNULL()
struct BlendThumbnail * BKE_main_thumbnail_from_imbuf(struct Main *bmain, struct ImBuf *img)
const char * BKE_main_blendfile_path_from_global(void)
void BKE_packedfile_pack_all(struct Main *bmain, struct ReportList *reports, bool verbose)
void BKE_report_print_level_set(ReportList *reports, ReportType level)
void BKE_report(ReportList *reports, ReportType type, const char *message)
void BKE_reports_clear(ReportList *reports)
void BKE_reportf(ReportList *reports, ReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_reports_init(ReportList *reports, int flag)
void BKE_scene_free_depsgraph_hash(struct Scene *scene)
struct ARegion * BKE_area_find_region_type(const struct ScrArea *area, int type)
struct ScrArea struct ScrArea * BKE_screen_find_big_area(struct bScreen *screen, const int spacetype, const short min)
void BKE_sound_init(struct Main *main)
UndoStack * BKE_undosys_stack_create(void)
void BKE_undosys_stack_init_from_context(UndoStack *ustack, struct bContext *C)
void BKE_undosys_stack_clear(UndoStack *ustack)
void BKE_undosys_stack_init_from_main(UndoStack *ustack, struct Main *bmain)
void BKE_workspace_active_set(struct WorkSpaceInstanceHook *hook, struct WorkSpace *workspace) SETTER_ATTRS
struct WorkSpaceLayout * BKE_workspace_layout_find_global(const struct Main *bmain, const struct bScreen *screen, struct WorkSpace **r_workspace) ATTR_NONNULL(1
#define BLI_assert_unreachable()
int BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
int BLI_stat(const char *path, BLI_stat_t *buffer) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
int BLI_access(const char *filename, int mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BLI_file_is_writable(const char *file) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
int BLI_delete(const char *file, bool dir, bool recursive) ATTR_NONNULL()
int BLI_rename(const char *from, const char *to) ATTR_NONNULL()
void BLI_file_free_lines(struct LinkNode *lines)
struct LinkNode * BLI_file_read_as_lines(const char *file) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BLI_filelist_entry_size_to_string(const struct stat *st, const uint64_t sz, const bool compact, char r_size[])
void * BLI_gzopen(const char *filename, const char *mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BLI_filelist_entry_datetime_to_string(const struct stat *st, const int64_t ts, const bool compact, char r_time[], char r_date[], bool *r_is_today, bool *r_is_yesterday)
FILE * BLI_fopen(const char *filename, const char *mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Some types for dealing with directories.
#define FILELIST_DIRENTRY_SIZE_LEN
#define FILELIST_DIRENTRY_DATE_LEN
#define FILELIST_DIRENTRY_TIME_LEN
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
void * BLI_findstring_ptr(const struct ListBase *listbase, const char *id, const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_addhead(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
void * BLI_findstring(const struct ListBase *listbase, const char *id, const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
const char * BLI_path_basename(const char *path) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
void BLI_split_dir_part(const char *string, char *dir, const size_t dirlen)
bool BLI_path_filename_ensure(char *filepath, size_t maxlen, const char *filename) ATTR_NONNULL()
bool BLI_path_extension_ensure(char *path, size_t maxlen, const char *ext) ATTR_NONNULL()
void BLI_make_file_string(const char *relabase, char *string, const char *dir, const char *file)
void BLI_join_dirfile(char *__restrict dst, const size_t maxlen, const char *__restrict dir, const char *__restrict file) ATTR_NONNULL()
size_t BLI_path_join(char *__restrict dst, const size_t dst_len, const char *path_first,...) ATTR_NONNULL(1
bool BLI_path_extension_replace(char *path, size_t maxlen, const char *ext) ATTR_NONNULL()
const char * BLI_path_slash_rfind(const char *string) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT
void BLI_split_file_part(const char *string, char *file, const size_t filelen)
size_t size_t char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
#define STRNCPY(dst, src)
char * BLI_strdupn(const char *str, const size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
int BLI_thread_is_main(void)
void BLI_timer_on_file_load(void)
#define STREQLEN(a, b, n)
#define SET_FLAG_FROM_TEST(value, test, flag)
Compatibility-like things for windows.
external readfile function prototypes.
void BLO_sanitize_experimental_features_userpref_blend(struct UserDef *userdef)
bool BLO_has_bfile_extension(const char *str)
bool BLO_memfile_write_file(struct MemFile *memfile, const char *filename)
external writefile function prototypes.
bool BLO_write_file(struct Main *mainvar, const char *filepath, const int write_flags, const struct BlendFileWriteParams *params, struct ReportList *reports)
@ BLO_WRITE_PATH_REMAP_NONE
@ BLO_WRITE_PATH_REMAP_ABSOLUTE
@ BLO_WRITE_PATH_REMAP_RELATIVE
#define CTX_IFACE_(context, msgid)
void BPY_python_reset(struct bContext *C)
bool BPY_run_string_eval(struct bContext *C, const char *imports[], const char *expr)
bool BPY_run_string_exec(struct bContext *C, const char *imports[], const char *expr)
#define CLOG_WARN(clg_ref,...)
struct Depsgraph Depsgraph
Object is a sort of wrapper for general info.
@ USER_SCRIPT_AUTOEXEC_DISABLE
char datatoc_startup_blend[]
int datatoc_startup_blend_size
void ED_file_read_bookmarks(void)
bool ED_image_should_save_modified(const struct Main *bmain)
bool ED_image_save_all_modified(const struct bContext *C, struct ReportList *reports)
int ED_image_save_all_modified_info(const struct Main *bmain, struct ReportList *reports)
void ED_outliner_select_sync_from_all_tag(struct bContext *C)
void ED_screen_exit(struct bContext *C, struct wmWindow *window, struct bScreen *screen)
struct WorkSpaceLayout * ED_workspace_layout_duplicate(struct Main *bmain, struct WorkSpace *workspace, const struct WorkSpaceLayout *layout_old, struct wmWindow *win) ATTR_NONNULL()
struct MemFile * ED_undosys_stack_memfile_get_active(struct UndoStack *ustack)
void ED_editors_exit(struct Main *bmain, bool do_undo_system)
void ED_editors_init(struct bContext *C)
bool ED_editors_flush_edits(struct Main *bmain)
void ED_view3d_local_collections_reset(struct bContext *C, const bool reset_all)
struct ImBuf * ED_view3d_draw_offscreen_imbuf(struct Depsgraph *depsgraph, struct Scene *scene, eDrawType drawtype, struct View3D *v3d, struct ARegion *region, int sizex, int sizey, eImBufFlags imbuf_flag, int alpha_mode, const char *viewname, const bool restore_rv3d_mats, struct GPUOffScreen *ofs, char err_out[256])
struct ImBuf * ED_view3d_draw_offscreen_imbuf_simple(struct Depsgraph *depsgraph, struct Scene *scene, struct View3DShading *shading_override, eDrawType drawtype, struct Object *camera, int width, int height, eImBufFlags imbuf_flags, eV3DOffscreenDrawFlag draw_flags, int alpha_mode, const char *viewname, struct GPUOffScreen *ofs, char err_out[256])
GHOST C-API function and type declarations.
void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle, GHOST_TUserDataPtr userdata)
void GHOST_addToSystemRecentFiles(const char *filename)
bool IMB_scaleImBuf(struct ImBuf *ibuf, unsigned int newx, unsigned int newy)
void IMB_freeImBuf(struct ImBuf *ibuf)
Contains defines and structs used throughout the imbuf module.
void IMB_thumb_delete(const char *path, ThumbSize size)
struct ImBuf * IMB_thumb_create(const char *path, ThumbSize size, ThumbSource source, struct ImBuf *img)
void MEM_CacheLimiter_set_maximum(size_t m)
Read Guarded memory(de)allocation.
StructRNA RNA_PreferencesFilePaths
StructRNA RNA_Preferences
void uiItemS_ex(uiLayout *layout, float factor)
uiBut * uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, const char *str, int x, int y, short width, short height, void *poin, float min, float max, float a1, float a2, const char *tip)
void uiItemL_ex(uiLayout *layout, const char *name, int icon, const bool highlight, const bool redalert)
void uiLayoutSetActive(uiLayout *layout, bool active)
void UI_block_theme_style_set(uiBlock *block, char theme_style)
void uiLayoutSetEnabled(uiLayout *layout, bool enabled)
void UI_popup_block_close(struct bContext *C, struct wmWindow *win, uiBlock *block)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
void uiLayoutSetScaleY(uiLayout *layout, float scale)
void uiItemL(uiLayout *layout, const char *name, int icon)
void uiItemS(uiLayout *layout)
void UI_popup_block_invoke(struct bContext *C, uiBlockCreateFunc func, void *arg, void(*arg_free)(void *arg))
void UI_block_emboss_set(uiBlock *block, eUIEmbossType emboss)
void UI_but_drawflag_disable(uiBut *but, int flag)
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void UI_but_func_set(uiBut *but, uiButHandleFunc func, void *arg1, void *arg2)
uiBlock * UI_block_begin(const struct bContext *C, struct ARegion *region, const char *name, eUIEmbossType emboss)
uiLayout * uiLayoutSplit(uiLayout *layout, float percentage, bool align)
void UI_block_bounds_set_centered(uiBlock *block, int addval)
uiBut * uiDefButBitC(uiBlock *block, int type, int bit, int retval, const char *str, int x, int y, short width, short height, char *poin, float min, float max, float a1, float a2, const char *tip)
void UI_block_flag_enable(uiBlock *block, int flag)
@ UI_BLOCK_THEME_STYLE_POPUP
bool UI_popup_block_name_exists(const struct bScreen *screen, const char *name)
void UI_init_userdef(void)
void UI_but_flag_enable(uiBut *but, int flag)
uiLayout * uiItemsAlertBox(uiBlock *block, const int size, const eAlertIcon icon)
void UI_view2d_zoom_cache_reset(void)
#define WM_FILESEL_FILEPATH
ATTR_WARN_UNUSED_RESULT const BMLoop * l
static char * basename(char *string)
const Depsgraph * depsgraph
DEGForeachIDComponentCallback callback
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_mallocN)(size_t len, const char *str)
static void area(int d1, int d2, int e1, int e2, float weights[2])
void split(const std::string &s, const char delim, std::vector< std::string > &tokens)
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
const char * RNA_property_identifier(const PropertyRNA *prop)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_collection_begin(PointerRNA *ptr, PropertyRNA *prop, CollectionPropertyIterator *iter)
PropertyType RNA_property_type(PropertyRNA *prop)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_collection_next(CollectionPropertyIterator *iter)
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
int RNA_int_get(PointerRNA *ptr, const char *name)
void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value)
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
void RNA_property_collection_end(CollectionPropertyIterator *iter)
PropertyRNA * RNA_struct_iterator_property(StructRNA *type)
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value)
bool RNA_property_equals(Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b, PropertyRNA *prop, eRNACompareMode mode)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_string_file_path(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
unsigned __int64 uint64_t
BlendThumbnail * blen_thumb
struct MainIDRelations * relations
int(* run)(bContext *C, wmOperator *op)
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
char *(* get_description)(struct bContext *C, struct wmOperatorType *, struct PointerRNA *)
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
const char * translation_context
void(* ui)(struct bContext *, struct wmOperator *)
bool(* check)(struct bContext *, struct wmOperator *)
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
const char *(* get_name)(struct wmOperatorType *, struct PointerRNA *)
struct ReportList * reports
struct wmOperatorType * type
struct wmKeyConfig * defaultconf
struct UndoStack * undo_stack
struct wmKeyConfig * userconf
struct wmTimer * autosavetimer
struct wmWindow * windrawable
struct wmKeyConfig * addonconf
struct wmWindow * winactive
struct wmEvent * eventstate
__forceinline const avxi abs(const avxi &a)
void wm_clear_default_size(bContext *C)
void wm_close_and_free_all(bContext *C, ListBase *wmlist)
void WM_check(bContext *C)
void WM_keyconfig_reload(bContext *C)
void wm_add_default(Main *bmain, bContext *C)
void WM_cursor_wait(bool val)
void WM_main_add_notifier(unsigned int type, void *reference)
void WM_event_add_fileselect(bContext *C, wmOperator *op)
int WM_operator_name_call_with_properties(struct bContext *C, const char *opstring, short context, struct IDProperty *properties)
void wm_event_do_depsgraph(bContext *C, bool is_after_open_file)
void WM_report_banner_show(void)
int WM_operator_name_call(bContext *C, const char *opstring, short context, PointerRNA *properties)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, short context, PointerRNA *properties)
void WM_event_remove_handlers(bContext *C, ListBase *handlers)
static void wm_history_file_update(void)
static void free_post_file_close_action(void *arg)
static uiBlock * block_create__close_file_dialog(struct bContext *C, struct ARegion *region, void *arg1)
static const char * wm_save_as_mainfile_get_name(wmOperatorType *ot, PointerRNA *ptr)
static void wm_autosave_location(char *filepath)
void wm_autosave_timer_end(wmWindowManager *wm)
static void create_operator_state(wmOperatorType *ot, int first_state)
#define BKE_READ_EXOTIC_OK_BLEND
static void wm_window_match_do(bContext *C, ListBase *current_wm_list, ListBase *readfile_wm_list, ListBase *r_new_wm_list)
static void wm_block_autorun_warning_enable_scripts(bContext *C, void *arg_block, void *UNUSED(arg))
static void wm_open_mainfile_ui(bContext *UNUSED(C), wmOperator *op)
static void wm_init_userdef(Main *bmain)
bool write_crash_blend(void)
static void wm_file_read_post(bContext *C, const bool is_startup_file, const bool is_factory_startup, const bool use_data, const bool use_userdef, const bool reset_app_template)
static int wm_recover_last_session_exec(bContext *C, wmOperator *op)
static void wm_history_files_free(void)
static bool wm_open_mainfile_check(bContext *UNUSED(C), wmOperator *op)
static void wm_block_autorun_warning_ignore(bContext *C, void *arg_block, void *UNUSED(arg))
static int operator_state_dispatch(bContext *C, wmOperator *op, OperatorDispatchTarget *targets)
static bool blend_save_check(bContext *UNUSED(C), wmOperator *op)
static void wm_filepath_default(char *filepath)
void WM_OT_read_history(wmOperatorType *ot)
bool WM_recover_last_session(bContext *C, ReportList *reports)
static void wm_open_mainfile_after_dialog_callback(bContext *C, void *user_data)
void wm_open_init_use_scripts(wmOperator *op, bool use_prefs)
static int wm_homefile_read_exec(bContext *C, wmOperator *op)
static int wm_open_mainfile__discard_changes(bContext *C, wmOperator *op)
static bool wm_revert_mainfile_poll(bContext *UNUSED(C))
#define BKE_READ_EXOTIC_FAIL_FORMAT
void wm_test_autorun_revert_action_set(wmOperatorType *ot, PointerRNA *ptr)
#define BKE_READ_EXOTIC_FAIL_OPEN
void wm_homefile_read(bContext *C, ReportList *reports, bool use_factory_settings, bool use_empty_data, bool use_data, bool use_userdef, const char *filepath_startup_override, const char *app_template_override, bool *r_is_factory_startup)
void WM_OT_save_as_mainfile(wmOperatorType *ot)
void wm_autosave_delete(void)
void WM_OT_open_mainfile(wmOperatorType *ot)
const char * WM_init_state_app_template_get(void)
static void wm_block_file_close_cancel_button(uiBlock *block, wmGenericCallback *post_action)
static RecentFile * wm_file_history_find(const char *filepath)
static ImBuf * blend_file_thumb(const bContext *C, Scene *scene, bScreen *screen, BlendThumbnail **thumb_pt)
void wm_autosave_timer_begin(wmWindowManager *wm)
static void rna_struct_update_when_changed(bContext *C, Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b)
void WM_OT_recover_last_session(wmOperatorType *ot)
void wm_autosave_timer(Main *bmain, wmWindowManager *wm, wmTimer *UNUSED(wt))
static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static int wm_revert_mainfile_exec(bContext *C, wmOperator *op)
static void wm_autosave_write(Main *bmain, wmWindowManager *wm)
static bool wm_file_read_opwrap(bContext *C, const char *filepath, ReportList *reports)
BLI_STATIC_ASSERT(sizeof(struct FileRuntime)<=sizeof(void *), "Struct must not exceed pointer size")
static void wm_homefile_read_after_dialog_callback(bContext *C, void *user_data)
static OperatorDispatchTarget wm_open_mainfile_dispatch_targets[]
#define USERDEF_RESTORE(member)
static void wm_userpref_read_exceptions(UserDef *userdef_curr, const UserDef *userdef_prev)
static char * wm_open_mainfile_description(struct bContext *UNUSED(C), struct wmOperatorType *UNUSED(op), struct PointerRNA *params)
@ OPEN_MAINFILE_STATE_OPEN
@ OPEN_MAINFILE_STATE_DISCARD_CHANGES
@ OPEN_MAINFILE_STATE_SELECT_FILE_PATH
static int wm_recover_auto_save_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
void WM_OT_read_userpref(wmOperatorType *ot)
static void wm_test_autorun_revert_action_exec(bContext *C)
static char save_images_when_file_is_closed
static void wm_block_file_close_cancel(bContext *C, void *arg_block, void *UNUSED(arg_data))
void wm_file_read_report(bContext *C, Main *bmain)
struct OperatorDispatchTarget OperatorDispatchTarget
static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static void wm_block_file_close_save_button(uiBlock *block, wmGenericCallback *post_action)
void WM_OT_save_homefile(wmOperatorType *ot)
void WM_OT_read_factory_userpref(wmOperatorType *ot)
static int wm_userpref_write_exec(bContext *C, wmOperator *op)
static int get_operator_state(wmOperator *op)
void WM_init_state_app_template_set(const char *app_template)
static void save_set_compress(wmOperator *op)
bool WM_file_read(bContext *C, const char *filepath, ReportList *reports)
static int wm_save_as_mainfile_exec(bContext *C, wmOperator *op)
static void wm_window_match_init(bContext *C, ListBase *wmlist)
static int wm_read_exotic(const char *name)
static char * wm_save_as_mainfile_get_description(bContext *UNUSED(C), wmOperatorType *UNUSED(ot), PointerRNA *ptr)
void WM_OT_save_mainfile(wmOperatorType *ot)
void WM_OT_recover_auto_save(wmOperatorType *ot)
bool wm_file_or_image_is_modified(const Main *bmain, const wmWindowManager *wm)
void wm_history_file_read(void)
static void wm_window_substitute_old(wmWindowManager *oldwm, wmWindowManager *wm, wmWindow *oldwin, wmWindow *win)
static void wm_window_match_keep_current_wm(const bContext *C, ListBase *current_wm_list, const bool load_ui, ListBase *r_new_wm_list)
static uiBlock * block_create_autorun_warning(struct bContext *C, struct ARegion *region, void *UNUSED(arg1))
static void wm_block_file_close_discard(bContext *C, void *arg_block, void *arg_data)
static RecentFile * wm_history_file_new(const char *filepath)
static struct @1156 wm_test_autorun_revert_action_data
static void set_next_operator_state(wmOperator *op, int state)
void WM_file_tag_modified(void)
void WM_file_autoexec_init(const char *filepath)
static int wm_open_mainfile_dispatch(bContext *C, wmOperator *op)
static void wm_window_match_replace_by_file_wm(bContext *C, ListBase *current_wm_list, ListBase *readfile_wm_list, ListBase *r_new_wm_list)
static int wm_homefile_read_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static void wm_userpref_update_when_changed(bContext *C, Main *bmain, UserDef *userdef_prev, UserDef *userdef_curr)
static const char * close_file_dialog_name
void WM_OT_read_factory_settings(wmOperatorType *ot)
static int wm_userpref_read_exec(bContext *C, wmOperator *op)
static int wm_open_mainfile__open(bContext *C, wmOperator *op)
static int wm_history_file_read_exec(bContext *UNUSED(C), wmOperator *UNUSED(op))
void wm_test_autorun_warning(bContext *C)
static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
static void wm_file_read_pre(bContext *C, bool use_data, bool UNUSED(use_userdef))
void wm_open_init_load_ui(wmOperator *op, bool use_prefs)
static struct @1154 wm_init_state_app_template
static void wm_history_file_free(RecentFile *recent)
static void wm_autosave_timer_begin_ex(wmWindowManager *wm, double timestep)
static void wm_open_mainfile_def_property_use_scripts(wmOperatorType *ot)
#define BKE_READ_EXOTIC_FAIL_PATH
static bool wm_file_write(bContext *C, const char *filepath, int fileflags, eBLO_WritePathRemap remap_mode, bool use_save_as_copy, ReportList *reports)
static void wm_free_operator_properties_callback(void *user_data)
static void wm_block_file_close_save(bContext *C, void *arg_block, void *arg_data)
static void save_set_filepath(bContext *C, wmOperator *op)
static int wm_recover_auto_save_exec(bContext *C, wmOperator *op)
void WM_OT_read_homefile(wmOperatorType *ot)
static int wm_open_mainfile_exec(bContext *C, wmOperator *op)
static void wm_block_file_close_discard_button(uiBlock *block, wmGenericCallback *post_action)
static int wm_homefile_write_exec(bContext *C, wmOperator *op)
void WM_OT_save_userpref(wmOperatorType *ot)
static void wm_block_autorun_warning_reload_with_scripts(bContext *C, void *arg_block, void *UNUSED(arg))
static void wm_history_file_write(void)
static int wm_recover_last_session_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void read_homefile_props(wmOperatorType *ot)
static int wm_open_mainfile__select_file_path(bContext *C, wmOperator *op)
void WM_OT_revert_mainfile(wmOperatorType *ot)
void wm_close_file_dialog(bContext *C, wmGenericCallback *post_action)
void WM_autosave_init(wmWindowManager *wm)
void WM_reinit_gizmomap_all(Main *bmain)
void WM_init_splash(bContext *C)
void wm_exit_schedule_delayed(const bContext *C)
void WM_jobs_kill_all(wmWindowManager *wm)
void WM_keyconfig_update(wmWindowManager *wm)
@ WM_MSG_STATICTYPE_FILE_READ
void WM_msg_publish_static(struct wmMsgBus *mbus, int event)
void WM_operator_properties_filesel(wmOperatorType *ot, int filter, short type, short action, short flag, short display, short sort)
void WM_operatortype_last_properties_clear_all(void)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
int WM_operator_confirm(bContext *C, wmOperator *op, const wmEvent *UNUSED(event))
void WM_operator_properties_create_ptr(PointerRNA *ptr, wmOperatorType *ot)
void WM_operator_properties_free(PointerRNA *ptr)
wmGenericCallback * WM_generic_callback_steal(wmGenericCallback *callback)
void WM_generic_callback_free(wmGenericCallback *callback)
void WM_event_remove_timer(wmWindowManager *wm, wmWindow *UNUSED(win), wmTimer *timer)
WorkSpaceLayout * WM_window_get_active_layout(const wmWindow *win)
void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win)
void WM_window_set_active_screen(wmWindow *win, WorkSpace *workspace, bScreen *screen)
void wm_window_ghostwindows_remove_invalid(bContext *C, wmWindowManager *wm)
void wm_window_clear_drawable(wmWindowManager *wm)
bScreen * WM_window_get_active_screen(const wmWindow *win)
void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win)
void WM_init_tablet_api(void)
bool WM_window_is_temp_screen(const wmWindow *win)
void WM_window_set_active_layout(wmWindow *win, WorkSpace *workspace, WorkSpaceLayout *layout)
wmTimer * WM_event_add_timer(wmWindowManager *wm, wmWindow *win, int event_type, double timestep)