86 const char *ext_test[4] = {
".blend",
".ble",
".blend.gz",
nullptr};
98 char *slash =
nullptr, *prev_slash =
nullptr, c =
'\0';
136 if (slash[1] !=
'\0') {
139 *r_group = slash + 1;
143 if (prev_slash && (prev_slash[1] !=
'\0')) {
146 *r_name = prev_slash + 1;
173 size_t path_dst_maxncpy,
174 const char *path_src)
178 return !
STREQ(path_dst, path_src);
185 foreach_path_data.
bmain = bmain;
200 if (win->scene == scene) {
274 if (reuse_data->
remapper ==
nullptr) {
275 reuse_data->
remapper = MEM_new<id::IDRemapper>(__func__);
285 if (
STREQ(old_lib_iter->runtime->filepath_abs,
new_bmain->filepath)) {
286 remapper.
add(&old_lib_iter->id,
nullptr);
295 if (!
STREQ(old_lib_iter->runtime->filepath_abs, new_lib_iter->runtime->filepath_abs)) {
299 remapper.
add(&old_lib_iter->id, &new_lib_iter->id);
317 "There should never be a non-mappable (i.e. null) input here.");
325 const bool reuse_existing)
330 remapper.
add(
id,
id);
339 if (reuse_existing) {
347 if (!
STREQ(id_iter->name + 2,
id->name + 2)) {
351 remapper.
add(
id, id_iter);
373 const bool handle_name_map_updates = !
ID_IS_LINKED(
id) ||
id->lib !=
lib;
374 if (handle_name_map_updates) {
380 if (handle_name_map_updates) {
390 remapper.
add(
id,
id);
456 if (
id->lib ==
nullptr) {
458 remapper.
add(
id,
nullptr);
465 remapper.
add(
id,
nullptr);
475 if (old_id_new_lib ==
nullptr) {
476 remapper.
add(
id,
nullptr);
530 if (old_id_new_lib ==
nullptr) {
531 remapper.
add(old_id_iter,
nullptr);
560 if (
brush->gpencil_settings &&
brush->gpencil_settings->material &&
566 brush->gpencil_settings->material =
nullptr;
583static void swap_old_bmain_data_for_blendfile(
ReuseOldBMainData *reuse_data,
const short id_code)
616 if (strcmp_result == 0) {
623 else if (strcmp_result < 0) {
670 if (old_wm ==
nullptr) {
678 if (load_ui && new_wm !=
nullptr) {
693 std::swap<wmWindowManager *>(old_wm, new_wm);
701 remapper.
add(&old_wm->
id, &new_wm->
id);
706 swap_old_bmain_data_for_blendfile(reuse_data,
ID_WM);
733 remapper.
add(
id, id_new);
862 if (base !=
nullptr) {
873 ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : &sl->regionbase;
891 if (curwm ==
nullptr) {
896 if (win->scene ==
nullptr) {
897 win->scene = cur_scene;
900 STRNCPY(win->view_layer_name, cur_view_layer->
name);
940 "This file is managed by the asset system, you cannot overwrite it (using \"Save "
941 "As\" is possible)");
964 if (mode != LOAD_UNDO) {
970 if (mode != LOAD_UNDO) {
983 if (mode != LOAD_UNDO) {
988 if (mode != LOAD_UI) {
990 for (
auto id_code : ui_id_codes) {
991 swap_old_bmain_data_for_blendfile(&reuse_data, id_code);
1001 if (mode != LOAD_UI) {
1002 for (
auto id_code : ui_id_codes) {
1014 for (
short idtype_index = 0; idtype_index <
INDEX_ID_MAX; idtype_index++) {
1022 if (mode != LOAD_UI) {
1039 bool track_undo_scene =
false;
1049 if (curscene ==
nullptr) {
1053 if (curscene ==
nullptr) {
1056 if (cur_view_layer ==
nullptr) {
1063 if (mode != LOAD_UI) {
1068 track_undo_scene = (mode == LOAD_UNDO && curscreen && curscene && bfd->
main->
wm.
first);
1070 if (track_undo_scene) {
1077 win->
scene = curscene;
1085 if (reuse_data.
remapper !=
nullptr) {
1107 if (mode == LOAD_UNDO) {
1122 if (mode != LOAD_UI) {
1124 curscene = win->
scene;
1127 if (track_undo_scene) {
1132 win->
scene = curscene;
1152 bfd->
main =
nullptr;
1158 if (mode == LOAD_UI) {
1172 G.fileflags = (
G.fileflags & fileflags_keep) | (bfd->
fileflags & ~fileflags_keep);
1190 if (mode != LOAD_UNDO) {
1201 if (
params->is_startup) {
1216 if (mode == LOAD_UI) {
1230 if (mode != LOAD_UNDO) {
1236 if (mode != LOAD_UNDO) {
1258 reports->duration.lib_overrides_resync;
1266 if (mode != LOAD_UNDO) {
1268 int missing_linked_ids_num = 0;
1271 missing_linked_ids_num++;
1274 RPT_(
"LIB: %s: '%s' missing from '%s', parent '%s'"),
1279 id_iter->
lib->
runtime->parent->runtime->filepath_abs :
1284 reports->count.missing_linked_id = missing_linked_ids_num;
1309 "File written by newer Blender binary (%d.%d), expect loss of data!",
1311 main->subversionfile);
1321 const bool startup_update_defaults,
1322 const char *startup_app_template)
1326 "File could not be read, critical data corruption detected");
1331 if (startup_update_defaults) {
1353 if (
params->is_startup ==
false) {
1355 printf(
"Read blend: \"%s\"\n", filepath);
1404 if (bfd ==
nullptr) {
1468 userdef = bfd->
user;
1488 userdef = bfd->
user;
1503 *userdef = blender::dna::shallow_copy(
U_default);
1507 const char *addons[] = {
1510 "io_mesh_uv_layout",
1532#ifdef WITH_PYTHON_SECURITY
1573 userdef,
"VIEW3D_AST_brush_sculpt",
"Brushes/Mesh Sculpt/General");
1575 userdef,
"VIEW3D_AST_brush_sculpt",
"Brushes/Mesh Sculpt/Paint");
1577 userdef,
"VIEW3D_AST_brush_sculpt",
"Brushes/Mesh Sculpt/Simulation");
1580 userdef,
"VIEW3D_AST_brush_gpencil_paint",
"Brushes/Grease Pencil Draw/Draw");
1582 userdef,
"VIEW3D_AST_brush_gpencil_paint",
"Brushes/Grease Pencil Draw/Erase");
1584 userdef,
"VIEW3D_AST_brush_gpencil_paint",
"Brushes/Grease Pencil Draw/Utilities");
1587 userdef,
"VIEW3D_AST_brush_gpencil_sculpt",
"Brushes/Grease Pencil Sculpt/Contrast");
1589 userdef,
"VIEW3D_AST_brush_gpencil_sculpt",
"Brushes/Grease Pencil Sculpt/Transform");
1591 userdef,
"VIEW3D_AST_brush_gpencil_sculpt",
"Brushes/Grease Pencil Sculpt/Utilities");
1603 params.use_userdef =
true;
1623 if (userdef_default ==
nullptr) {
1646 printf(
"Writing userprefs: \"%s\" ", filepath);
1648 if (use_template_userpref) {
1673 if (use_template_userpref) {
1680 printf(
"Writing userprefs app-template: \"%s\" ", filepath);
1701 U.runtime.is_dirty =
false;
1713 const void *file_buf,
1731 workspace_config->
main = bfd->
main;
1742 return workspace_config;
1762 : reference_root_filepath_(reference_root_filepath)
1765 if (!reference_root_filepath_.empty()) {
1766 STRNCPY(this->
bmain.filepath, reference_root_filepath_.c_str());
1783void PartialWriteContext::preempt_session_uid(
ID *ctx_id,
uint session_uid)
1788 if (matching_ctx_id == ctx_id) {
1793 if (matching_ctx_id !=
nullptr) {
1798 "Different matching IDs sharing the same session UID in the partial write context.");
1808 if (matching_ctx_id) {
1811 "Non-matching IDs sharing the same session UID in the partial write context.");
1823void PartialWriteContext::process_added_id(
ID *ctx_id,
1826 const bool set_fake_user = (operations &
SET_FAKE_USER) != 0;
1829 if (set_fake_user) {
1838 if (set_clipboard_mark) {
1843ID *PartialWriteContext::id_add_copy(
const ID *
id,
const bool regenerate_session_uid)
1845 ID *ctx_root_id =
nullptr;
1856 this->ensure_library(ctx_root_id);
1857 if (regenerate_session_uid) {
1863 this->preempt_session_uid(ctx_root_id, id->
session_uid);
1872void PartialWriteContext::make_local(
ID *ctx_id,
const int make_local_flags)
1892 this->preempt_session_uid(ctx_id, ctx_id_session_uid);
1897Library *PartialWriteContext::ensure_library(
ID *ctx_id)
1902 blender::StringRefNull lib_path = ctx_id->
lib->
runtime->filepath_abs;
1903 Library *ctx_lib = this->libraries_map_.lookup_default(lib_path,
nullptr);
1905 ctx_lib =
reinterpret_cast<Library *
>(id_add_copy(&ctx_id->
lib->
id,
true));
1906 this->libraries_map_.add(lib_path, ctx_lib);
1908 ctx_id->
lib = ctx_lib;
1911Library *PartialWriteContext::ensure_library(blender::StringRefNull library_absolute_path)
1913 Library *ctx_lib = this->libraries_map_.lookup_default(library_absolute_path,
nullptr);
1916 ctx_lib =
static_cast<Library *
>(
1920 this->libraries_map_.add(library_absolute_path, ctx_lib);
1930 dependencies_filter_cb)
1938 BLI_assert(clear_dependencies || add_dependencies || dependencies_filter_cb);
1939 BLI_assert(!clear_dependencies || !(add_dependencies || duplicate_dependencies));
1953 this->process_added_id(ctx_root_id,
options.operations);
1967 ctx_root_id = id_add_copy(
id,
false);
1969 local_ctx_id_map.
add(
id, ctx_root_id);
1970 post_process_ids_todo.
append({ctx_root_id,
options.operations});
1971 this->process_added_id(ctx_root_id,
options.operations);
1974 auto dependencies_cb = [
this,
1978 &post_process_ids_todo,
1981 const ID *orig_deps_id = *id_ptr;
1986 if (!orig_deps_id) {
1997 if (dependencies_filter_cb) {
2007 BLI_assert(clear_dependencies || add_dependencies);
2008 BLI_assert(!clear_dependencies || !(add_dependencies || duplicate_dependencies));
2011 if (clear_dependencies) {
2014 "Clearing a 'never null' ID usage of '%s' by '%s', this is likely not a "
2026 ID *ctx_deps_id =
nullptr;
2027 if (duplicate_dependencies) {
2028 ctx_deps_id = local_ctx_id_map.
lookup(orig_deps_id);
2042 "First dependency to ID '%s' found through a 'loopback' usage from ID '%s', "
2043 "this should never happen",
2049 ctx_deps_id = this->id_add_copy(orig_deps_id, duplicate_dependencies);
2050 local_ctx_id_map.
add(orig_deps_id, ctx_deps_id);
2051 ids_to_process.
add(ctx_deps_id);
2052 post_process_ids_todo.
append({ctx_deps_id, operations_final});
2054 if (duplicate_dependencies) {
2060 this->process_added_id(ctx_deps_id, operations_final);
2062 *id_ptr = ctx_deps_id;
2065 while (!ids_to_process.
is_empty()) {
2066 ID *ctx_id = ids_to_process.
pop();
2074 for (
auto [ctx_id, options_final] : post_process_ids_todo) {
2075 const bool do_make_local = (options_final &
MAKE_LOCAL) != 0;
2076 if (do_make_local) {
2077 this->make_local(ctx_id, make_local_flags);
2089 Library *ctx_library =
nullptr;
2091 ctx_library = this->ensure_library(
library->runtime->filepath_abs);
2093 ID *ctx_id =
static_cast<ID *
>(
2097 this->process_added_id(ctx_id,
options.operations);
2118 if (clear_extra_user) {
2129 "Removing %d unused IDs from current partial write context",
2157 ids_in_context.
add(id_iter);
2169 auto id_validate_dependencies_cb = [&ids_in_context,
2171 ID **id_p = cb_data->id_pointer;
2172 ID *owner_id = cb_data->owner_id;
2173 ID *self_id = cb_data->self_id;
2181 if (*id_p && !ids_in_context.
contains(*id_p)) {
2182 if (owner_id != self_id) {
2185 "ID %s (used by ID '%s', embedded ID '%s') is not in current partial write context",
2192 "ID %s (used by ID '%s') is not in current partial write context",
2210 const int write_flags,
2211 const int remap_mode,
2215 "A library blendfile should not overwrite currently edited blendfile");
2221 if (
STREQ(write_filepath,
library->runtime->filepath_abs)) {
2227 if (make_local_libs.
size() > 1) {
2229 "%d libraries found using the same filepath as destination one ('%s'), should "
2238 make_local_libs.
clear();
2245 &this->
bmain, write_filepath, write_flags, &blend_file_write_params, &
reports);
struct bAddon * BKE_addon_new(void)
#define BLENDER_USERPREF_FILE
bool BKE_appdir_app_template_has_userpref(const char *app_template) ATTR_NONNULL(1)
bool BKE_appdir_font_folder_default(char *dir, size_t dir_maxncpy)
std::optional< std::string > BKE_appdir_folder_id_create(int folder_id, const char *subfolder) ATTR_WARN_UNUSED_RESULT
void BKE_blender_globals_main_replace(Main *bmain)
void BKE_blender_userdef_data_set_and_free(UserDef *userdef)
void BKE_blender_userdef_app_template_data_swap(UserDef *userdef_a, UserDef *userdef_b)
void BKE_blender_userdef_data_free(UserDef *userdef, bool clear_fonts)
#define BLENDER_FILE_SUBVERSION
#define BLENDER_FILE_VERSION
@ BKE_BPATH_FOREACH_PATH_SKIP_MULTIFILE
void BKE_bpath_foreach_path_main(BPathForeachPathData *bpath_data)
void BKE_colorband_init(ColorBand *coba, bool rangetype)
void CTX_data_main_set(bContext *C, Main *bmain)
bScreen * CTX_wm_screen(const bContext *C)
bool CTX_py_init_get(bContext *C)
void CTX_wm_manager_set(bContext *C, wmWindowManager *wm)
wmWindow * CTX_wm_window(const bContext *C)
void CTX_wm_screen_set(bContext *C, bScreen *screen)
void CTX_data_scene_set(bContext *C, Scene *scene)
Main * CTX_data_main(const bContext *C)
void CTX_wm_area_set(bContext *C, ScrArea *area)
void CTX_wm_region_set(bContext *C, ARegion *region)
wmWindowManager * CTX_wm_manager(const bContext *C)
void CTX_wm_region_popup_set(bContext *C, ARegion *region_popup)
#define G_FLAG_ALL_READFILE
#define G_FILE_FLAG_ALL_RUNTIME
#define G_FLAG_ALL_RUNTIME
const IDTypeInfo * BKE_idtype_get_info_from_idtype_index(const int idtype_index)
const char * BKE_idtype_idcode_to_name(short idcode)
ViewLayer * BKE_view_layer_default_view(const Scene *scene)
ViewLayer * BKE_view_layer_find(const Scene *scene, const char *layer_name)
void BKE_id_delete(Main *bmain, void *idv) ATTR_NONNULL()
IDNewNameResult BKE_id_new_name_validate(Main &bmain, ListBase &lb, ID &id, const char *newname, IDNewNameMode mode, bool do_linked_data)
struct ID * BKE_id_copy_in_lib(Main *bmain, std::optional< Library * > owner_library, const ID *id, std::optional< const ID * > new_owner_id, ID **new_id_p, int flag)
void size_t BKE_id_multi_tagged_delete(Main *bmain) ATTR_NONNULL()
void id_sort_by_name(ListBase *lb, ID *id, ID *id_sorting_hint)
@ LIB_ID_COPY_ASSET_METADATA
@ LIB_ID_CREATE_NO_USER_REFCOUNT
void * BKE_id_new_in_lib(Main *bmain, std::optional< Library * > owner_library, short type, const char *name)
void BKE_library_make_local(Main *bmain, const Library *lib, GHash *old_to_new_ids, bool untagged_only, bool set_fake, bool clear_asset_data)
void id_fake_user_set(ID *id)
@ LIB_ID_MAKELOCAL_INDIRECT
@ LIB_ID_MAKELOCAL_FORCE_LOCAL
@ LIB_ID_MAKELOCAL_LIBOVERRIDE_CLEAR
ID * BKE_id_owner_get(ID *id, const bool debug_relationship_assert=true)
bool BKE_lib_id_make_local(Main *bmain, ID *id, int flags)
void id_us_ensure_real(ID *id)
void id_us_clear_real(ID *id)
void BKE_lib_id_swap_full(Main *bmain, ID *id_a, ID *id_b, const bool do_self_remap, const int self_remap_flags)
void BKE_libblock_management_main_add(Main *bmain, void *idv)
void BKE_main_id_refcount_recompute(Main *bmain, bool do_linked_only)
void BKE_lib_libblock_session_uid_renew(ID *id)
void BKE_lib_override_library_free(IDOverrideLibrary **liboverride, bool do_id_user)
void BKE_lib_override_library_main_resync(Main *bmain, const blender::Map< Library *, Library * > *new_to_old_libraries_map, Scene *scene, ViewLayer *view_layer, BlendFileReadReport *reports)
void BKE_lib_override_library_make_local(Main *bmain, ID *id)
void BKE_lib_override_library_main_operations_create(Main *bmain, bool force_auto, int *r_report_flags)
@ IDWALK_CB_EMBEDDED_NOT_OWNING
void BKE_library_foreach_ID_link(Main *bmain, ID *id, blender::FunctionRef< LibraryIDLinkCallback > callback, void *user_data, LibraryForeachIDFlag flag)
@ IDWALK_RET_STOP_RECURSION
@ IDWALK_DO_LIBRARY_POINTER
@ IDWALK_DO_INTERNAL_RUNTIME_POINTERS
void BKE_libblock_remap_multiple_raw(Main *bmain, blender::bke::id::IDRemapper &mappings, const int remap_flags)
@ ID_REMAP_RESULT_SOURCE_REMAPPED
@ ID_REMAP_RESULT_SOURCE_UNASSIGNED
@ ID_REMAP_RESULT_SOURCE_NOT_MAPPABLE
@ ID_REMAP_RESULT_SOURCE_UNAVAILABLE
@ ID_REMAP_SKIP_USER_CLEAR
@ ID_REMAP_SKIP_USER_REFCOUNT
@ ID_REMAP_SKIP_NEVER_NULL_USAGE
@ ID_REMAP_FORCE_UI_POINTERS
@ ID_REMAP_SKIP_UPDATE_TAGGING
@ LIBRARY_ASSET_FILE_WRITABLE
#define FOREACH_MAIN_ID_END
ListBase * which_libbase(Main *bmain, short type)
void BKE_main_clear(Main &bmain)
#define FOREACH_MAIN_LISTBASE_ID_END
#define FOREACH_MAIN_LISTBASE_ID_BEGIN(_lb, _id)
#define FOREACH_MAIN_LISTBASE_END
void BKE_main_destroy(Main &bmain)
void BKE_main_init(Main &bmain)
#define FOREACH_MAIN_LISTBASE_BEGIN(_bmain, _lb)
void BKE_main_free(Main *bmain)
#define FOREACH_MAIN_ID_BEGIN(_bmain, _id)
const char * BKE_main_blendfile_path(const Main *bmain) ATTR_NONNULL()
ID ID ID * BKE_main_idmap_lookup_uid(IDNameLib_Map *id_map, uint session_uid) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
IDNameLib_Map * BKE_main_idmap_create(Main *bmain, bool create_valid_ids_set, Main *old_bmain, int idmap_types) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BKE_main_idmap_remove_id(IDNameLib_Map *id_map, const ID *id) ATTR_NONNULL()
void BKE_main_idmap_destroy(IDNameLib_Map *id_map) ATTR_NONNULL()
void BKE_main_idmap_insert_id(IDNameLib_Map *id_map, ID *id) ATTR_NONNULL()
void BKE_main_idmap_clear(IDNameLib_Map &id_map)
ID ID * BKE_main_idmap_lookup_id(IDNameLib_Map *id_map, const ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
void BKE_main_namemap_remove_id(Main &bmain, ID &id)
void BKE_main_namemap_destroy(UniqueName_Map **r_name_map) ATTR_NONNULL()
void BKE_main_namemap_clear(Main &bmain)
bool BKE_main_namemap_validate(Main &bmain)
void BKE_preferences_asset_library_default_add(struct UserDef *userdef) ATTR_NONNULL()
void BKE_preferences_extension_repo_add_defaults_all(UserDef *userdef)
bool BKE_preferences_asset_shelf_settings_ensure_catalog_path_enabled(UserDef *userdef, const char *shelf_idname, const char *catalog_path)
void BKE_reportf(ReportList *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
void BKE_reports_prependf(ReportList *reports, const char *prepend_format,...) ATTR_PRINTF_FORMAT(2
void BKE_report(ReportList *reports, eReportType type, const char *message)
void void BKE_reports_prepend(ReportList *reports, const char *prepend)
Scene * BKE_scene_add(Main *bmain, const char *name)
void BKE_scene_set_background(Main *bmain, Scene *sce)
ScrArea ScrArea void BKE_screen_gizmo_tag_refresh(bScreen *screen)
void BKE_screen_view3d_scene_sync(bScreen *screen, Scene *scene)
void BKE_screen_runtime_refresh_for_blendfile(bScreen *screen)
void BKE_studiolight_default(SolidLight lights[4], float light_ambient[3])
bScreen * BKE_workspace_active_screen_get(const WorkSpaceInstanceHook *hook) GETTER_ATTRS
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
File and directory operations.
int BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BLI_is_file(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BLI_is_dir(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
#define LISTBASE_FOREACH_BACKWARD(type, var, list)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count_at_most(const ListBase *listbase, int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void BLI_addhead(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
bool BLI_remlink_safe(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE int min_ii(int a, int b)
void void void const char * BLI_path_basename(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
bool BLI_path_extension_check_array(const char *path, const char **ext_array) ATTR_NONNULL(1
void BLI_path_slash_native(char *path) ATTR_NONNULL(1)
#define BLI_path_join(...)
int BLI_path_slash_ensure(char *path, size_t path_maxncpy) ATTR_NONNULL(1)
const char * BLI_path_slash_rfind(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
char * STRNCPY(char(&dst)[N], const char *src)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
int BLI_system_memory_max_in_megabytes_int(void)
Platform independent time functions.
double BLI_time_now_seconds(void)
#define UNUSED_VARS_NDEBUG(...)
void BLO_reportf_wrap(BlendFileReadReport *reports, eReportType type, const char *format,...) ATTR_PRINTF_FORMAT(3
external readfile function prototypes.
#define BLO_EMBEDDED_STARTUP_BLEND
BlendHandle * BLO_blendhandle_from_file(const char *filepath, BlendFileReadReport *reports)
void BLO_blendhandle_close(BlendHandle *bh) ATTR_NONNULL(1)
BlendFileData * BLO_read_from_memfile(Main *oldmain, const char *filepath, MemFile *memfile, const BlendFileReadParams *params, ReportList *reports)
BlendFileData * BLO_read_from_memory(const void *mem, int memsize, eBLOReadSkip skip_flags, ReportList *reports)
#define BLO_READ_SKIP_ALL
void BLO_readfile_id_runtime_data_free_all(Main &bmain)
void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
BlendFileData * BLO_read_from_file(const char *filepath, eBLOReadSkip skip_flags, BlendFileReadReport *reports)
void BLO_read_do_version_after_setup(Main *new_bmain, BlendfileLinkAppendContext *lapp_context, BlendFileReadReport *reports)
void BLO_blendfiledata_free(BlendFileData *bfd)
const bTheme U_theme_default
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_RELATIVE
void BPY_context_update(bContext *C)
#define CLOG_ERROR(clg_ref,...)
#define CLOG_WARN(clg_ref,...)
#define CLOG_INFO(clg_ref, level,...)
#define CLOG_FATAL(clg_ref,...)
@ GP_BRUSH_MATERIAL_PINNED
#define FILE_MAX_LIBEXTRA
@ USER_SCRIPT_AUTOEXEC_DISABLE
void IMB_colormanagement_check_file_config(Main *bmain)
Read Guarded memory(de)allocation.
void BKE_blendfile_read_setup_undo(bContext *C, BlendFileData *bfd, const BlendFileReadParams *params, BlendFileReadReport *reports)
static void view3d_data_consistency_ensure(wmWindow *win, Scene *scene, ViewLayer *view_layer)
void BKE_blendfile_read_setup_readfile(bContext *C, BlendFileData *bfd, const BlendFileReadParams *params, BlendFileReadWMSetupData *wm_setup_data, BlendFileReadReport *reports, const bool startup_update_defaults, const char *startup_app_template)
bool BKE_blendfile_userdef_write_all(ReportList *reports)
static void wm_data_consistency_ensure(wmWindowManager *curwm, Scene *cur_scene, ViewLayer *cur_view_layer)
BKE_main_namemap_clear * new_bmain
static int swap_old_bmain_data_for_blendfile_dependencies_process_cb(LibraryIDLinkCallbackData *cb_data)
static void handle_subversion_warning(Main *main, BlendFileReadReport *reports)
WorkspaceConfigFileData * BKE_blendfile_workspace_config_read(const char *filepath, const void *file_buf, int file_buf_size, ReportList *reports)
bool BKE_blendfile_userdef_write(const char *filepath, ReportList *reports)
static void setup_app_data(bContext *C, BlendFileData *bfd, const BlendFileReadParams *params, BlendFileReadWMSetupData *wm_setup_data, BlendFileReadReport *reports)
static bool reuse_bmain_data_remapper_is_id_remapped(id::IDRemapper &remapper, ID *id)
static void reuse_bmain_data_invalid_local_usages_fix(ReuseOldBMainData *reuse_data)
void BKE_blendfile_read_make_empty(bContext *C)
static void swap_wm_data_for_blendfile(ReuseOldBMainData *reuse_data, const bool load_ui)
BKE_main_namemap_clear * old_bmain
bool BKE_blendfile_library_path_explode(const char *path, char *r_dir, char **r_group, char **r_name)
bool BKE_blendfile_extension_check(const char *str)
static bool reuse_editable_asset_needed(ReuseOldBMainData *reuse_data)
static void swap_old_bmain_data_dependencies_process(ReuseOldBMainData *reuse_data, const short id_code)
void BKE_blendfile_workspace_config_data_free(WorkspaceConfigFileData *workspace_config)
UserDef * BKE_blendfile_userdef_from_defaults()
static Library * reuse_bmain_data_dependencies_new_library_get(ReuseOldBMainData *reuse_data, Library *old_lib)
static id::IDRemapper & reuse_bmain_data_remapper_ensure(ReuseOldBMainData *reuse_data)
UserDef * BKE_blendfile_userdef_read(const char *filepath, ReportList *reports)
static void clean_paths(Main *bmain)
BlendFileData * BKE_blendfile_read_from_memfile(Main *bmain, MemFile *memfile, const BlendFileReadParams *params, ReportList *reports)
static int reuse_bmain_data_invalid_local_usages_fix_cb(LibraryIDLinkCallbackData *cb_data)
static void reuse_editable_asset_bmain_data_for_blendfile(ReuseOldBMainData *reuse_data, const short idcode)
UserDef * BKE_blendfile_userdef_read_from_memory(const void *file_buf, int file_buf_size, 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)
static void setup_app_blend_file_data(bContext *C, BlendFileData *bfd, const BlendFileReadParams *params, BlendFileReadWMSetupData *wm_setup_data, BlendFileReadReport *reports)
static bool wm_scene_is_visible(wmWindowManager *wm, Scene *scene)
static bool foreach_path_clean_cb(BPathForeachPathData *, char *path_dst, size_t path_dst_maxncpy, const char *path_src)
static bool reuse_bmain_move_id(ReuseOldBMainData *reuse_data, ID *id, Library *lib, const bool reuse_existing)
bool BKE_blendfile_userdef_write_app_template(const char *filepath, ReportList *reports)
static CLG_LogRef LOG_PARTIALWRITE
bool BKE_blendfile_is_readable(const char *path, ReportList *reports)
static void setup_app_userdef(BlendFileData *bfd)
static void unpin_file_local_grease_pencil_brush_materials(const ReuseOldBMainData *reuse_data)
static int reuse_editable_asset_bmain_data_dependencies_process_cb(LibraryIDLinkCallbackData *cb_data)
bool add(const Key &key, const Value &value)
const Value & lookup(const Key &key) const
bool contains(const Key &key) const
constexpr const char * c_str() const
void append(const T &value)
void id_delete(const ID *id)
void remove_unused(bool clear_extra_user=false)
ID * id_add(const ID *id, IDAddOptions options, blender::FunctionRef< IDAddOperations(LibraryIDLinkCallbackData *cb_data, IDAddOptions options)> dependencies_filter_cb=nullptr)
bool write(const char *write_filepath, int write_flags, int remap_mode, ReportList &reports)
ID * id_create(short id_type, StringRefNull id_name, Library *library, IDAddOptions options)
PartialWriteContext()=delete
IDRemapperApplyResult get_mapping_result(ID *id, IDRemapperApplyOptions options, const ID *id_self) const
IDRemapperApplyResult apply(ID **r_id_ptr, IDRemapperApplyOptions options, ID *id_self=nullptr) const
void add(ID *old_id, ID *new_id)
void add_overwrite(ID *old_id, ID *new_id)
std::string id_name(void *id)
CCL_NAMESPACE_BEGIN struct Options options
#define ID_TYPE_SUPPORTS_ASSET_EDITABLE(id_type)
#define ID_IS_OVERRIDE_LIBRARY_REAL(_id)
#define ID_IS_LINKED(_id)
#define ID_IS_OVERRIDE_LIBRARY(_id)
void BKE_lib_query_unused_ids_tag(Main *bmain, const int tag, LibQueryUnusedIDsData ¶meters)
void * MEM_mallocN(size_t len, const char *str)
void * MEM_callocN(size_t len, const char *str)
void MEM_freeN(void *vmemh)
bool is_auto_resync_enabled()
void RE_FreeAllPersistentData()
void RE_FreeAllRenderResults()
void RE_FreeInteractiveCompositorRenders()
BPathForeachPathFunctionCallback callback_function
unsigned short local_view_bits
ViewLayer * cur_view_layer
eBLO_WritePathRemap remap_mode
IDOverrideLibrary * override_library
std::array< int, INDEX_ID_MAX > num_total
LibraryForeachIDCallbackFlag cb_flag
LibraryRuntimeHandle * runtime
struct RegionView3D * localvd
BlendFileReadWMSetupData * wm_setup_data
bool is_libraries_remapped
id::IDRemapper * remapper
struct SolidLight light_param[4]
struct ColorBand coba_weight
unsigned short local_view_uid
struct WorkSpaceInstanceHook * workspace_hook
static DynamicLibrary lib