|
Blender V5.0
|
#include <cstdlib>#include <cstring>#include <optional>#include "CLG_log.h"#include "MEM_guardedalloc.h"#include "DNA_brush_types.h"#include "DNA_scene_types.h"#include "DNA_screen_types.h"#include "DNA_space_types.h"#include "DNA_windowmanager_types.h"#include "BLI_fileops.h"#include "BLI_function_ref.hh"#include "BLI_listbase.h"#include "BLI_path_utils.hh"#include "BLI_string.h"#include "BLI_string_utf8.h"#include "BLI_system.h"#include "BLI_time.h"#include "BLI_utildefines.h"#include "BLI_vector.hh"#include "BLI_vector_set.hh"#include "BLT_translation.hh"#include "IMB_colormanagement.hh"#include "BKE_addon.h"#include "BKE_appdir.hh"#include "BKE_blender.hh"#include "BKE_blender_version.h"#include "BKE_blendfile.hh"#include "BKE_bpath.hh"#include "BKE_colorband.hh"#include "BKE_context.hh"#include "BKE_global.hh"#include "BKE_idtype.hh"#include "BKE_layer.hh"#include "BKE_lib_id.hh"#include "BKE_lib_override.hh"#include "BKE_lib_query.hh"#include "BKE_lib_remap.hh"#include "BKE_library.hh"#include "BKE_main.hh"#include "BKE_main_idmap.hh"#include "BKE_main_namemap.hh"#include "BKE_preferences.h"#include "BKE_report.hh"#include "BKE_scene.hh"#include "BKE_screen.hh"#include "BKE_studiolight.h"#include "BKE_undo_system.hh"#include "BKE_workspace.hh"#include "BLO_read_write.hh"#include "BLO_readfile.hh"#include "BLO_userdef_default.h"#include "BLO_writefile.hh"#include "RE_pipeline.h"Go to the source code of this file.
Classes | |
| struct | ReuseOldBMainData |
Namespaces | |
| namespace | blender |
| namespace | blender::bke |
| namespace | blender::bke::blendfile |
Functions | |
Blend/Library Paths | |
| bool | BKE_blendfile_extension_check (const char *str) |
| bool | BKE_blendfile_library_path_explode (const char *path, char *r_dir, char **r_group, char **r_name) |
| bool | BKE_blendfile_is_readable (const char *path, ReportList *reports) |
Blend File IO (Preferences) | |
Application TemplatesWhen using app-templates, both regular & app-template preferences are used. Note that "regular" preferences refers to the preferences used with no app-template is active.
| |
| UserDef * | BKE_blendfile_userdef_read (const char *filepath, ReportList *reports) |
| UserDef * | BKE_blendfile_userdef_read_from_memory (const void *file_buf, int file_buf_size, ReportList *reports) |
| UserDef * | BKE_blendfile_userdef_from_defaults () |
| bool | BKE_blendfile_userdef_write (const char *filepath, ReportList *reports) |
| bool | BKE_blendfile_userdef_write_app_template (const char *filepath, ReportList *reports) |
| bool | BKE_blendfile_userdef_write_all (ReportList *reports) |
Blend File IO (WorkSpace) | |
| WorkspaceConfigFileData * | BKE_blendfile_workspace_config_read (const char *filepath, const void *file_buf, int file_buf_size, ReportList *reports) |
| void | BKE_blendfile_workspace_config_data_free (WorkspaceConfigFileData *workspace_config) |
Variables | |
Blend File Write (Partial) | |
| static CLG_LogRef | LOG_PARTIALWRITE = {"blend.partial_write"} |
High level .blend file read/write, and functions for writing partial files (only selected data-blocks).
Definition in file blendfile.cc.
| bool BKE_blendfile_extension_check | ( | const char * | str | ) |
Check whether given path ends with a blend file compatible extension (.blend, .ble or .blend.gz).
| str | The path to check. |
Definition at line 86 of file blendfile.cc.
References BLI_path_extension_check_array(), and str.
Referenced by BKE_blendfile_library_path_explode(), ED_path_extension_type(), file_path_to_ui_path(), filelist_readjob_list_dir(), handle_load_file(), uiTemplateRecentFiles(), WM_lib_reload(), wm_lib_relocate_exec_do(), and wm_save_mainfile_check().
| bool BKE_blendfile_is_readable | ( | const char * | path, |
| ReportList * | reports ) |
Check whether a given path is actually a Blender-readable, valid .blend file.
Definition at line 155 of file blendfile.cc.
References BLO_blendhandle_close(), BLO_blendhandle_from_file(), and BlendFileReadReport::reports.
Referenced by file_draw_hint_if_invalid().
| bool BKE_blendfile_library_path_explode | ( | const char * | path, |
| char * | r_dir, | ||
| char ** | r_group, | ||
| char ** | r_name ) |
Try to explode given path into its 'library components' (i.e. a .blend file, id type/group, and data-block itself).
| path | the full path to explode. |
| r_dir | the string that'll contain path up to blend file itself ('library' path). WARNING! Must be at least FILE_MAX_LIBEXTRA long (it also stores group and name strings)! |
| r_group | a pointer within r_dir to the 'group' part of the path, if any ('\0' terminated). May be NULL. |
| r_name | a pointer within r_dir to the data-block name, if any ('\0' terminated). May be NULL. |
Definition at line 92 of file blendfile.cc.
References BKE_blendfile_extension_check(), BLI_assert, BLI_is_dir(), BLI_is_file(), BLI_path_slash_rfind(), BLI_strncpy(), BLO_EMBEDDED_STARTUP_BLEND, BLO_GROUP_MAX, FILE_MAX_LIBEXTRA, MAX_ID_NAME, and STREQ.
Referenced by file_directory_enter_handle(), fileentry_uiname(), filelist_checkdir_lib(), filelist_islibrary(), filelist_readjob_list_lib(), blender::asset_system::AssetRepresentation::full_library_path(), IMB_thumb_manage(), wm_id_linked_relocate_exec(), and wm_link_append_exec().
| BlendFileData * BKE_blendfile_read | ( | const char * | filepath, |
| const BlendFileReadParams * | params, | ||
| BlendFileReadReport * | reports ) |
Definition at line 1357 of file blendfile.cc.
References BKE_reports_prependf(), BLO_blendfiledata_free(), BLO_read_from_file(), CLOG_INFO_NOCHECK, handle_subversion_warning(), Main::is_read_invalid, LOG_BLEND, BlendFileData::main, params, and BlendFileReadReport::reports.
Referenced by BKE_memfile_undo_decode(), blender::ed::vse::sequencer_clipboard_paste_exec(), WM_file_read(), and wm_homefile_read_ex().
| BlendFileData * BKE_blendfile_read_from_memfile | ( | Main * | bmain, |
| MemFile * | memfile, | ||
| const BlendFileReadParams * | params, | ||
| ReportList * | reports ) |
Definition at line 1400 of file blendfile.cc.
References BKE_main_blendfile_path(), BKE_reports_prepend(), BLO_blendfiledata_free(), BLO_read_from_memfile(), Main::is_read_invalid, BlendFileData::main, and params.
Referenced by BKE_memfile_undo_decode().
| BlendFileData * BKE_blendfile_read_from_memory | ( | const void * | file_buf, |
| int | file_buf_size, | ||
| const BlendFileReadParams * | params, | ||
| ReportList * | reports ) |
Definition at line 1380 of file blendfile.cc.
References BKE_reports_prepend(), BLO_blendfiledata_free(), BLO_read_from_memory(), Main::is_read_invalid, BlendFileData::main, and params.
Referenced by wm_homefile_read_ex().
| void BKE_blendfile_read_make_empty | ( | bContext * | C | ) |
Utility to make a file 'empty' used for startup to optionally give an empty file. Handy for tests.
Definition at line 1417 of file blendfile.cc.
References BKE_id_delete(), C, CTX_data_main(), ELEM, FOREACH_MAIN_LISTBASE_BEGIN, FOREACH_MAIN_LISTBASE_END, FOREACH_MAIN_LISTBASE_ID_BEGIN, FOREACH_MAIN_LISTBASE_ID_END, GS, ID_SCE, ID_SCR, ID_WM, and ID_WS.
Referenced by wm_homefile_read_ex().
| 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 ) |
Shared setup function that makes the data from bfd into the current blend file, replacing the contents of #G.main. This uses the bfd returned by BKE_blendfile_read and similarly named functions.
This is done in a separate step so the caller may perform actions after it is known the file loaded correctly but before the file replaces the existing blend file contents.
Definition at line 1322 of file blendfile.cc.
References BKE_reports_prepend(), BLO_blendfiledata_free(), BLO_READ_SKIP_DATA, BLO_update_defaults_startup_blend(), C, Main::is_read_invalid, BlendFileData::main, params, BlendFileReadReport::reports, and setup_app_blend_file_data().
Referenced by BKE_blendfile_read_setup_undo(), WM_file_read(), and wm_homefile_read_ex().
| void BKE_blendfile_read_setup_undo | ( | bContext * | C, |
| BlendFileData * | bfd, | ||
| const BlendFileReadParams * | params, | ||
| BlendFileReadReport * | reports ) |
Simpler version of BKE_blendfile_read_setup_readfile used when reading undo steps from memfile.
Definition at line 1347 of file blendfile.cc.
References BKE_blendfile_read_setup_readfile(), C, and params.
Referenced by BKE_memfile_undo_decode().
| UserDef * BKE_blendfile_userdef_from_defaults | ( | ) |
Definition at line 1517 of file blendfile.cc.
References UserDef::addons, ARRAY_SIZE, BKE_addon_new(), BKE_appdir_font_folder_default(), BKE_colorband_init(), BKE_preferences_asset_library_default_add(), BKE_preferences_asset_shelf_settings_ensure_catalog_path_enabled(), BKE_preferences_extension_repo_add_defaults_all(), BKE_studiolight_default(), BLI_addtail(), BLI_path_slash_ensure(), BLI_system_memory_max_in_megabytes_int(), UserDef::coba_weight, UserDef::flag, UserDef::fontdir, i, UserDef::light_ambient, UserDef::light_param, MEM_callocN(), MEM_mallocN(), UserDef::memcachelimit, min_ii(), bAddon::module, STRNCPY_UTF8, UserDef::themes, U_default, U_theme_default, and USER_SCRIPT_AUTOEXEC_DISABLE.
Referenced by BKE_blendfile_userdef_write_app_template(), and wm_homefile_read_ex().
| UserDef * BKE_blendfile_userdef_read | ( | const char * | filepath, |
| ReportList * | reports ) |
Only read the UserDef from a .blend.
Definition at line 1463 of file blendfile.cc.
References BKE_main_free(), BLO_read_from_file(), BLO_READ_SKIP_ALL, BLO_READ_SKIP_USERDEF, UserDef::language, BlendFileData::main, BlendFileReadReport::reports, UserDef::transopts, ULANGUAGE_AUTO, BlendFileData::user, USER_TR_IFACE, USER_TR_NEWDATANAME, and USER_TR_TOOLTIPS.
Referenced by BKE_blendfile_userdef_write_app_template(), and wm_homefile_read_ex().
| UserDef * BKE_blendfile_userdef_read_from_memory | ( | const void * | file_buf, |
| int | file_buf_size, | ||
| ReportList * | reports ) |
Definition at line 1494 of file blendfile.cc.
References BKE_main_free(), BKE_reports_prepend(), BLO_read_from_memory(), BLO_READ_SKIP_ALL, BLO_READ_SKIP_USERDEF, BlendFileData::main, and BlendFileData::user.
| bool BKE_blendfile_userdef_write | ( | const char * | filepath, |
| ReportList * | reports ) |
Only write the UserDef in a .blend.
Definition at line 1629 of file blendfile.cc.
References BLO_write_file(), and params.
Referenced by BKE_blendfile_userdef_write_all(), and BKE_blendfile_userdef_write_app_template().
| bool BKE_blendfile_userdef_write_all | ( | ReportList * | reports | ) |
Definition at line 1667 of file blendfile.cc.
References BKE_appdir_app_template_has_userpref(), BKE_appdir_folder_id_create(), BKE_blendfile_userdef_write(), BKE_blendfile_userdef_write_app_template(), BKE_report(), BLENDER_USER_CONFIG, BLENDER_USERPREF_FILE, BLI_path_join, CLOG_INFO_NOCHECK, CLOG_WARN, FILE_MAX, LOG_BLEND, RPT_ERROR, RPT_INFO, and U.
Referenced by WM_exit_ex(), and wm_userpref_write_exec().
| bool BKE_blendfile_userdef_write_app_template | ( | const char * | filepath, |
| ReportList * | reports ) |
Only write the UserDef in a .blend, merging with the existing blend file.
Definition at line 1646 of file blendfile.cc.
References BKE_blender_userdef_app_template_data_swap(), BKE_blender_userdef_data_free(), BKE_blendfile_userdef_from_defaults(), BKE_blendfile_userdef_read(), BKE_blendfile_userdef_write(), BLI_exists(), MEM_freeN(), and U.
Referenced by BKE_blendfile_userdef_write_all().
| void BKE_blendfile_workspace_config_data_free | ( | WorkspaceConfigFileData * | workspace_config | ) |
Definition at line 1763 of file blendfile.cc.
References BKE_main_free(), WorkspaceConfigFileData::main, and MEM_freeN().
Referenced by workspace_add_menu().
| WorkspaceConfigFileData * BKE_blendfile_workspace_config_read | ( | const char * | filepath, |
| const void * | file_buf, | ||
| int | file_buf_size, | ||
| ReportList * | reports ) |
Definition at line 1730 of file blendfile.cc.
References BLO_read_from_file(), BLO_read_from_memory(), BLO_READ_SKIP_USERDEF, BlendFileData::main, WorkspaceConfigFileData::main, MEM_callocN(), BlendFileReadReport::reports, Main::versionfile, Main::workspaces, and WorkspaceConfigFileData::workspaces.
Referenced by workspace_config_file_read(), and workspace_system_file_read().
|
static |
Definition at line 184 of file blendfile.cc.
References BKE_bpath_foreach_path_main(), BKE_BPATH_FOREACH_PATH_SKIP_MULTIFILE, BLI_path_slash_native(), BPathForeachPathData::bmain, BPathForeachPathData::callback_function, BPathForeachPathData::flag, foreach_path_clean_cb(), LISTBASE_FOREACH, Main::scenes, and BPathForeachPathData::user_data.
Referenced by setup_app_data().
|
static |
Definition at line 173 of file blendfile.cc.
References BLI_path_slash_native(), BLI_strncpy(), and STREQ.
Referenced by clean_paths().
|
static |
Definition at line 1309 of file blendfile.cc.
References BKE_reportf(), BLENDER_FILE_SUBVERSION, BLENDER_FILE_VERSION, main, BlendFileReadReport::reports, and RPT_WARNING.
Referenced by BKE_blendfile_read().
|
static |
Definition at line 396 of file blendfile.cc.
References blender::bke::id::IDRemapper::apply(), BKE_main_namemap_destroy(), BLI_assert_unreachable, Library::id, ID_REMAP_APPLY_DEFAULT, ID_REMAP_RESULT_SOURCE_NOT_MAPPABLE, ID_REMAP_RESULT_SOURCE_REMAPPED, ID_REMAP_RESULT_SOURCE_UNASSIGNED, ID_REMAP_RESULT_SOURCE_UNAVAILABLE, LIBRARY_ASSET_EDITABLE, LIBRARY_ASSET_FILE_WRITABLE, result, reuse_bmain_data_remapper_ensure(), reuse_bmain_move_id(), and Library::runtime.
Referenced by reuse_editable_asset_bmain_data_dependencies_process_cb(), and reuse_editable_asset_bmain_data_for_blendfile().
|
static |
Detect and fix invalid usages of locale IDs by linked ones (or as reference of liboverrides).
Definition at line 806 of file blendfile.cc.
References BKE_lib_override_library_free(), BKE_library_foreach_ID_link(), FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, ID_IS_LINKED, ID_IS_OVERRIDE_LIBRARY_REAL, IDWALK_NOP, ReuseOldBMainData::new_bmain, ID::override_library, IDOverrideLibrary::reference, and reuse_bmain_data_invalid_local_usages_fix_cb().
Referenced by setup_app_data().
|
static |
Definition at line 764 of file blendfile.cc.
References LibraryIDLinkCallbackData::cb_flag, ID_IS_LINKED, ID_IS_OVERRIDE_LIBRARY_REAL, LibraryIDLinkCallbackData::id_pointer, id_us_min(), IDWALK_CB_EMBEDDED, IDWALK_CB_EMBEDDED_NOT_OWNING, IDWALK_CB_USER, IDWALK_RET_NOP, ID::override_library, LibraryIDLinkCallbackData::owner_id, and IDOverrideLibrary::reference.
Referenced by reuse_bmain_data_invalid_local_usages_fix().
|
static |
Search for all libraries in old_bmain that are also in new_bmain (i.e. different Library IDs having the same absolute filepath), and create a remapping rule for these.
NOTE: The case where the old_bmain would be a library in the newly read one is not handled here, as it does not create explicit issues. The local data from old_bmain is either discarded, or added to the new_bmain as local data as well. Worst case, there will be a double of a linked data as a local one, without any known relationships between them. In practice, this latter case is not expected to commonly happen.
Definition at line 270 of file blendfile.cc.
References blender::bke::id::IDRemapper::add(), Main::filepath, ReuseOldBMainData::is_libraries_remapped, Main::libraries, LISTBASE_FOREACH, ReuseOldBMainData::new_bmain, ReuseOldBMainData::old_bmain, ReuseOldBMainData::remapper, and STREQ.
Referenced by reuse_bmain_data_dependencies_new_library_get(), reuse_bmain_move_id(), reuse_editable_asset_bmain_data_dependencies_process_cb(), reuse_editable_asset_bmain_data_for_blendfile(), swap_old_bmain_data_for_blendfile(), swap_old_bmain_data_for_blendfile_dependencies_process_cb(), and swap_wm_data_for_blendfile().
|
static |
Definition at line 310 of file blendfile.cc.
References BLI_assert, BLI_assert_msg, ELEM, blender::bke::id::IDRemapper::get_mapping_result(), ID_REMAP_APPLY_DEFAULT, ID_REMAP_RESULT_SOURCE_NOT_MAPPABLE, ID_REMAP_RESULT_SOURCE_REMAPPED, ID_REMAP_RESULT_SOURCE_UNASSIGNED, ID_REMAP_RESULT_SOURCE_UNAVAILABLE, and result.
Referenced by reuse_editable_asset_bmain_data_dependencies_process_cb(), and swap_old_bmain_data_for_blendfile_dependencies_process_cb().
|
static |
Definition at line 324 of file blendfile.cc.
References blender::bke::id::IDRemapper::add(), BKE_id_new_name_validate(), BKE_lib_libblock_session_uid_renew(), BKE_main_namemap_remove_id(), BLI_addtail(), BLI_assert, BLI_findindex(), BLI_remlink_safe(), ELEM, GS, ID_FLAG_EMBEDDED_DATA, ID_IS_LINKED, id_sort_by_name(), lib, LISTBASE_FOREACH_BACKWARD, ReuseOldBMainData::new_bmain, ReuseOldBMainData::old_bmain, RenameExistingNever, reuse_bmain_data_remapper_ensure(), STREQ, and which_libbase().
Referenced by reuse_bmain_data_dependencies_new_library_get(), reuse_editable_asset_bmain_data_dependencies_process_cb(), and reuse_editable_asset_bmain_data_for_blendfile().
|
static |
Definition at line 436 of file blendfile.cc.
References blender::bke::id::IDRemapper::add(), BLI_assert_unreachable, GS, ID_LI, LibraryIDLinkCallbackData::id_pointer, ID_TYPE_SUPPORTS_ASSET_EDITABLE, IDWALK_RET_NOP, IDWALK_RET_STOP_RECURSION, reuse_bmain_data_dependencies_new_library_get(), reuse_bmain_data_remapper_ensure(), reuse_bmain_data_remapper_is_id_remapped(), reuse_bmain_move_id(), and LibraryIDLinkCallbackData::user_data.
Referenced by reuse_editable_asset_bmain_data_for_blendfile().
|
static |
Selectively 'import' data from old Main into new Main, provided it does not conflict with data already present in the new Main (name-wise and library-wise).
Dependencies from moved over old data are also imported into the new Main, (unless, in case of linked data, a matching linked ID is already available in new Main).
When a conflict is found, usages of the conflicted ID by the old data are stored in the remapper of ReuseOldBMainData to be remapped to the matching data in the new Main later.
NOTE: This function will never remove any original new data from the new Main, it only moves (some of) the old data to the new Main.
Definition at line 511 of file blendfile.cc.
References blender::bke::id::IDRemapper::add(), BKE_library_foreach_ID_link(), FOREACH_MAIN_LISTBASE_ID_BEGIN, FOREACH_MAIN_LISTBASE_ID_END, ID_IS_LINKED, IDWALK_DO_LIBRARY_POINTER, IDWALK_RECURSE, ID::lib, LIBRARY_ASSET_EDITABLE, ReuseOldBMainData::new_bmain, ReuseOldBMainData::old_bmain, reuse_bmain_data_dependencies_new_library_get(), reuse_bmain_data_remapper_ensure(), reuse_bmain_move_id(), reuse_editable_asset_bmain_data_dependencies_process_cb(), Library::runtime, and which_libbase().
Referenced by setup_app_data().
|
static |
Definition at line 487 of file blendfile.cc.
References lib, Main::libraries, LIBRARY_ASSET_EDITABLE, LISTBASE_FOREACH, and ReuseOldBMainData::old_bmain.
Referenced by setup_app_data().
|
static |
Definition at line 1295 of file blendfile.cc.
References BLO_READ_SKIP_DATA, BLO_READ_SKIP_USERDEF, C, params, setup_app_data(), and setup_app_userdef().
Referenced by BKE_blendfile_read_setup_readfile().
|
static |
This function runs after loading blend-file data and is responsible for setting up the context (the active view-layer, scene & work-space).
When loading a blend-file without it's UI (G_FILE_NO_UI), the existing screen-data needs to point to the newly loaded blend-file data.
| bfd | Blend file data, freed by this function on exit. |
Definition at line 921 of file blendfile.cc.
References BKE_blender_globals_main_replace(), BKE_idtype_get_info_from_idtype_index(), BKE_idtype_idcode_to_name(), BKE_lib_override_library_main_operations_create(), BKE_lib_override_library_main_resync(), BKE_libblock_remap_multiple_raw(), BKE_main_id_refcount_recompute(), BKE_main_idmap_create(), BKE_main_idmap_destroy(), BKE_main_namemap_validate(), BKE_report(), BKE_scene_add(), BKE_scene_set_background(), BKE_screen_gizmo_tag_refresh(), BKE_screen_runtime_refresh_for_blendfile(), BKE_screen_view3d_scene_sync(), BKE_view_layer_default_view(), BLI_assert, BLI_time_now_seconds(), BLO_read_do_version_after_setup(), BLO_readfile_id_runtime_data_free_all(), BLO_reportf_wrap(), BPY_context_update(), C, clean_paths(), BlendFileReadReport::count, CTX_data_main_set(), CTX_data_scene_set(), CTX_py_init_get(), CTX_wm_area_set(), CTX_wm_manager(), CTX_wm_manager_set(), CTX_wm_region_popup_set(), CTX_wm_region_set(), CTX_wm_screen(), CTX_wm_screen_set(), CTX_wm_window(), BlendFileData::cur_view_layer, BlendFileData::curscene, BlendFileData::curscreen, BlendFileReadReport::duration, ELEM, BlendFileData::fileflags, BlendFileData::filepath, Main::filepath, ListBase::first, FOREACH_MAIN_ID_BEGIN, FOREACH_MAIN_ID_END, G, G_FILE_ASSET_EDIT_FILE, G_FILE_FLAG_ALL_RUNTIME, G_FILE_NO_UI, G_FILE_RECOVER_READ, G_FLAG_ALL_READFILE, G_FLAG_ALL_RUNTIME, G_MAIN, BlendFileData::globalf, GS, IDTypeInfo::id_code, ID_IS_LINKED, ReuseOldBMainData::id_map, ID_REMAP_FORCE_UI_POINTERS, ID_REMAP_SKIP_UPDATE_TAGGING, ID_REMAP_SKIP_USER_CLEAR, ID_REMAP_SKIP_USER_REFCOUNT, ID_SCR, ID_TAG_MISSING, ID_TYPE_SUPPORTS_ASSET_EDITABLE, ID_WM, ID_WS, IMB_colormanagement_check_file_config(), IMB_colormanagement_working_space_check(), IMB_colormanagement_working_space_init_startup(), INDEX_ID_MAX, Main::is_asset_edit_file, blender::bke::liboverride::is_auto_resync_enabled(), ID::lib, BlendFileReadReport::lib_overrides_resync, LISTBASE_FOREACH, BlendFileData::main, MAIN_IDMAP_TYPE_NAME, BlendFileReadReport::missing_linked_id, ID::name, ReuseOldBMainData::new_bmain, ReuseOldBMainData::old_bmain, params, RE_FreeAllPersistentData(), RE_FreeAllRenderResults(), RE_FreeInteractiveCompositorRenders(), Main::recovered, ReuseOldBMainData::remapper, BlendFileReadReport::reports, reuse_bmain_data_invalid_local_usages_fix(), reuse_editable_asset_bmain_data_for_blendfile(), reuse_editable_asset_needed(), RPT_, RPT_INFO, RPT_WARNING, Library::runtime, wmWindow::scene, Main::scenes, Main::screens, STEP_INVALID, STRNCPY(), swap_old_bmain_data_dependencies_process(), swap_old_bmain_data_for_blendfile(), swap_wm_data_for_blendfile(), ID::tag, unpin_file_local_grease_pencil_brush_materials(), Main::wm, wm_data_consistency_ensure(), wm_scene_is_visible(), and ReuseOldBMainData::wm_setup_data.
Referenced by setup_app_blend_file_data().
|
static |
Definition at line 209 of file blendfile.cc.
References BKE_blender_userdef_data_set_and_free(), U, BlendFileData::user, and USER_SCRIPT_AUTOEXEC_DISABLE.
Referenced by setup_app_blend_file_data().
|
static |
Definition at line 740 of file blendfile.cc.
References BKE_library_foreach_ID_link(), BLI_assert, FOREACH_MAIN_LISTBASE_ID_BEGIN, FOREACH_MAIN_LISTBASE_ID_END, ReuseOldBMainData::id_map, IDWALK_DO_LIBRARY_POINTER, IDWALK_INCLUDE_UI, IDWALK_READONLY, ReuseOldBMainData::new_bmain, swap_old_bmain_data_for_blendfile_dependencies_process_cb(), and which_libbase().
Referenced by setup_app_data().
|
static |
Does a complete replacement of data in new_bmain by data from old_bmain. Original new data are moved to the old_bmain, and will be freed together with it.
WARNING: Currently only expects to work on local data, won't work properly if some of the IDs of given type are linked.
NOTE: Unlike with reuse_editable_asset_bmain_data_for_blendfile, there is no support at all for potential dependencies of the IDs moved around. This is not expected to be necessary for the current use cases (UI-related IDs).
Definition at line 585 of file blendfile.cc.
References blender::bke::id::IDRemapper::add(), blender::bke::id::IDRemapper::add_overwrite(), BKE_lib_libblock_session_uid_renew(), BKE_main_namemap_clear(), BLI_assert, BLI_listbase_is_empty(), ELEM, ListBase::first, FOREACH_MAIN_LISTBASE_ID_BEGIN, FOREACH_MAIN_LISTBASE_ID_END, ID_IS_LINKED, ListBase::last, ID::name, ReuseOldBMainData::new_bmain, ID::next, ReuseOldBMainData::old_bmain, reuse_bmain_data_remapper_ensure(), and which_libbase().
Referenced by setup_app_data(), and swap_wm_data_for_blendfile().
|
static |
Definition at line 714 of file blendfile.cc.
References blender::bke::id::IDRemapper::add(), BKE_main_idmap_lookup_id(), BLI_assert, ReuseOldBMainData::id_map, LibraryIDLinkCallbackData::id_pointer, IDWALK_RET_NOP, reuse_bmain_data_remapper_ensure(), reuse_bmain_data_remapper_is_id_remapped(), and LibraryIDLinkCallbackData::user_data.
Referenced by swap_old_bmain_data_dependencies_process().
|
static |
Similar to swap_old_bmain_data_for_blendfile, but with special handling for WM ID. Tightly related to further WM post-processing from calling WM code (see WM_file_read and wm_homefile_read_ex).
Definition at line 658 of file blendfile.cc.
References blender::bke::id::IDRemapper::add(), BKE_lib_id_swap_full(), BLI_addhead(), BLI_assert, BLI_listbase_count_at_most(), BLI_remlink(), ListBase::first, wmWindowManager::id, ID_REMAP_FORCE_UI_POINTERS, ID_REMAP_SKIP_NEVER_NULL_USAGE, ID_REMAP_SKIP_UPDATE_TAGGING, ID_REMAP_SKIP_USER_REFCOUNT, ID_WM, wmWindowManager::init_flag, ReuseOldBMainData::new_bmain, ReuseOldBMainData::old_bmain, BlendFileReadWMSetupData::old_wm, reuse_bmain_data_remapper_ensure(), swap_old_bmain_data_for_blendfile(), Main::wm, WM_INIT_FLAG_WINDOW, and ReuseOldBMainData::wm_setup_data.
Referenced by setup_app_data().
|
static |
Grease pencil brushes may have a material pinned that is from the current file. Moving local scene data to a different Main is tricky, so in that case, unpin the material.
Definition at line 557 of file blendfile.cc.
References Main::brushes, FOREACH_MAIN_LISTBASE_ID_BEGIN, FOREACH_MAIN_LISTBASE_ID_END, GP_BRUSH_MATERIAL_PINNED, ID_IS_LINKED, and ReuseOldBMainData::old_bmain.
Referenced by setup_app_data().
|
static |
Definition at line 835 of file blendfile.cc.
References bScreen::areabase, BKE_workspace_active_screen_get(), Scene::camera, View3D::camera, ListBase::first, LISTBASE_FOREACH, Base::local_view_bits, View3D::local_view_uid, RegionView3D::localvd, View3D::localvd, MEM_freeN(), MEM_SAFE_FREE, Base::next, ViewLayer::object_bases, RGN_TYPE_WINDOW, View3D::scenelock, SPACE_VIEW3D, and wmWindow::workspace_hook.
Referenced by wm_data_consistency_ensure().
|
static |
Definition at line 888 of file blendfile.cc.
References BKE_view_layer_find(), LISTBASE_FOREACH, ViewLayer::name, STRNCPY_UTF8, view3d_data_consistency_ensure(), and wmWindowManager::windows.
Referenced by setup_app_data().
|
static |
Definition at line 199 of file blendfile.cc.
References LISTBASE_FOREACH.
Referenced by setup_app_data().
|
static |
Definition at line 1355 of file blendfile.cc.
Referenced by BKE_blendfile_read(), BKE_blendfile_userdef_write_all(), and WM_exit_ex().
|
static |