|
Blender V4.3
|
#include <cstdlib>#include <cstring>#include "CLG_log.h"#include "MEM_guardedalloc.h"#include "DNA_brush_types.h"#include "DNA_material_types.h"#include "DNA_scene_types.h"#include "DNA_screen_types.h"#include "DNA_space_types.h"#include "DNA_workspace_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_system.h"#include "BLI_time.h"#include "BLI_utildefines.h"#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_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 (High Level) | |
| static bool | foreach_path_clean_cb (BPathForeachPathData *, char *path_dst, size_t path_dst_maxncpy, const char *path_src) |
| static void | clean_paths (Main *bmain) |
| static bool | wm_scene_is_visible (wmWindowManager *wm, Scene *scene) |
| static void | setup_app_userdef (BlendFileData *bfd) |
| static id::IDRemapper & | reuse_bmain_data_remapper_ensure (ReuseOldBMainData *reuse_data) |
| static bool | reuse_bmain_data_remapper_is_id_remapped (id::IDRemapper &remapper, ID *id) |
| static bool | reuse_bmain_move_id (ReuseOldBMainData *reuse_data, ID *id, Library *lib, const bool reuse_existing) |
| static Library * | reuse_bmain_data_dependencies_new_library_get (ReuseOldBMainData *reuse_data, Library *old_lib) |
| static int | reuse_editable_asset_bmain_data_dependencies_process_cb (LibraryIDLinkCallbackData *cb_data) |
| static bool | reuse_editable_asset_needed (ReuseOldBMainData *reuse_data) |
| static void | reuse_editable_asset_bmain_data_for_blendfile (ReuseOldBMainData *reuse_data, const short idcode) |
| static void | unpin_file_local_grease_pencil_brush_materials (const ReuseOldBMainData *reuse_data) |
| static void | swap_old_bmain_data_for_blendfile (ReuseOldBMainData *reuse_data, const short id_code) |
| static void | swap_wm_data_for_blendfile (ReuseOldBMainData *reuse_data, const bool load_ui) |
| static int | swap_old_bmain_data_for_blendfile_dependencies_process_cb (LibraryIDLinkCallbackData *cb_data) |
| static void | swap_old_bmain_data_dependencies_process (ReuseOldBMainData *reuse_data, const short id_code) |
| static int | reuse_bmain_data_invalid_local_usages_fix_cb (LibraryIDLinkCallbackData *cb_data) |
| static void | reuse_bmain_data_invalid_local_usages_fix (ReuseOldBMainData *reuse_data) |
| static void | view3d_data_consistency_ensure (wmWindow *win, Scene *scene, ViewLayer *view_layer) |
| static void | wm_data_consistency_ensure (wmWindowManager *curwm, Scene *cur_scene, ViewLayer *cur_view_layer) |
| static void | setup_app_data (bContext *C, BlendFileData *bfd, const BlendFileReadParams *params, BlendFileReadWMSetupData *wm_setup_data, BlendFileReadReport *reports) |
| static void | setup_app_blend_file_data (bContext *C, BlendFileData *bfd, const BlendFileReadParams *params, BlendFileReadWMSetupData *wm_setup_data, BlendFileReadReport *reports) |
| static void | handle_subversion_warning (Main *main, BlendFileReadReport *reports) |
| 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) |
| void | BKE_blendfile_read_setup_undo (bContext *C, BlendFileData *bfd, const BlendFileReadParams *params, BlendFileReadReport *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) |
| BlendFileData * | BKE_blendfile_read_from_memfile (Main *bmain, MemFile *memfile, const BlendFileReadParams *params, ReportList *reports) |
| void | BKE_blendfile_read_make_empty (bContext *C) |
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 = {"bke.blendfile.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 83 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 152 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 89 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(), and wm_link_append_exec().
| BlendFileData * BKE_blendfile_read | ( | const char * | filepath, |
| const BlendFileReadParams * | params, | ||
| BlendFileReadReport * | reports ) |
Definition at line 1305 of file blendfile.cc.
References BKE_reports_prependf(), BLO_blendfiledata_free(), BLO_read_from_file(), G, handle_subversion_warning(), Main::is_read_invalid, BlendFileData::main, params, printf, and BlendFileReadReport::reports.
Referenced by BKE_memfile_undo_decode(), 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 ) |
memfile is the undo buffer. Definition at line 1350 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 1330 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 1367 of file blendfile.cc.
References BKE_id_delete(), 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 1272 of file blendfile.cc.
References BKE_reports_prepend(), BLO_blendfiledata_free(), BLO_READ_SKIP_DATA, BLO_update_defaults_startup_blend(), 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 1297 of file blendfile.cc.
References BKE_blendfile_read_setup_readfile(), and params.
Referenced by BKE_memfile_undo_decode().
| UserDef * BKE_blendfile_userdef_from_defaults | ( | ) |
Definition at line 1457 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, UserDef::language, UserDef::light_ambient, UserDef::light_param, MEM_callocN, MEM_mallocN, UserDef::memcachelimit, min_ii(), bAddon::module, STRNCPY, UserDef::themes, UserDef::transopts, U_default, U_theme_default, ULANGUAGE_AUTO, USER_SCRIPT_AUTOEXEC_DISABLE, 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 | ( | const char * | filepath, |
| ReportList * | reports ) |
Only read the UserDef from a .blend.
Definition at line 1413 of file blendfile.cc.
References BKE_main_free(), BLO_read_from_file(), BLO_READ_SKIP_ALL, BLO_READ_SKIP_USERDEF, BlendFileData::main, MEM_freeN(), BlendFileReadReport::reports, and BlendFileData::user.
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 1434 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, MEM_freeN(), and BlendFileData::user.
| bool BKE_blendfile_userdef_write | ( | const char * | filepath, |
| ReportList * | reports ) |
Only write the UserDef in a .blend.
Definition at line 1554 of file blendfile.cc.
References BLO_write_file(), MEM_freeN(), 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 1592 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, FILE_MAX, G, printf, RPT_ERROR, and RPT_INFO.
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 1571 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(), and MEM_freeN().
Referenced by BKE_blendfile_userdef_write_all().
| void BKE_blendfile_workspace_config_data_free | ( | WorkspaceConfigFileData * | workspace_config | ) |
Definition at line 1701 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 1668 of file blendfile.cc.
References BLO_read_from_file(), BLO_read_from_memory(), BLO_READ_SKIP_USERDEF, BlendFileData::main, WorkspaceConfigFileData::main, MEM_freeN(), BlendFileReadReport::reports, Main::versionfile, Main::workspaces, and WorkspaceConfigFileData::workspaces.
Referenced by workspace_config_file_read(), and workspace_system_file_read().
|
static |
Definition at line 181 of file blendfile.cc.
References BKE_bpath_foreach_path_main(), BKE_BPATH_FOREACH_PATH_SKIP_MULTIFILE, BLI_path_slash_native(), BPathForeachPathData::bmain, foreach_path_clean_cb(), LISTBASE_FOREACH, and Main::scenes.
Referenced by setup_app_data().
|
static |
Definition at line 170 of file blendfile.cc.
References BLI_path_slash_native(), BLI_strncpy(), and STREQ.
Referenced by clean_paths().
|
static |
Definition at line 1259 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 362 of file blendfile.cc.
References blender::bke::id::IDRemapper::apply(), 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, reuse_bmain_data_remapper_ensure(), reuse_bmain_move_id(), Library::runtime, and Library_Runtime::tag.
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 768 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, 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 726 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 261 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 301 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, and ID_REMAP_RESULT_SOURCE_UNAVAILABLE.
Referenced by reuse_editable_asset_bmain_data_dependencies_process_cb(), and swap_old_bmain_data_for_blendfile_dependencies_process_cb().
|
static |
Definition at line 315 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_name(), BLI_addtail(), BLI_assert, BLI_findindex(), BLI_remlink_safe(), ELEM, GS, 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 398 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 473 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, Library_Runtime::tag, and which_libbase().
Referenced by setup_app_data().
|
static |
Definition at line 449 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 1245 of file blendfile.cc.
References BLO_READ_SKIP_DATA, BLO_READ_SKIP_USERDEF, 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.
mode != LOAD_UNDO.| bfd | Blend file data, freed by this function on exit. |
Definition at line 883 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_reportf_wrap(), BPY_context_update(), 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, Library_Runtime::filepath_abs, 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(), INDEX_ID_MAX, Main::is_asset_edit_file, 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, Library_Runtime::parent, RE_FreeAllPersistentData(), RE_FreeAllRenderResults(), 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(), USER_EXPERIMENTAL_TEST, wmWindowManager::windows, 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 206 of file blendfile.cc.
References BKE_blender_userdef_data_set_and_free(), UserDef::flag, BlendFileData::user, and USER_SCRIPT_AUTOEXEC_DISABLE.
Referenced by setup_app_blend_file_data().
|
static |
Definition at line 702 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 theold_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 547 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 676 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 620 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, 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 519 of file blendfile.cc.
References Main::brushes, BrushGpencilSettings::flag, FOREACH_MAIN_LISTBASE_ID_BEGIN, FOREACH_MAIN_LISTBASE_ID_END, Brush::gpencil_settings, ID_IS_LINKED, BrushGpencilSettings::material, and ReuseOldBMainData::old_bmain.
Referenced by setup_app_data().
|
static |
Definition at line 797 of file blendfile.cc.
References BKE_workspace_active_screen_get(), 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 850 of file blendfile.cc.
References BKE_view_layer_find(), LISTBASE_FOREACH, ViewLayer::name, STRNCPY, view3d_data_consistency_ensure(), and wmWindowManager::windows.
Referenced by setup_app_data().
|
static |
Definition at line 196 of file blendfile.cc.
References LISTBASE_FOREACH, and wmWindowManager::windows.
Referenced by setup_app_data().
|
static |
Definition at line 1713 of file blendfile.cc.
Referenced by blender::bke::blendfile::PartialWriteContext::id_add(), blender::bke::blendfile::PartialWriteContext::is_valid(), and blender::bke::blendfile::PartialWriteContext::remove_unused().