Files
test/source
Bastien Montagne 2933433abc Cleanup/Refactor: Readfile: Add a fd_bmain new pointer to FileData.
Existing code was confusing, as existing `FileData::bmain` was not
really documented, and it could be in some cases the 'library bmain' of
a library filedata, instead of the 'main' Main (i.e. the local data of
the currently editied blendfile, the one containing all local IDs).

Now, `FileData::bmain` is always the 'main' root Main.

The new `FileData::fd_bmain` is assigned with the Main matching that
filedata and its blendfile: either the same 'main' Main (when used to
read the main edited blendfile), or the 'library' Main (when used to
read a library blendfile).

This is mostly no-op change in current code (with one exception, see
below), as this pointer is currently mostly used either:
* In a context whgere it is also always the 'main' Main, or...
* In a context where it is only used to access the (shared among all
  Mains) list of `Main::split_mains`.

But having a clear and sane definition of this data gets much more
important with packed linked data (see !133801), as there we have data
that 'belong' to a library, but must e.g. be read from another FileData,
with the added complexity of different versions etc.

NOTE: The only effective change in this commit is
`read_library_file_data`, which used to assign the _library_ Main to the
new (library) `FileData::bmain`. This should not have any effect in
practice in current code, as this Main is only used to access its list
of split_mains.

Pull Request: https://projects.blender.org/blender/blender/pulls/142384
2025-07-21 13:32:31 +02:00
..