23# define _WIN32_IE 0x0400
31#include <fmt/format.h>
47#include BLI_SYSTEM_PID_H
165#define USE_THUMBNAIL_FAST_DOWNSCALE
207 const bool is_read_homefile)
218 return wm_setup_data;
259 ed::asset::list::storage_exit();
265 return wm_setup_data;
322 wm_setup_data->
old_wm =
nullptr;
335 if (screen !=
nullptr) {
344 if (screen->winid == 0) {
354 bmain, workspace, layout_ref, win);
360 win_screen->
winid = win->winid;
392 bool has_match =
false;
395 if (old_win->winid == win->winid) {
410 wm_setup_data->
old_wm =
nullptr;
439 wm_setup_data->
old_wm ==
nullptr)
449 else if (wm_setup_data->
old_wm !=
nullptr) {
450 if (wm_setup_data->
old_wm == wm) {
455 C, bmain, wm_setup_data, wm, (
G.fileflags &
G_FILE_NO_UI) == 0);
468 MEM_delete(wm_setup_data);
548#define BKE_READ_EXOTIC_FAIL_PATH -3
549#define BKE_READ_EXOTIC_FAIL_FORMAT -2
550#define BKE_READ_EXOTIC_FAIL_OPEN -1
551#define BKE_READ_EXOTIC_OK_BLEND 0
553# define BKE_READ_EXOTIC_OK_OTHER 1
570 int filepath_len = strlen(filepath);
571 if (filepath_len > 0 &&
ELEM(filepath[filepath_len - 1],
'/',
'\\')) {
582 if (rawfile ==
nullptr) {
588 if (rawfile->
read(rawfile, header,
sizeof(header)) !=
sizeof(header)) {
589 rawfile->
close(rawfile);
592 rawfile->
seek(rawfile, 0, SEEK_SET);
595 if (
STREQLEN(header,
"BLENDER", 7)) {
596 rawfile->
close(rawfile);
613 if (compressed_file !=
nullptr) {
614 size_t len = compressed_file->
read(compressed_file, header,
sizeof(header));
615 compressed_file->
close(compressed_file);
616 if (
len ==
sizeof(header) &&
STREQLEN(header,
"BLENDER", 7)) {
621 rawfile->
close(rawfile);
645 G.f &= ~G_FLAG_SCRIPT_AUTOEXEC;
656 if (scene->r.engine[0] &&
661 "Engine '%s' not available for scene '%s' (an add-on may need to be installed "
717 const char *filepath,
722 const bool use_data =
params->use_data;
723 const bool use_userdef =
params->use_userdef;
724 const bool is_startup_file =
params->is_startup_file;
725 const bool is_factory_startup =
params->is_factory_startup;
726 const bool reset_app_template =
params->reset_app_template;
728 bool addons_loaded =
false;
739 if (is_startup_file) {
742 if (!
params->is_first_time) {
744 bool reset_all = use_userdef;
745 if (use_userdef || reset_app_template) {
748 const char *imports[] = {
"bl_app_template_utils",
nullptr};
754 const char *imports[] = {
"bpy",
"addon_utils",
nullptr};
762 "bpy.utils.refresh_script_paths()\n"
764 "addon_utils.reset_all()");
769 addons_loaded =
true;
777 addons_loaded =
true;
786 if (is_factory_startup) {
809 if (is_factory_startup) {
827 if (is_startup_file) {
900 if (success ==
false) {
918 double duration_whole_minutes, duration_whole_seconds;
919 double duration_libraries_minutes, duration_libraries_seconds;
920 double duration_lib_override_minutes, duration_lib_override_seconds;
921 double duration_lib_override_resync_minutes, duration_lib_override_resync_seconds;
922 double duration_lib_override_recursive_resync_minutes,
923 duration_lib_override_recursive_resync_seconds;
928 &duration_whole_minutes,
929 &duration_whole_seconds,
934 &duration_libraries_minutes,
935 &duration_libraries_seconds,
940 &duration_lib_override_minutes,
941 &duration_lib_override_seconds,
946 &duration_lib_override_resync_minutes,
947 &duration_lib_override_resync_seconds,
952 &duration_lib_override_recursive_resync_minutes,
953 &duration_lib_override_recursive_resync_seconds,
957 &
LOG, 0,
"Blender file read in %.0fm%.2fs", duration_whole_minutes, duration_whole_seconds);
960 " * Loading libraries: %.0fm%.2fs",
961 duration_libraries_minutes,
962 duration_libraries_seconds);
965 " * Applying overrides: %.0fm%.2fs",
966 duration_lib_override_minutes,
967 duration_lib_override_seconds);
970 " * Resyncing overrides: %.0fm%.2fs (%d root overrides), including recursive "
971 "resyncs: %.0fm%.2fs)",
972 duration_lib_override_resync_minutes,
973 duration_lib_override_resync_seconds,
975 duration_lib_override_recursive_resync_minutes,
976 duration_lib_override_recursive_resync_seconds);
980 node_lib = node_lib->next)
985 "Library \"%s\" needs overrides resync",
993 "%d libraries and %d linked data-blocks are missing (including %d ObjectData and "
994 "%d Proxies), please check the Info and Outliner editors for details",
1003 "%d local ObjectData and %d local Object proxies are reported to be missing, "
1004 "this should never happen",
1013 "%d libraries have overrides needing resync (auto resynced in %.0fm%.2fs), "
1014 "please check the Info editor for details",
1016 duration_lib_override_recursive_resync_minutes,
1017 duration_lib_override_recursive_resync_seconds);
1025 "Proxies have been removed from Blender (%d proxies were automatically converted "
1026 "to library overrides, %d proxies could not be converted and were cleared). "
1027 "Consider re-saving any library .blend file with the newest Blender version",
1035 "%d sequence strips were not read because they were in a channel larger than %d",
1047 const bool do_history_file_update = (
G.background ==
false) &&
1049 bool success =
false;
1051 const bool use_data =
true;
1052 const bool use_userdef =
false;
1072 params.is_startup =
false;
1082 if (bfd !=
nullptr) {
1094 const int G_f_orig =
G.f;
1098 C, bfd, &
params, wm_setup_data, &bf_reports,
false,
nullptr);
1105 if (
G.f != G_f_orig) {
1108 G.f = (
G.f & ~flags_keep) | (G_f_orig & flags_keep);
1113 if (do_history_file_update) {
1118 read_file_post_params.
use_data = use_data;
1119 read_file_post_params.use_userdef = use_userdef;
1120 read_file_post_params.is_startup_file =
false;
1121 read_file_post_params.is_factory_startup =
false;
1122 read_file_post_params.reset_app_template =
false;
1123 read_file_post_params.success =
true;
1124 read_file_post_params.is_alloc =
false;
1134 else if (retval == BKE_READ_EXOTIC_OK_OTHER) {
1135 BKE_undo_write(C,
"Import file");
1141 "Cannot read file \"%s\": %s",
1143 errno ? strerror(errno) :
RPT_(
"unable to open the file"));
1214 bool success =
false;
1217 const bool use_data = params_homefile->
use_data;
1218 const bool use_userdef = params_homefile->
use_userdef;
1224 const bool use_factory_settings_app_template_only =
1230 bool filepath_startup_is_factory =
true;
1236 char app_template_system[
FILE_MAX];
1239 char app_template_config[
FILE_MAX];
1243 if (use_data ==
false) {
1246 if (use_userdef ==
false) {
1252 bool is_factory_startup =
true;
1255 bool update_defaults =
false;
1260 if (filepath_startup_override !=
nullptr) {
1263 else if (app_template_override) {
1267 else if (!use_factory_settings &&
U.app_template[0]) {
1271 const bool reset_app_template = ((!
app_template &&
U.app_template[0]) ||
1275 BLI_assert((use_factory_settings && filepath_startup_override) == 0);
1282 if (reset_app_template) {
1284 G.fileflags &= ~G_FILE_NO_UI;
1288 if (use_userdef || reset_app_template) {
1299 const char *imports[] = {
"addon_utils",
nullptr};
1323 filepath_startup[0] =
'\0';
1324 filepath_userdef[0] =
'\0';
1325 app_template_system[0] =
'\0';
1326 app_template_config[0] =
'\0';
1329 if (!use_factory_settings) {
1330 if (cfgdir.has_value()) {
1333 filepath_startup_is_factory =
false;
1340 use_factory_settings =
true;
1343 if (filepath_startup_override) {
1344 STRNCPY(filepath_startup, filepath_startup_override);
1345 filepath_startup_is_factory =
false;
1351 if (use_factory_settings_app_template_only) {
1355 else if (!use_factory_settings &&
BLI_exists(filepath_userdef)) {
1357 if (userdef !=
nullptr) {
1358 CLOG_INFO(&
LOG, 0,
"read prefs: \"%s\"", filepath_userdef);
1370 app_template, app_template_system,
sizeof(app_template_system)))
1380 if (!use_factory_settings && cfgdir.has_value()) {
1382 app_template_config,
sizeof(app_template_config), cfgdir->c_str(),
app_template);
1385 filepath_startup_is_factory =
false;
1386 if (
BLI_access(filepath_startup, R_OK) != 0) {
1387 filepath_startup[0] =
'\0';
1391 filepath_startup[0] =
'\0';
1394 if (filepath_startup[0] ==
'\0') {
1397 filepath_startup_is_factory =
true;
1400 update_defaults =
true;
1404 if (!use_factory_settings || (filepath_startup[0] !=
'\0')) {
1405 if (
BLI_access(filepath_startup, R_OK) == 0) {
1407 params.is_startup =
true;
1408 params.is_factory_settings = use_factory_settings;
1414 if (bfd !=
nullptr) {
1415 CLOG_INFO(&
LOG, 0,
"read startup: \"%s\"", filepath_startup);
1423 update_defaults && use_data,
1430 is_factory_startup = filepath_startup_is_factory;
1442 if (success ==
false && filepath_startup_override && reports) {
1447 bool loaded_factory_settings =
false;
1448 if (success ==
false) {
1451 read_file_params.is_factory_settings = use_factory_settings;
1452 read_file_params.skip_flags = skip_flags;
1455 if (bfd !=
nullptr) {
1459 C, bfd, &read_file_params, wm_setup_data, &read_report,
true,
nullptr);
1461 loaded_factory_settings =
true;
1466 if (use_empty_data) {
1473 if (app_template_system[0] !=
'\0') {
1475 temp_path[0] =
'\0';
1476 if (!use_factory_settings) {
1479 temp_path[0] =
'\0';
1483 if (temp_path[0] ==
'\0') {
1488 UserDef *userdef_template =
nullptr;
1492 if (userdef_template) {
1493 CLOG_INFO(&
LOG, 0,
"read prefs from app-template: \"%s\"", temp_path);
1496 if (userdef_template ==
nullptr) {
1500 if (userdef_template) {
1502 userdef_template =
nullptr;
1507 if (app_template_override) {
1508 STRNCPY(
U.app_template, app_template_override);
1527 if (wm->defaultconf) {
1528 wm->defaultconf->flag &= ~KEYCONF_INIT_DEFAULT;
1541 params_file_read_post.
use_data = use_data;
1542 params_file_read_post.use_userdef = use_userdef;
1543 params_file_read_post.is_startup_file =
true;
1544 params_file_read_post.is_factory_startup = is_factory_startup;
1545 params_file_read_post.is_first_time = params_homefile->
is_first_time;
1547 params_file_read_post.reset_app_template = reset_app_template;
1549 params_file_read_post.success = success;
1550 params_file_read_post.is_alloc =
false;
1552 if (r_params_file_read_post ==
nullptr) {
1556 params_file_read_post.is_alloc =
true;
1559 **r_params_file_read_post = params_file_read_post;
1576 const char *filepath =
"";
1579 if (params_file_read_post->
use_data) {
1583 if (params_file_read_post->
is_alloc) {
1584 MEM_freeN((
void *)params_file_read_post);
1597 if (!cfgdir.has_value()) {
1612 for (
l = lines, num = 0;
l && (num <
U.recent_files);
l =
l->
next) {
1613 const char *line =
static_cast<const char *
>(
l->link);
1665 if (!user_config_dir.has_value()) {
1674 fprintf(fp,
"%s\n", recent->filepath);
1689 if (blendfile_path[0] ==
'\0') {
1693 recent =
static_cast<RecentFile *
>(
G.recent_files.first);
1705 recent = recent_next)
1707 recent_next = recent->
next;
1747#ifdef USE_THUMBNAIL_FAST_DOWNSCALE
1749 const int src_size[2],
1750 const int dst_size[2])
1767 BLI_assert(dst_size[0] <= src_size[0] && dst_size[1] <= src_size[1]);
1781 const uint32_t src_size_x = src_size[0];
1782 const uint32_t src_size_y = src_size[1];
1784 const uint32_t dst_size_x = dst_size[0];
1785 const uint32_t dst_size_y = dst_size[1];
1786 const uint8_t *src_px = src_rect;
1789 for (
uint32_t dst_y = 0; dst_y < dst_size_y; dst_y++) {
1791 const uint32_t src_y_end = ((dst_y + 1) * src_size_y) / dst_size_y;
1792 for (; src_y < src_y_end; src_y++) {
1795 for (
uint32_t dst_x = 0; dst_x < dst_size_x; dst_x++, accum += 4) {
1796 const uint32_t src_x_end = ((dst_x + 1) * src_size_x) / dst_size_x;
1797 for (; src_x < src_x_end; src_x++) {
1806 BLI_assert(accum == accum_row + (4 * dst_size[0]));
1810 uint8_t *dst_px = dst_rect + ((dst_y * dst_size_x) * 4);
1812 const uint32_t span_y = src_y_end - src_y_beg;
1813 for (
uint32_t dst_x = 0; dst_x < dst_size_x; dst_x++) {
1814 const uint32_t src_x_end = ((dst_x + 1) * src_size_x) / dst_size_x;
1815 const uint32_t span_x = src_x_end - src_x_beg;
1817 const uint32_t sample_count = span_x * span_y;
1818 dst_px[0] =
uint8_t(accum[0] / sample_count);
1819 dst_px[1] =
uint8_t(accum[1] / sample_count);
1820 dst_px[2] =
uint8_t(accum[2] / sample_count);
1821 dst_px[3] =
uint8_t(accum[3] / sample_count);
1822 accum[0] = accum[1] = accum[2] = accum[3] = 0;
1826 src_x_beg = src_x_end;
1828 sample_count_all += sample_count;
1832 BLI_assert(src_px == src_rect + (
sizeof(
uint8_t[4]) * src_size[0] * src_size[1]));
1833 BLI_assert(sample_count_all ==
size_t(src_size[0]) *
size_t(src_size[1]));
1843 if (size[0] > size[1]) {
1845 result.y =
max_ii(1,
int((
float(size[1]) /
float(size[0])) * limit));
1848 result.x =
max_ii(1,
int((
float(size[0]) /
float(size[1])) * limit));
1862 if (
G.background || (win ==
nullptr)) {
1875 ImBuf *ibuf =
nullptr;
1881#ifdef USE_THUMBNAIL_FAST_DOWNSCALE
1882 if ((thumb_size_2x[0] <= win_size[0]) && (thumb_size_2x[1] <= win_size[1])) {
1914 char version_str[10];
1937 if (
G.background || scene ==
nullptr) {
1945 const float pixelsize_old =
U.pixelsize;
1947 char err_out[256] =
"unknown";
1954 if (screen !=
nullptr) {
1957 v3d =
static_cast<View3D *
>(area->spacedata.first);
1962 if (scene->camera ==
nullptr && v3d ==
nullptr) {
1972 if (scene->camera) {
1975 (v3d) ? &v3d->
shading :
nullptr,
2006 U.pixelsize = pixelsize_old;
2009 if (windrawable_old) {
2022 char version_str[10];
2040 CLOG_WARN(&
LOG,
"failed to create thumbnail: %s", err_out);
2064 printf(
"%s: \"%s\"\n", success ?
"written" :
"failed", filepath);
2073 const char *filepath,
2076 const int filepath_len = strlen(filepath);
2077 if (filepath_len == 0) {
2090 BKE_report(reports,
RPT_ERROR,
"Cannot overwrite files that are managed by the asset system");
2095 if (
BLI_path_cmp(li->runtime.filepath_abs, filepath) == 0) {
2108 const char *filepath,
2111 bool use_save_as_copy,
2116 ImBuf *ibuf_thumb =
nullptr;
2136 reports,
RPT_ERROR,
"Cannot save blend file, path \"%s\" is not writable", filepath);
2165 if (thumb !=
nullptr) {
2170 int file_preview_type =
U.file_preview_type;
2175 bool do_render = (scene !=
nullptr && scene->camera !=
nullptr && screen !=
nullptr &&
2180 switch (file_preview_type) {
2209 blend_write_params.use_save_versions =
true;
2210 blend_write_params.use_save_as_copy = use_save_as_copy;
2211 blend_write_params.thumb = thumb;
2213 const bool success =
BLO_write_file(bmain, filepath, fileflags, &blend_write_params, reports);
2216 const bool do_history_file_update = (
G.background ==
false) &&
2219 if (use_save_as_copy ==
false) {
2226 if (do_history_file_update) {
2246 if (thumb && thumb != main_thumb) {
2263 const int pid =
abs(getpid());
2264 char filename[1024];
2271 if (blendfile_path && (blendfile_path[0] !=
'\0')) {
2273 int len = strlen(basename) - 6;
2274 SNPRINTF(filename,
"%.*s_%d_autosave.blend",
len, basename, pid);
2277 SNPRINTF(filename,
"%d_autosave.blend", pid);
2417 "use_factory_startup_app_template_only",
2419 "Factory Startup App-Template Only",
2476 const char *
app_template =
U.app_template[0] ?
U.app_template :
nullptr;
2479 if (!cfgdir.has_value()) {
2500 printf(
"Writing homefile: \"%s\" ", filepath);
2506 fileflags =
G.fileflags & ~G_FILE_COMPRESS;
2514 blend_write_params.use_save_as_copy =
true;
2517 bmain, filepath, fileflags, &blend_write_params, op->
reports);
2536 if (!
U.app_template[0]) {
2539 IFACE_(
"Overwrite Main Startup File"),
2540 IFACE_(
"Make the current file the default startup blend file."),
2549 std::string message = fmt::format(
2550 IFACE_(
"Make the current file the default \"{}\" startup file."),
IFACE_(display_name));
2553 IFACE_(
"Overwrite Template Startup File"),
2562 ot->
name =
"Save Startup File";
2563 ot->
idname =
"WM_OT_save_homefile";
2564 ot->
description =
"Make the current file the default startup file";
2591 ot->
name =
"Save Preferences";
2592 ot->
idname =
"WM_OT_save_userpref";
2610#define USERDEF_RESTORE(member) \
2612 userdef_curr->member = userdef_prev->member; \
2619#undef USERDEF_RESTORE
2676 const bool use_data =
false;
2677 const bool use_userdef =
true;
2678 const bool use_factory_settings =
STREQ(op->
type->
idname,
"WM_OT_read_factory_userpref");
2679 const bool use_factory_settings_app_template_only =
2680 (use_factory_settings &&
RNA_boolean_get(op->
ptr,
"use_factory_startup_app_template_only"));
2684 UserDef U_backup = blender::dna::shallow_copy(
U);
2687 read_homefile_params.
use_data = use_data;
2688 read_homefile_params.use_userdef = use_userdef;
2689 read_homefile_params.use_factory_settings = use_factory_settings;
2690 read_homefile_params.use_factory_settings_app_template_only =
2691 use_factory_settings_app_template_only;
2692 read_homefile_params.use_empty_data =
false;
2693 read_homefile_params.filepath_startup_override =
nullptr;
2702 if (use_factory_settings) {
2703 U.runtime.is_dirty =
true;
2718 ot->
name =
"Load Preferences";
2719 ot->
idname =
"WM_OT_read_userpref";
2730 const bool template_only =
U.app_template[0] &&
2733 if (template_only) {
2736 title = fmt::format(
IFACE_(
"Load Factory \"{}\" Preferences."),
IFACE_(display_name));
2739 title =
IFACE_(
"Load Factory Blender Preferences");
2746 IFACE_(
"To make changes to Preferences permanent, use \"Save Preferences\""),
2754 ot->
name =
"Load Factory Preferences";
2755 ot->
idname =
"WM_OT_read_factory_userpref";
2757 "Load factory default preferences. "
2758 "To make changes to preferences permanent, use \"Save Preferences\"";
2781 ot->
name =
"Reload History File";
2803 "WM_OT_read_factory_settings");
2804 const bool use_factory_settings = use_factory_startup_and_userdef ||
2806 const bool use_factory_settings_app_template_only =
2807 (use_factory_startup_and_userdef &&
2810 bool use_userdef =
false;
2812 const char *filepath =
nullptr;
2813 UserDef U_backup = blender::dna::shallow_copy(
U);
2815 if (!use_factory_settings) {
2825 filepath = filepath_buf;
2828 op->
reports,
RPT_ERROR,
"Can't read alternative start-up file: \"%s\"", filepath);
2834 if (use_factory_startup_and_userdef) {
2836 G.fileflags &= ~G_FILE_NO_UI;
2845 char app_template_buf[
sizeof(
U.app_template)];
2848 const bool use_splash = !use_factory_settings &&
RNA_boolean_get(op->
ptr,
"use_splash");
2855 if (!use_factory_settings) {
2874 read_homefile_params.
use_data =
true;
2875 read_homefile_params.use_userdef = use_userdef;
2876 read_homefile_params.use_factory_settings = use_factory_settings;
2877 read_homefile_params.use_factory_settings_app_template_only =
2878 use_factory_settings_app_template_only;
2879 read_homefile_params.use_empty_data = use_empty_data;
2880 read_homefile_params.filepath_startup_override = filepath;
2881 read_homefile_params.app_template_override =
app_template;
2892 if (use_factory_settings) {
2893 U.runtime.is_dirty =
true;
2934 "After loading, remove everything except scenes, windows, and workspaces. This makes it "
2935 "possible to load the startup file with its scene configuration and window layout intact, "
2936 "but no objects, materials, animations, ...");
2943 ot->
name =
"Reload Start-Up File";
2944 ot->
idname =
"WM_OT_read_homefile";
2955 "Path to an alternative start-up file");
2960 ot->
srna,
"load_ui",
true,
"Load UI",
"Load user interface setup from the .blend file");
2971 "use_factory_startup",
2974 "Load the default ('factory startup') blend file. "
2975 "This is independent of the normal start-up file that the user can save");
2989 const bool template_only =
U.app_template[0] &&
2992 if (template_only) {
2995 title = fmt::format(
IFACE_(
"Load Factory \"{}\" Startup File and Preferences"),
2999 title =
IFACE_(
"Load Factory Default Startup File and Preferences");
3006 unsaved ?
IFACE_(
"To make changes to Preferences permanent, use \"Save Preferences\".\n"
3007 "Warning: Your file is unsaved! Proceeding will abandon your changes.") :
3008 IFACE_(
"To make changes to Preferences permanent, use \"Save Preferences\"."),
3016 ot->
name =
"Load Factory Settings";
3017 ot->
idname =
"WM_OT_read_factory_settings";
3019 "Load factory default startup file and preferences. "
3020 "To make changes permanent, use \"Save Startup File\" and \"Save Preferences\"";
3051 const bool success =
WM_file_read(C, filepath, reports);
3084 for (
int i = 0; targets[i].
run; i++) {
3086 if (target.state ==
state) {
3087 return target.
run(C, op);
3145 if (
G.recent_files.first) {
3223 if (
BLI_stat(filepath, &stats) == -1) {
3224 return fmt::format(
"{}\n\n{}", filepath,
TIP_(
"File Not Found"));
3230 bool is_today, is_yesterday;
3232 nullptr,
int64_t(stats.st_mtime),
false, time_str, date_str, &is_today, &is_yesterday);
3233 if (is_today || is_yesterday) {
3241 return fmt::format(
"{}\n\n{}: {} {}\n{}: {}",
3260 bool is_untrusted =
false;
3269 *(lslash + 1) =
'\0';
3275 is_untrusted =
true;
3283 return is_untrusted;
3290 const char *autoexec_text;
3296 autoexec_text =
IFACE_(
"Trusted Source [Untrusted Path]");
3301 autoexec_text =
IFACE_(
"Trusted Source");
3313 "Allow .blend file to execute scripts automatically, default available from "
3314 "system preferences");
3320 ot->
idname =
"WM_OT_open_mainfile";
3339 ot->
srna,
"load_ui",
true,
"Load UI",
"Load user interface setup in the .blend file");
3344 ot->
srna,
"display_file_selector",
true,
"Display File Selector",
"");
3358 std::string message =
IFACE_(
"Any unsaved changes will be lost.");
3361 message +=
IFACE_(
"Warning: There are unsaved external image(s).");
3366 IFACE_(
"Revert to the Saved File"),
3395 return (blendfile_path[0] !=
'\0');
3401 ot->
idname =
"WM_OT_revert_mainfile";
3423 G.fileflags &= ~G_FILE_RECOVER_READ;
3432 if (!
G.background) {
3434 PointerRNA *props_ptr = MEM_new<PointerRNA>(__func__);
3466 ot->
name =
"Recover Last Session";
3467 ot->
idname =
"WM_OT_recover_last_session";
3497 G.fileflags &= ~G_FILE_RECOVER_READ;
3500 if (!
G.background) {
3502 PointerRNA *props_ptr = MEM_new<PointerRNA>(__func__);
3526 ot->
name =
"Recover Auto Save";
3527 ot->
idname =
"WM_OT_recover_auto_save";
3528 ot->
description =
"Open an automatically saved file to recover it";
3568 if (blendfile_path[0] !=
'\0') {
3587 if ((blendfile_path[0] ==
'\0') &&
G.recent_files.first) {
3592 STRNCPY(filepath, blendfile_path);
3644 if (is_filepath_set) {
3652 if (filepath[0] ==
'\0') {
3655 "Unable to save an unsaved file with an empty or unset \"filepath\" property");
3664 if (num == 0 && digits == 0) {
3669 const int tries_limit = 1000;
3677 }
while (in_use && tries < tries_limit && num < INT_MAX);
3684 const int fileflags_orig =
G.fileflags;
3685 int fileflags =
G.fileflags;
3691 C, filepath, fileflags, remap_mode, use_save_as_copy, op->
reports);
3697 G.fileflags = fileflags_orig;
3700 if (success ==
false) {
3704 if (!use_save_as_copy) {
3717 wm->autosave_scheduled =
false;
3757 "Save the current file in the desired location but do not make the saved file active"));
3767 ot->
idname =
"WM_OT_save_as_mainfile";
3768 ot->
description =
"Save the current file in the desired location";
3789 "Remap relative paths when saving to a different directory");
3795 "Save a copy of the actual working state but does not make saved file active");
3822 if (blendfile_path[0] !=
'\0') {
3845 "Save the current Blender file with a numerically incremented name that does not "
3846 "overwrite any existing files");
3853 ot->
name =
"Save Blender File";
3854 ot->
idname =
"WM_OT_save_mainfile";
3876 "Remap relative paths when saving to a different directory");
3885 "Save the current Blender file with a numerically incremented name that "
3886 "does not overwrite any existing files");
3901 {0,
nullptr, 0,
nullptr,
nullptr},
3907 C, op, event,
IFACE_(
"Clear Recent Files List"),
IFACE_(
"Remove"));
3943 ot->
name =
"Clear Recent Files List";
3944 ot->
idname =
"WM_OT_clear_recent_files";
4025 RPT_(
"For security reasons, automatic execution of Python scripts "
4026 "in this file was disabled:"),
4031 uiItemL(
col,
RPT_(
"This may lead to unexpected behavior"), ICON_NONE);
4038 "use_scripts_auto_execute",
4040 RPT_(
"Permanently allow execution of scripts"),
4058 if ((blendfile_path[0] !=
'\0') && wm->
file_saved) {
4063 IFACE_(
"Allow Execution"),
4071 TIP_(
"Reload file with execution of Python scripts enabled"));
4080 IFACE_(
"Allow Execution"),
4088 TIP_(
"Enable scripts"));
4107 TIP_(
"Continue using file without Python scripts"));
4148 if (
ot ==
nullptr) {
4150 ptr = MEM_new<PointerRNA>(__func__);
4220 char writer_ver_str[16];
4221 char current_ver_str[16];
4230 writer_ver_str,
sizeof(writer_ver_str), bmain->
versionfile, -1);
4235 char message_line1[256];
4236 char message_line2[256];
4238 RPT_(
"This file was saved by a newer version of Blender (%s)"),
4241 RPT_(
"Saving it with this Blender (%s) may cause loss of data"),
4243 uiItemL(layout, message_line1, ICON_NONE);
4244 uiItemL(layout, message_line2, ICON_NONE);
4253 RPT_(
"This file is managed by the Blender asset system. It can only be"),
4255 uiItemL(layout,
RPT_(
"saved as a new, regular file."), ICON_NONE);
4268 block,
UI_BTYPE_BUT, 0, ICON_NONE,
IFACE_(
"Cancel"), 0, 0, 0,
UI_UNIT_Y,
nullptr, 0, 0,
"");
4287 PointerRNA *operator_propptr_p = &operator_propptr;
4360 RPT_(
"Cannot overwrite asset system files. Save as new file"),
4364 uiItemL_ex(layout,
RPT_(
"with an older Blender version?"), ICON_NONE,
true,
false);
4368 layout,
RPT_(
"Overwrite file with an older Blender version?"), ICON_NONE,
true,
false);
4373 RPT_(
"Cannot overwrite asset system files. Save as new file?"),
4385 if (blendfile_path[0] !=
'\0') {
4394 uiItemL(layout, filename, ICON_NONE);
4409 if (allow_overwrite) {
4474 bool execute_callback =
true;
4487 execute_callback =
false;
4493 if (file_has_been_saved_before) {
4502 execute_callback =
false;
4508 execute_callback =
false;
4514 execute_callback =
false;
4517 if (execute_callback) {
4526 block,
UI_BTYPE_BUT, 0, ICON_NONE,
IFACE_(
"Cancel"), 0, 0, 0,
UI_UNIT_Y,
nullptr, 0, 0,
"");
4552 const bool needs_overwrite_confirm)
4560 needs_overwrite_confirm ?
IFACE_(
"Save As...") :
IFACE_(
"Save"),
4578 char *save_catalogs_when_file_is_closed =
static_cast<char *
>(arg1);
4580 *save_catalogs_when_file_is_closed != 0);
4599 uiItemL_ex(layout,
RPT_(
"Save changes before closing?"), ICON_NONE,
true,
false);
4604 if (blendfile_path[0] !=
'\0') {
4610 uiItemL(layout, filename, ICON_NONE);
4613 if (needs_overwrite_confirm) {
4630 char *message =
BLI_strdupn(report->message, report->len);
4631 char *path_info = strstr(message,
": ");
4634 path_info[1] =
'\0';
4638 uiItemL_ex(row, message, ICON_NONE,
false,
true);
4640 uiItemL_ex(row, path_info, ICON_NONE,
false,
true);
4646 bool has_extra_checkboxes =
false;
4649 if (modified_images_count > 0) {
4651 SNPRINTF(message,
"Save %u modified image(s)", modified_images_count);
4653 if (!has_extra_checkboxes) {
4669 has_extra_checkboxes =
true;
4673 static char save_catalogs_when_file_is_closed;
4675 save_catalogs_when_file_is_closed = ed::asset::catalogs_get_save_catalogs_when_file_is_saved();
4678 if (!has_extra_checkboxes) {
4685 "Save modified asset catalogs",
4690 &save_catalogs_when_file_is_closed,
4696 &save_catalogs_when_file_is_closed,
4698 has_extra_checkboxes =
true;
4703 uiItemS_ex(layout, has_extra_checkboxes ? 2.0f : 4.0f);
4707 const bool windows_layout =
true;
4709 const bool windows_layout =
false;
4712 if (windows_layout) {
void AS_asset_libraries_exit()
bool AS_asset_library_has_any_unsaved_catalogs()
bool BKE_addon_remove_safe(struct ListBase *addon_list, const char *module)
bool BKE_appdir_app_template_id_search(const char *app_template, char *path, size_t path_maxncpy) ATTR_NONNULL(1)
void BKE_tempdir_init(const char *userdir)
#define BLENDER_USERPREF_FILE
bool BKE_appdir_app_template_has_userpref(const char *app_template) ATTR_NONNULL(1)
#define BLENDER_HISTORY_FILE
std::optional< std::string > BKE_appdir_folder_id(int folder_id, const char *subfolder) ATTR_WARN_UNUSED_RESULT
#define BLENDER_STARTUP_FILE
#define BLENDER_QUIT_FILE
const char * BKE_tempdir_base() ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
bool BKE_appdir_app_template_any()
std::optional< std::string > BKE_appdir_folder_id_create(int folder_id, const char *subfolder) ATTR_WARN_UNUSED_RESULT
bool BKE_autoexec_match(const char *path)
void BKE_blender_userdef_app_template_data_set_and_free(UserDef *userdef)
void BKE_blender_userdef_data_set_and_free(UserDef *userdef)
#define BLENDER_FILE_SUBVERSION
void BKE_blender_version_blendfile_string_from_values(char *str_buff, const size_t str_buff_maxncpy, const short file_version, const short file_subversion)
#define BLENDER_FILE_VERSION
void BKE_blendfile_read_setup_readfile(bContext *C, BlendFileData *bfd, const BlendFileReadParams *params, BlendFileReadWMSetupData *wm_setup_data, BlendFileReadReport *reports, bool startup_update_defaults, const char *startup_app_template)
bool BKE_blendfile_userdef_write_all(ReportList *reports)
#define BLENDER_ASSET_FILE_SUFFIX
void BKE_blendfile_read_make_empty(bContext *C)
bool BKE_blendfile_extension_check(const char *str)
UserDef * BKE_blendfile_userdef_from_defaults()
UserDef * BKE_blendfile_userdef_read(const char *filepath, ReportList *reports)
BlendFileData * BKE_blendfile_read(const char *filepath, const BlendFileReadParams *params, BlendFileReadReport *reports)
BlendFileData * BKE_blendfile_read_from_memory(const void *file_buf, int file_buf_size, const BlendFileReadParams *params, ReportList *reports)
void BKE_callback_exec_string(Main *bmain, eCbEvent evt, const char *str)
void BKE_callback_exec_null(Main *bmain, eCbEvent evt)
@ BKE_CB_EVT_LOAD_FACTORY_STARTUP_POST
@ BKE_CB_EVT_LOAD_FACTORY_USERDEF_POST
@ BKE_CB_EVT_LOAD_POST_FAIL
@ BKE_CB_EVT_EXTENSION_REPOS_UPDATE_PRE
@ BKE_CB_EVT_VERSION_UPDATE
@ BKE_CB_EVT_SAVE_POST_FAIL
@ BKE_CB_EVT_EXTENSION_REPOS_UPDATE_POST
ReportList * CTX_wm_reports(const bContext *C)
bScreen * CTX_wm_screen(const bContext *C)
bool CTX_py_init_get(bContext *C)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
void CTX_wm_window_set(bContext *C, wmWindow *win)
Main * CTX_data_main(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
wmMsgBus * CTX_wm_message_bus(const bContext *C)
void CTX_wm_region_popup_set(bContext *C, ARegion *region_popup)
@ 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_READFILE
#define G_FLAG_INTERNET_OVERRIDE_PREF_ANY
#define G_FLAG_ALL_RUNTIME
void IDP_FreeProperty(IDProperty *prop)
IDProperty * IDP_CopyProperty(const IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BKE_libblock_free_data_py(ID *id)
void BKE_libblock_free_data(ID *id, bool do_id_user) ATTR_NONNULL()
IDNewNameResult BKE_libblock_rename(Main &bmain, ID &id, blender::StringRefNull name, const IDNewNameMode mode=IDNewNameMode::RenameExistingNever)
void BKE_lib_override_library_main_operations_create(Main *bmain, bool force_auto, int *r_report_flags)
BlendThumbnail * BKE_main_thumbnail_from_imbuf(Main *bmain, ImBuf *img)
bool BKE_main_needs_overwrite_confirm(const Main *bmain)
ImBuf * BKE_main_thumbnail_to_imbuf(Main *bmain, BlendThumbnail *data)
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
BlendThumbnail * BKE_main_thumbnail_from_buffer(Main *bmain, const uint8_t *rect, const int size[2])
const char * BKE_main_blendfile_path_from_global()
bool BKE_main_namemap_validate(Main *bmain) ATTR_NONNULL()
#define FOREACH_NODETREE_END
#define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id)
void BKE_packedfile_pack_all(Main *bmain, ReportList *reports, bool verbose)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_reports_free(ReportList *reports)
void BKE_report_print_level_set(ReportList *reports, eReportType level)
void BKE_report(ReportList *reports, eReportType type, const char *message)
void BKE_reports_init(ReportList *reports, int flag)
void BKE_scene_free_depsgraph_hash(Scene *scene)
ScrArea * BKE_screen_find_big_area(const bScreen *screen, int spacetype, short min)
ARegion * BKE_area_find_region_type(const ScrArea *area, int region_type)
void BKE_sound_init(struct Main *bmain)
void BKE_undosys_stack_init_from_context(UndoStack *ustack, bContext *C)
void BKE_undosys_stack_clear(UndoStack *ustack)
void BKE_undosys_stack_init_from_main(UndoStack *ustack, Main *bmain)
UndoStack * BKE_undosys_stack_create()
void BKE_workspace_active_set(WorkSpaceInstanceHook *hook, WorkSpace *workspace) SETTER_ATTRS
WorkSpaceLayout * BKE_workspace_layout_find_global(const Main *bmain, const bScreen *screen, WorkSpace **r_workspace) ATTR_NONNULL(1
#define BLI_assert_unreachable()
#define BLI_STATIC_ASSERT(a, msg)
#define BLI_assert_msg(a, msg)
int BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BLI_file_is_writable(const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
FILE * BLI_fopen(const char *filepath, const char *mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BLI_file_magic_is_gzip(const char header[4])
int BLI_stat(const char *path, BLI_stat_t *buffer) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
int BLI_delete(const char *path, bool dir, bool recursive) ATTR_NONNULL()
struct LinkNode * BLI_file_read_as_lines(const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BLI_filelist_entry_size_to_string(const struct stat *st, uint64_t st_size_fallback, bool compact, char r_size[FILELIST_DIRENTRY_SIZE_LEN])
void BLI_file_free_lines(struct LinkNode *lines)
bool BLI_file_magic_is_zstd(const char header[4])
int BLI_access(const char *filepath, int mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
int BLI_rename_overwrite(const char *from, const char *to) ATTR_NONNULL()
void BLI_filelist_entry_datetime_to_string(const struct stat *st, int64_t ts, bool compact, char r_time[FILELIST_DIRENTRY_TIME_LEN], char r_date[FILELIST_DIRENTRY_DATE_LEN], bool *r_is_today, bool *r_is_yesterday)
int BLI_open(const char *filepath, int oflag, int pmode) 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
Wrapper for reading from various sources (e.g. raw files, compressed files, memory....
FileReader * BLI_filereader_new_zstd(FileReader *base) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
FileReader * BLI_filereader_new_file(int filedes) ATTR_WARN_UNUSED_RESULT
FileReader * BLI_filereader_new_gzip(FileReader *base) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void BLI_linklist_free(LinkNode *list, LinkNodeFreeFP freefunc)
void * BLI_findstring(const struct ListBase *listbase, const char *id, 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_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_listbase_count_at_most(const struct ListBase *listbase, int count_max) 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_findstring_ptr(const struct ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE int max_ii(int a, int b)
void BLI_math_time_seconds_decompose(double seconds, double *r_days, double *r_hours, double *r_minutes, double *r_seconds, double *r_milliseconds)
bool BLI_path_filename_ensure(char *filepath, size_t filepath_maxncpy, const char *filename) ATTR_NONNULL(1
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
void BLI_path_to_display_name(char *display_name, int display_name_maxncpy, const char *name) ATTR_NONNULL(1
bool BLI_path_extension_replace(char *path, size_t path_maxncpy, const char *ext) ATTR_NONNULL(1
#define BLI_path_join(...)
void void void BLI_path_split_file_part(const char *filepath, char *file, size_t file_maxncpy) ATTR_NONNULL(1
int BLI_path_canonicalize_native(char *path, int path_maxncpy)
bool BLI_path_extension_ensure(char *path, size_t path_maxncpy, const char *ext) ATTR_NONNULL(1
int BLI_path_sequence_decode(const char *path, char *head, size_t head_maxncpy, char *tail, size_t tail_maxncpy, unsigned short *r_digits_len)
void void BLI_path_split_dir_part(const char *filepath, char *dir, size_t dir_maxncpy) ATTR_NONNULL(1
const char * BLI_path_slash_rfind(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
void BLI_path_sequence_encode(char *path, size_t path_maxncpy, const char *head, const char *tail, unsigned short numlen, int pic)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
#define STRNCPY(dst, src)
char * BLI_strdupn(const char *str, size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define SNPRINTF(dst, format,...)
int BLI_str_rstrip_digits(char *str) ATTR_NONNULL()
int BLI_thread_is_main(void)
Platform independent time functions.
double BLI_time_now_seconds(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(UserDef *userdef)
external writefile.cc function prototypes.
bool BLO_write_file(Main *mainvar, const char *filepath, int write_flags, const BlendFileWriteParams *params, ReportList *reports)
@ BLO_WRITE_PATH_REMAP_NONE
@ BLO_WRITE_PATH_REMAP_ABSOLUTE
@ BLO_WRITE_PATH_REMAP_RELATIVE
bool BLT_translate_new_dataname()
#define BLT_I18NCONTEXT_ID_WORKSPACE
#define CTX_IFACE_(context, msgid)
#define CTX_DATA_(context, msgid)
void BPY_python_reset(bContext *C)
bool BPY_run_string_eval(bContext *C, const char *imports[], const char *expr)
bool BPY_run_string_exec(bContext *C, const char *imports[], const char *expr)
#define CLOG_ERROR(clg_ref,...)
#define CLOG_WARN(clg_ref,...)
#define CLOG_INFO(clg_ref, level,...)
Object is a sort of wrapper for general info.
@ USER_SCRIPT_AUTOEXEC_DISABLE
@ USER_FILE_PREVIEW_CAMERA
@ USER_FILE_PREVIEW_SCREENSHOT
@ V3D_OFSDRAW_OVERRIDE_SCENE_SETTINGS
@ V3D_RUNTIME_LOCAL_MAYBE_EMPTY
int datatoc_startup_blend_size
const char datatoc_startup_blend[]
void ED_file_read_bookmarks()
int ED_image_save_all_modified_info(const Main *bmain, ReportList *reports)
bool ED_image_should_save_modified(const Main *bmain)
bool ED_image_save_all_modified(const bContext *C, ReportList *reports)
void ED_outliner_select_sync_from_all_tag(bContext *C)
void ED_preview_restart_queue_free()
void ED_screen_exit(bContext *C, wmWindow *window, bScreen *screen)
WorkSpaceLayout * ED_workspace_layout_duplicate(Main *bmain, WorkSpace *workspace, const WorkSpaceLayout *layout_old, wmWindow *win) ATTR_NONNULL()
MemFile * ED_undosys_stack_memfile_get_if_active(UndoStack *ustack)
void ED_editors_exit(Main *bmain, bool do_undo_system)
bool ED_editors_flush_edits(Main *bmain)
void ED_editors_init(bContext *C)
void ED_view3d_local_collections_reset(const bContext *C, bool reset_all)
ImBuf * ED_view3d_draw_offscreen_imbuf(Depsgraph *depsgraph, Scene *scene, eDrawType drawtype, View3D *v3d, ARegion *region, int sizex, int sizey, eImBufFlags imbuf_flag, int alpha_mode, const char *viewname, bool restore_rv3d_mats, GPUOffScreen *ofs, GPUViewport *viewport, char err_out[256])
ImBuf * ED_view3d_draw_offscreen_imbuf_simple(Depsgraph *depsgraph, Scene *scene, View3DShading *shading_override, eDrawType drawtype, Object *camera, int width, int height, eImBufFlags imbuf_flags, eV3DOffscreenDrawFlag draw_flags, int alpha_mode, const char *viewname, GPUOffScreen *ofs, GPUViewport *viewport, char err_out[256])
GHOST C-API function and type declarations.
void GHOST_SetWindowUserData(GHOST_WindowHandle windowhandle, GHOST_TUserDataPtr user_data)
void GHOST_addToSystemRecentFiles(const char *filepath)
bool GPU_backend_type_selection_is_overridden()
bool GPU_backend_type_selection_detect()
void GPU_backend_type_selection_set_override(eGPUBackendType backend_type)
ImBuf * IMB_dupImBuf(const ImBuf *ibuf1)
ImBuf * IMB_allocFromBufferOwn(uint8_t *byte_buffer, float *float_buffer, unsigned int w, unsigned int h, unsigned int channels)
bool IMB_scale(ImBuf *ibuf, unsigned int newx, unsigned int newy, IMBScaleFilter filter, bool threaded=true)
Contains defines and structs used throughout the imbuf module.
ImBuf * IMB_thumb_create(const char *filepath, ThumbSize size, ThumbSource source, ImBuf *img)
void IMB_thumb_delete(const char *file_or_lib_path, ThumbSize size)
#define PREVIEW_RENDER_LARGE_HEIGHT
void MEM_CacheLimiter_set_maximum(size_t m)
Read Guarded memory(de)allocation.
constexpr int SEQ_MAX_CHANNELS
void UI_but_func_set(uiBut *but, std::function< void(bContext &)> func)
void uiLayoutSetActive(uiLayout *layout, bool active)
void UI_block_theme_style_set(uiBlock *block, char theme_style)
void uiLayoutSetEnabled(uiLayout *layout, bool enabled)
uiLayout * uiItemsAlertBox(uiBlock *block, const uiStyle *style, const int dialog_width, const eAlertIcon icon, const int icon_size)
void uiLayoutSetScaleY(uiLayout *layout, float scale)
void uiItemL(uiLayout *layout, const char *name, int icon)
void UI_popup_block_invoke(bContext *C, uiBlockCreateFunc func, void *arg, uiFreeArgFunc arg_free)
void uiLayoutSetPropSep(uiLayout *layout, bool is_sep)
uiBlock * UI_block_begin(const bContext *C, ARegion *region, std::string name, eUIEmbossType emboss)
void uiItemS(uiLayout *layout)
uiBut * uiDefIconTextBut(uiBlock *block, int type, int retval, int icon, blender::StringRef str, int x, int y, short width, short height, void *poin, float min, float max, const char *tip)
void UI_popup_block_close(bContext *C, wmWindow *win, uiBlock *block)
bool UI_popup_block_name_exists(const bScreen *screen, blender::StringRef name)
void uiItemS_ex(uiLayout *layout, float factor, LayoutSeparatorType type=LayoutSeparatorType::Auto)
uiBut * uiDefButBitC(uiBlock *block, int type, int bit, int retval, blender::StringRef str, int x, int y, short width, short height, char *poin, float min, float max, const char *tip)
void UI_block_emboss_set(uiBlock *block, eUIEmbossType emboss)
void UI_but_drawflag_disable(uiBut *but, int flag)
@ UI_BLOCK_THEME_STYLE_POPUP
void uiLayoutSetPropDecorate(uiLayout *layout, bool is_sep)
void UI_block_bounds_set_centered(uiBlock *block, int addval)
uiLayout * uiLayoutColumn(uiLayout *layout, bool align)
uiLayout * uiLayoutSplit(uiLayout *layout, float percentage, bool align)
void UI_block_flag_enable(uiBlock *block, int flag)
uiBut * uiItemL_ex(uiLayout *layout, const char *name, int icon, bool highlight, bool redalert)
void UI_but_flag_enable(uiBut *but, int flag)
void uiItemR(uiLayout *layout, PointerRNA *ptr, const char *propname, eUI_Item_Flag flag, const char *name, int icon)
void UI_view2d_zoom_cache_reset()
#define ND_ASSET_LIST_READING
void(*)(bContext *C, void *user_data) wmGenericCallbackFn
ATTR_WARN_UNUSED_RESULT const BMLoop * l
constexpr bool endswith(StringRef suffix) const
const Depsgraph * depsgraph
DEGForeachIDComponentCallback callback
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void IMB_freeImBuf(ImBuf *)
void *(* MEM_mallocN)(size_t len, const char *str)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void catalogs_set_save_catalogs_when_file_is_saved(bool should_save)
void pre_save_assets(Main *bmain)
void set_approximate_size_limit(int64_t limit_in_bytes)
void ntreeCompositUpdateRLayers(bNodeTree *ntree)
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
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)
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_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
std::string RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop)
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)
PointerRNA RNA_pointer_create(ID *id, StructRNA *type, void *data)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_struct_iterator_property(StructRNA *type)
const char * RNA_property_identifier(const PropertyRNA *prop)
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_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, const int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int 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, const int maxlen, const char *ui_name, const char *ui_description)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, 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, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
unsigned __int64 uint64_t
LinkNode * resynced_lib_overrides_libraries
double lib_overrides_recursive_resync
int resynced_lib_overrides
int resynced_lib_overrides_libraries_count
struct BlendFileReadReport::@127 duration
int sequence_strips_skipped
struct BlendFileReadReport::@128 count
int proxies_to_lib_overrides_failures
double lib_overrides_resync
int proxies_to_lib_overrides_success
eBLO_WritePathRemap remap_mode
bool has_forward_compatibility_issues
BlendThumbnail * blen_thumb
int(* run)(bContext *C, wmOperator *op)
const char * app_template_override
unsigned int use_factory_settings_app_template_only
const char * filepath_startup_override
unsigned int use_factory_settings
unsigned int is_first_time
unsigned int use_empty_data
bool(* poll)(bContext *C) ATTR_WARN_UNUSED_RESULT
std::string(* get_description)(bContext *C, wmOperatorType *ot, PointerRNA *ptr)
bool(* check)(bContext *C, wmOperator *op)
std::string(* get_name)(wmOperatorType *ot, PointerRNA *ptr)
int(* invoke)(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
int(* exec)(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
const char * translation_context
void(* ui)(bContext *C, wmOperator *op)
struct ReportList * reports
struct wmOperatorType * type
struct wmMsgBus * message_bus
struct wmKeyConfig * defaultconf
WindowManagerRuntimeHandle * runtime
struct UndoStack * undo_stack
struct wmWindow * winactive
struct wmKeyConfig * userconf
struct wmTimer * autosavetimer
struct wmWindow * windrawable
struct wmKeyConfig * addonconf
struct wmEvent * eventstate
struct wmEvent * event_last_handled
ccl_device_inline int abs(int x)
void wm_close_and_free(bContext *C, wmWindowManager *wm)
void wm_clear_default_size(bContext *C)
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)
uint8_t * WM_window_pixels_read_from_frontbuffer(const wmWindowManager *wm, const wmWindow *win, int r_size[2])
void WM_event_add_fileselect(bContext *C, wmOperator *op)
void wm_event_do_depsgraph(bContext *C, bool is_after_open_file)
void WM_main_add_notifier(uint type, void *reference)
int WM_operator_name_call_ptr(bContext *C, wmOperatorType *ot, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)
int WM_operator_name_call_with_properties(bContext *C, const char *opstring, wmOperatorCallContext context, IDProperty *properties, const wmEvent *event)
void WM_report_banner_show(wmWindowManager *wm, wmWindow *win)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
int WM_operator_name_call(bContext *C, const char *opstring, wmOperatorCallContext context, PointerRNA *properties, const wmEvent *event)
void WM_event_remove_handlers(bContext *C, ListBase *handlers)
void WM_autosave_write(wmWindowManager *wm, Main *bmain)
static struct @1380 wm_test_autorun_revert_action_data
static void free_post_file_close_action(void *arg)
void WM_file_autosave_init(wmWindowManager *wm)
bool WM_autosave_is_scheduled(wmWindowManager *wm)
void wm_homefile_read(bContext *C, const wmHomeFileRead_Params *params_homefile, ReportList *reports)
void wm_autosave_timer_end(wmWindowManager *wm)
static void create_operator_state(wmOperatorType *ot, int first_state)
#define BKE_READ_EXOTIC_OK_BLEND
static int wm_clear_recent_files_exec(bContext *, wmOperator *op)
bool wm_operator_close_file_dialog_if_needed(bContext *C, wmOperator *op, wmGenericCallbackFn post_action_fn)
static void wm_init_userdef(Main *bmain)
static int wm_history_file_read_exec(bContext *, wmOperator *)
static std::string wm_save_mainfile_get_description(bContext *, wmOperatorType *, PointerRNA *ptr)
static bool wm_save_mainfile_check(bContext *, wmOperator *op)
@ OPEN_MAINFILE_STATE_OPEN
@ OPEN_MAINFILE_STATE_DISCARD_CHANGES
@ OPEN_MAINFILE_STATE_SELECT_FILE_PATH
static int wm_recover_last_session_exec(bContext *C, wmOperator *op)
static uiBlock * block_create__close_file_dialog(bContext *C, ARegion *region, void *arg1)
static BlendFileReadWMSetupData * wm_file_read_setup_wm_init(bContext *C, Main *bmain, const bool is_read_homefile)
static int wm_open_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *)
static int operator_state_dispatch(bContext *C, wmOperator *op, OperatorDispatchTarget *targets)
bool WM_file_recover_last_session(bContext *C, ReportList *reports)
void WM_OT_read_history(wmOperatorType *ot)
static int wm_homefile_read_invoke(bContext *C, wmOperator *op, const wmEvent *)
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 bool wm_file_write_check_with_report_on_failure(Main *bmain, const char *filepath, ReportList *reports)
static int wm_homefile_read_exec(bContext *C, wmOperator *op)
static int wm_open_mainfile__discard_changes(bContext *C, wmOperator *op)
#define BKE_READ_EXOTIC_FAIL_FORMAT
void wm_test_autorun_revert_action_set(wmOperatorType *ot, PointerRNA *ptr)
#define BKE_READ_EXOTIC_FAIL_OPEN
static uiBlock * block_create_autorun_warning(bContext *C, ARegion *region, void *)
bool wm_file_or_session_data_has_unsaved_changes(const Main *bmain, const wmWindowManager *wm)
static ImBuf * blend_file_thumb_from_screenshot(bContext *C, BlendThumbnail **r_thumb)
void WM_OT_save_as_mainfile(wmOperatorType *ot)
void WM_OT_open_mainfile(wmOperatorType *ot)
static int wm_save_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *)
void WM_file_tag_modified()
static void wm_block_file_close_cancel_button(uiBlock *block, wmGenericCallback *post_action)
static RecentFile * wm_file_history_find(const char *filepath)
const char * WM_init_state_app_template_get()
void wm_file_read_report(Main *bmain, wmWindow *win)
void wm_autosave_timer_begin(wmWindowManager *wm)
static void rna_struct_update_when_changed(bContext *C, Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b)
static int wm_recover_last_session_invoke(bContext *C, wmOperator *op, const wmEvent *)
void WM_OT_recover_last_session(wmOperatorType *ot)
static void wm_file_read_pre(bool use_data, bool)
static blender::int2 blend_file_thumb_clamp_size(const int size[2], const int limit)
static int wm_revert_mainfile_exec(bContext *C, wmOperator *op)
static void wm_block_autorun_warning_enable_scripts(bContext *C, uiBlock *block)
static void save_file_overwrite_saveas(bContext *C, void *arg_block, void *)
static void wm_history_files_free()
static int wm_read_factory_settings_invoke(bContext *C, wmOperator *op, const wmEvent *)
static bool wm_file_read_opwrap(bContext *C, const char *filepath, ReportList *reports)
static RecentFile * wm_history_file_new(const char *filepath)
static bool wm_revert_mainfile_poll(bContext *)
static void wm_read_callback_pre_wrapper(bContext *C, const char *filepath)
void wm_history_file_read()
void wm_autosave_delete()
static bool wm_open_mainfile_check(bContext *, wmOperator *op)
static ImBuf * blend_file_thumb_from_camera(const bContext *C, Scene *scene, bScreen *screen, BlendThumbnail **r_thumb)
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)
void WM_OT_read_userpref(wmOperatorType *ot)
static void wm_test_autorun_revert_action_exec(bContext *C)
static void wm_recover_last_session_after_dialog_callback(bContext *C, void *user_data)
static char save_images_when_file_is_closed
static void save_file_overwrite_cancel_button(uiBlock *block, wmGenericCallback *post_action)
static void wm_block_file_close_save_button(uiBlock *block, wmGenericCallback *post_action, const bool needs_overwrite_confirm)
void WM_OT_save_homefile(wmOperatorType *ot)
void WM_OT_read_factory_userpref(wmOperatorType *ot)
static void wm_file_read_setup_wm_finalize(bContext *C, Main *bmain, BlendFileReadWMSetupData *wm_setup_data)
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)
void WM_OT_save_mainfile(wmOperatorType *ot)
void WM_OT_recover_auto_save(wmOperatorType *ot)
void wm_homefile_read_ex(bContext *C, const wmHomeFileRead_Params *params_homefile, ReportList *reports, wmFileReadPost_Params **r_params_file_read_post)
static std::string wm_save_as_mainfile_get_description(bContext *, wmOperatorType *, PointerRNA *ptr)
static void wm_file_read_setup_wm_keep_old(const bContext *C, Main *bmain, BlendFileReadWMSetupData *wm_setup_data, wmWindowManager *wm, const bool load_ui)
static struct @1378 wm_init_state_app_template
static void wm_block_file_close_discard(bContext *C, void *arg_block, void *arg_data)
static int wm_save_as_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *)
void wm_autosave_timer(Main *bmain, wmWindowManager *wm, wmTimer *)
static void wm_history_file_write()
static void set_next_operator_state(wmOperator *op, int state)
void WM_file_autoexec_init(const char *filepath)
static int wm_open_mainfile_dispatch(bContext *C, wmOperator *op)
static int wm_revert_mainfile_invoke(bContext *C, wmOperator *op, const wmEvent *)
void wm_homefile_read_post(bContext *C, const wmFileReadPost_Params *params_file_read_post)
static int wm_userpref_read_invoke(bContext *C, wmOperator *op, const wmEvent *)
static void wm_file_read_post(bContext *C, const char *filepath, const wmFileReadPost_Params *params)
static void wm_userpref_update_when_changed(bContext *C, Main *bmain, UserDef *userdef_prev, UserDef *userdef_curr)
static int wm_recover_auto_save_invoke(bContext *C, wmOperator *op, const wmEvent *)
static const char * close_file_dialog_name
static void wm_autosave_location(char filepath[FILE_MAX])
static std::string wm_open_mainfile_get_description(bContext *, wmOperatorType *, PointerRNA *ptr)
static void save_catalogs_when_file_is_closed_set_fn(bContext *, void *arg1, void *)
static void wm_filepath_default(const Main *bmain, char *filepath)
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 bool wm_autosave_write_try(Main *bmain, wmWindowManager *wm)
static int wm_read_exotic(const char *filepath)
static void wm_block_autorun_warning_reload_with_scripts(bContext *C, uiBlock *block)
static void file_overwrite_detailed_info_show(uiLayout *parent_layout, Main *bmain)
void wm_test_autorun_warning(bContext *C)
static void wm_block_file_close_cancel(bContext *C, void *arg_block, void *)
static void wm_file_read_setup_wm_substitute_old_window(wmWindowManager *oldwm, wmWindowManager *wm, wmWindow *oldwin, wmWindow *win)
void wm_open_init_load_ui(wmOperator *op, bool use_prefs)
static void read_factory_reset_props(wmOperatorType *ot)
static void wm_read_callback_post_wrapper(bContext *C, const char *filepath, const bool success)
static void wm_clear_recent_files_ui(bContext *, wmOperator *op)
static void wm_block_autorun_warning_ignore(bContext *C, void *arg_block, void *)
static void wm_history_file_free(RecentFile *recent)
static void wm_autosave_timer_begin_ex(wmWindowManager *wm, double timestep)
static const EnumPropertyItem prop_clear_recent_types[]
static void save_file_overwrite_confirm_button(uiBlock *block, wmGenericCallback *post_action)
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 file_read_reports_finalize(BlendFileReadReport *bf_reports)
static void wm_free_operator_properties_callback(void *user_data)
static int wm_clear_recent_files_invoke(bContext *C, wmOperator *op, const wmEvent *event)
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)
static uiBlock * block_create_save_file_overwrite_dialog(bContext *C, ARegion *region, void *arg1)
static void wm_file_read_setup_wm_use_new(bContext *C, Main *, BlendFileReadWMSetupData *wm_setup_data, wmWindowManager *wm)
void WM_OT_read_homefile(wmOperatorType *ot)
static std::string wm_save_as_mainfile_get_name(wmOperatorType *ot, PointerRNA *ptr)
static int wm_open_mainfile_exec(bContext *C, wmOperator *op)
static uint8_t * blend_file_thumb_fast_downscale(const uint8_t *src_rect, const int src_size[2], const int dst_size[2])
static void wm_block_file_close_discard_button(uiBlock *block, wmGenericCallback *post_action)
static void wm_open_mainfile_ui(bContext *, wmOperator *op)
static void wm_history_file_update()
static int wm_homefile_write_invoke(bContext *C, wmOperator *op, const wmEvent *)
static int wm_homefile_write_exec(bContext *C, wmOperator *op)
static void wm_gpu_backend_override_from_userdef()
void WM_OT_save_userpref(wmOperatorType *ot)
static void save_file_overwrite_confirm(bContext *C, void *arg_block, void *arg_data)
void WM_OT_clear_recent_files(wmOperatorType *ot)
static void read_homefile_props(wmOperatorType *ot)
void wm_save_file_overwrite_dialog(bContext *C, wmOperator *op)
static const char * save_file_overwrite_dialog_name
static void save_file_overwrite_cancel(bContext *C, void *arg_block, void *)
static int wm_open_mainfile__select_file_path(bContext *C, wmOperator *op)
static void save_file_overwrite_saveas_button(uiBlock *block, wmGenericCallback *post_action)
void WM_OT_revert_mainfile(wmOperatorType *ot)
void wm_close_file_dialog(bContext *C, wmGenericCallback *post_action)
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)
void WM_msgbus_destroy(wmMsgBus *mbus)
@ WM_MSG_STATICTYPE_FILE_READ
void WM_msg_publish_static(wmMsgBus *mbus, int event)
void WM_operator_properties_filesel(wmOperatorType *ot, const int filter, const short type, const eFileSel_Action action, const eFileSel_Flag flag, const short display, const short sort)
wmOperatorType * WM_operatortype_find(const char *idname, bool quiet)
void WM_operatortype_last_properties_clear_all()
int WM_operator_confirm(bContext *C, wmOperator *op, const wmEvent *)
int WM_operator_confirm_ex(bContext *C, wmOperator *op, const char *title, const char *message, const char *confirm_text, int icon, bool cancel_default)
int WM_operator_props_popup_confirm_ex(bContext *C, wmOperator *op, const wmEvent *, std::optional< std::string > title, std::optional< std::string > confirm_text, const bool cancel_default)
void WM_operator_properties_alloc(PointerRNA **ptr, IDProperty **properties, const char *opstring)
void WM_operator_properties_create_ptr(PointerRNA *ptr, wmOperatorType *ot)
void WM_operator_properties_free(PointerRNA *ptr)
void WM_generic_callback_free(wmGenericCallback *callback)
wmGenericCallback * WM_generic_callback_steal(wmGenericCallback *callback)
void WM_init_input_devices()
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)
void wm_window_make_drawable(wmWindowManager *wm, wmWindow *win)
bool WM_window_is_temp_screen(const wmWindow *win)
void WM_window_set_active_layout(wmWindow *win, WorkSpace *workspace, WorkSpaceLayout *layout)
void WM_event_timer_remove(wmWindowManager *wm, wmWindow *, wmTimer *timer)
wmTimer * WM_event_timer_add(wmWindowManager *wm, wmWindow *win, const int event_type, const double time_step)
bScreen * WM_window_get_active_screen(const wmWindow *win)