Blender V4.5
blendfile.cc File Reference
#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 "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.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 Templates

When 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.

  • Reading preferences is performed for both the app-template & regular preferences.

    The preferences are merged by using some from the app-template and other settings from the regular preferences (add-ons from the app-template for example are used), undo-memory uses the regular preferences (for example).

  • Writing preferences is performed for both the app-template & regular preferences.

    Writing unmodified preference (U) into the regular preferences would loose any settings the app-template overrides. To keep default settings the regular preferences is read, add-ons etc temporarily swapped into U for writing, then swapped back out so as not to change the run-time preferences.

Note
The function BKE_blender_userdef_app_template_data_swap determines which settings the app-template overrides.
UserDefBKE_blendfile_userdef_read (const char *filepath, ReportList *reports)
UserDefBKE_blendfile_userdef_read_from_memory (const void *file_buf, int file_buf_size, ReportList *reports)
UserDefBKE_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)
WorkspaceConfigFileDataBKE_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"}

Blend File IO (High Level)

std::swapnew_lb
BKE_main_namemap_clearold_bmain
BKE_main_namemap_clearnew_bmain
IDdiscarded_id_iter = static_cast<ID *>(old_lb->first)
IDreused_id_iter = static_cast<ID *>(new_lb->first)
 FOREACH_MAIN_LISTBASE_ID_END
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::IDRemapperreuse_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 Libraryreuse_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)
 BLI_assert (BLI_listbase_is_empty(old_lb)||!ID_IS_LINKED(old_lb->last))
 BLI_assert (BLI_listbase_is_empty(new_lb)||!ID_IS_LINKED(new_lb->last))
 while (!ELEM(nullptr, discarded_id_iter, reused_id_iter))
 for (;discarded_id_iter !=nullptr;discarded_id_iter=static_cast< ID * >(discarded_id_iter->next))
 FOREACH_MAIN_LISTBASE_ID_BEGIN (new_lb, reused_id_iter)
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)
BlendFileDataBKE_blendfile_read (const char *filepath, const BlendFileReadParams *params, BlendFileReadReport *reports)
BlendFileDataBKE_blendfile_read_from_memory (const void *file_buf, int file_buf_size, const BlendFileReadParams *params, ReportList *reports)
BlendFileDataBKE_blendfile_read_from_memfile (Main *bmain, MemFile *memfile, const BlendFileReadParams *params, ReportList *reports)
void BKE_blendfile_read_make_empty (bContext *C)

Detailed Description

High level .blend file read/write, and functions for writing partial files (only selected data-blocks).

Definition in file blendfile.cc.

Function Documentation

◆ BKE_blendfile_extension_check()

bool BKE_blendfile_extension_check ( const char * str)

Check whether given path ends with a blend file compatible extension (.blend, .ble or .blend.gz).

Parameters
strThe path to check.
Returns
true is this path ends with a blender file extension.

Definition at line 84 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().

◆ BKE_blendfile_is_readable()

bool BKE_blendfile_is_readable ( const char * path,
ReportList * reports )

Check whether a given path is actually a Blender-readable, valid .blend file.

Note
Currently does attempt to open and read (part of) the given file.

Definition at line 153 of file blendfile.cc.

References BLO_blendhandle_close(), BLO_blendhandle_from_file(), BlendFileReadReport::reports, and reports.

Referenced by file_draw_hint_if_invalid().

◆ BKE_blendfile_library_path_explode()

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).

Parameters
paththe full path to explode.
r_dirthe 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_groupa pointer within r_dir to the 'group' part of the path, if any ('\0' terminated). May be NULL.
r_namea pointer within r_dir to the data-block name, if any ('\0' terminated). May be NULL.
Returns
true if path contains a blend file.

Definition at line 90 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().

◆ BKE_blendfile_read()

◆ BKE_blendfile_read_from_memfile()

BlendFileData * BKE_blendfile_read_from_memfile ( Main * bmain,
MemFile * memfile,
const BlendFileReadParams * params,
ReportList * reports )
Returns
Blend file data, this must be passed to BKE_blendfile_read_setup_readfile/BKE_blendfile_read_setup_undo when non-NULL.
Note
memfile is the undo buffer.

Definition at line 1393 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, params, and reports.

Referenced by BKE_memfile_undo_decode().

◆ BKE_blendfile_read_from_memory()

BlendFileData * BKE_blendfile_read_from_memory ( const void * file_buf,
int file_buf_size,
const BlendFileReadParams * params,
ReportList * reports )

◆ BKE_blendfile_read_make_empty()

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 1410 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().

◆ BKE_blendfile_read_setup_readfile()

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 1315 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, reports, and setup_app_blend_file_data().

Referenced by BKE_blendfile_read_setup_undo(), WM_file_read(), and wm_homefile_read_ex().

◆ BKE_blendfile_read_setup_undo()

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 1340 of file blendfile.cc.

References BKE_blendfile_read_setup_readfile(), C, params, and reports.

Referenced by BKE_memfile_undo_decode().

◆ BKE_blendfile_userdef_from_defaults()

◆ BKE_blendfile_userdef_read()

UserDef * BKE_blendfile_userdef_read ( const char * filepath,
ReportList * reports )

◆ BKE_blendfile_userdef_read_from_memory()

UserDef * BKE_blendfile_userdef_read_from_memory ( const void * file_buf,
int file_buf_size,
ReportList * reports )

◆ BKE_blendfile_userdef_write()

bool BKE_blendfile_userdef_write ( const char * filepath,
ReportList * reports )

Only write the UserDef in a .blend.

Returns
success.

Definition at line 1597 of file blendfile.cc.

References BLO_write_file(), MEM_callocN(), MEM_freeN(), params, and reports.

Referenced by BKE_blendfile_userdef_write_all(), and BKE_blendfile_userdef_write_app_template().

◆ BKE_blendfile_userdef_write_all()

◆ BKE_blendfile_userdef_write_app_template()

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.

Returns
success.
Note
In the future we should re-evaluate user preferences, possibly splitting out system/hardware specific preferences.

Definition at line 1614 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(), reports, and U.

Referenced by BKE_blendfile_userdef_write_all().

◆ BKE_blendfile_workspace_config_data_free()

void BKE_blendfile_workspace_config_data_free ( WorkspaceConfigFileData * workspace_config)

Definition at line 1745 of file blendfile.cc.

References BKE_main_free(), WorkspaceConfigFileData::main, and MEM_freeN().

Referenced by workspace_add_menu().

◆ BKE_blendfile_workspace_config_read()

◆ BLI_assert() [1/2]

BLI_assert ( BLI_listbase_is_empty(new_lb)||!ID_IS_LINKED(new_lb->last) )

References new_lb.

◆ BLI_assert() [2/2]

BLI_assert ( BLI_listbase_is_empty(old_lb)||!ID_IS_LINKED(old_lb->last) )

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). */ static void swap_old_bmain_data_for_blendfile(ReuseOldBMainData *reuse_data, const short id_code) { Main *new_bmain = reuse_data->new_bmain; Main *old_bmain = reuse_data->old_bmain;

ListBase *new_lb = which_libbase(new_bmain, id_code); ListBase *old_lb = which_libbase(old_bmain, id_code);

id::IDRemapper &remapper = reuse_bmain_data_remapper_ensure(reuse_data);

/* NOTE: Full swapping is only supported for ID types that are assumed to be only local data-blocks (like UI-like ones). Otherwise, the swapping could fail in many funny ways.

◆ clean_paths()

◆ for()

for ( ;discarded_id_iter ! = nullptrdiscarded_id_iter = static_cast<ID *>(discarded_id_iter->next))

◆ FOREACH_MAIN_LISTBASE_ID_BEGIN()

FOREACH_MAIN_LISTBASE_ID_BEGIN ( new_lb ,
reused_id_iter  )

◆ foreach_path_clean_cb()

bool foreach_path_clean_cb ( BPathForeachPathData * ,
char * path_dst,
size_t path_dst_maxncpy,
const char * path_src )
static

Definition at line 171 of file blendfile.cc.

References BLI_path_slash_native(), BLI_strncpy(), and STREQ.

Referenced by clean_paths().

◆ handle_subversion_warning()

void handle_subversion_warning ( Main * main,
BlendFileReadReport * reports )
static

◆ reuse_bmain_data_dependencies_new_library_get()

◆ reuse_bmain_data_invalid_local_usages_fix()

void reuse_bmain_data_invalid_local_usages_fix ( ReuseOldBMainData * reuse_data)
static

◆ reuse_bmain_data_invalid_local_usages_fix_cb()

◆ reuse_bmain_data_remapper_ensure()

id::IDRemapper & reuse_bmain_data_remapper_ensure ( ReuseOldBMainData * reuse_data)
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 268 of file blendfile.cc.

References blender::bke::id::IDRemapper::add(), ReuseOldBMainData::is_libraries_remapped, LISTBASE_FOREACH, new_bmain, ReuseOldBMainData::new_bmain, old_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_dependencies_process_cb(), and swap_wm_data_for_blendfile().

◆ reuse_bmain_data_remapper_is_id_remapped()

◆ reuse_bmain_move_id()

◆ reuse_editable_asset_bmain_data_dependencies_process_cb()

◆ reuse_editable_asset_bmain_data_for_blendfile()

void reuse_editable_asset_bmain_data_for_blendfile ( ReuseOldBMainData * reuse_data,
const short idcode )
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 509 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, new_bmain, ReuseOldBMainData::new_bmain, old_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().

◆ reuse_editable_asset_needed()

bool reuse_editable_asset_needed ( ReuseOldBMainData * reuse_data)
static

◆ setup_app_blend_file_data()

void setup_app_blend_file_data ( bContext * C,
BlendFileData * bfd,
const BlendFileReadParams * params,
BlendFileReadWMSetupData * wm_setup_data,
BlendFileReadReport * reports )
static

◆ setup_app_data()

void setup_app_data ( bContext * C,
BlendFileData * bfd,
const BlendFileReadParams * params,
BlendFileReadWMSetupData * wm_setup_data,
BlendFileReadReport * reports )
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.

Note
this is called on undo so any slow conversion functions here should be avoided or check mode != LOAD_UNDO.
Parameters
bfdBlend file data, freed by this function on exit.

Definition at line 919 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(), 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, 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(), INDEX_ID_MAX, Main::is_asset_edit_file, blender::bke::liboverride::is_auto_resync_enabled(), ID::lib, LISTBASE_FOREACH, BlendFileData::main, MAIN_IDMAP_TYPE_NAME, ID::name, ReuseOldBMainData::new_bmain, ReuseOldBMainData::old_bmain, params, RE_FreeAllPersistentData(), RE_FreeAllRenderResults(), RE_FreeInteractiveCompositorRenders(), Main::recovered, ReuseOldBMainData::remapper, 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_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().

◆ setup_app_userdef()

void setup_app_userdef ( BlendFileData * bfd)
static

◆ swap_old_bmain_data_dependencies_process()

◆ swap_old_bmain_data_for_blendfile_dependencies_process_cb()

◆ swap_wm_data_for_blendfile()

◆ unpin_file_local_grease_pencil_brush_materials()

void unpin_file_local_grease_pencil_brush_materials ( const ReuseOldBMainData * reuse_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 555 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().

◆ view3d_data_consistency_ensure()

◆ while()

while ( ! ELEMnullptr, discarded_id_iter, reused_id_iter)

◆ wm_data_consistency_ensure()

void wm_data_consistency_ensure ( wmWindowManager * curwm,
Scene * cur_scene,
ViewLayer * cur_view_layer )
static

◆ wm_scene_is_visible()

bool wm_scene_is_visible ( wmWindowManager * wm,
Scene * scene )
static

Definition at line 197 of file blendfile.cc.

References LISTBASE_FOREACH.

Referenced by setup_app_data().

Variable Documentation

◆ discarded_id_iter

ID* discarded_id_iter = static_cast<ID *>(old_lb->first)

Definition at line 612 of file blendfile.cc.

Referenced by for(), and while().

◆ FOREACH_MAIN_LISTBASE_ID_END

FOREACH_MAIN_LISTBASE_ID_END

Definition at line 648 of file blendfile.cc.

◆ LOG_PARTIALWRITE

◆ new_bmain

◆ new_lb

◆ old_bmain

◆ reused_id_iter

ID* reused_id_iter = static_cast<ID *>(new_lb->first)

Definition at line 613 of file blendfile.cc.

Referenced by FOREACH_MAIN_LISTBASE_ID_BEGIN(), and while().