blender/source
Bastien Montagne 3d5d572db6 Core: Rewrite of 'partial blendfile write' feature.
This commit introduces a new `PartialWriteContext` class, which wraps
around a regular Main struct. It is designed to make writing a set of
IDs easy and safe, and to prepare for future 'asset library editing'
low-level code.

The main goal of this refactor is to provide the same functionalities
(or better ones) than existing partial write code, without the very
bad hacks currently done.

It will replace within the coming weeks all current usages of the
`BKE_blendfile_write_partial` API.

Essentially, it allows to:
* Add (aka copy) IDs from the G_MAIN to the partial write context.
  * This process handles dependencies and libraries automatically.
  * A refined handling of dependencies is possible through an optional
    'filtering' callback.
* Keep track of added IDs, to allow de-duplication in case data is added
  more than once.
* Cleanup the context (i.e. remove unused IDs).
* Write the context to disk as a blendfile.

Since the context keeps information to find matches between its content
and IDs from the G_MAIN, its lifespan is expected to be _very_ short.
Otherwise, changes in G_MAIN (relationships between IDs, their session uid,
etc.) cannot be tracked by the context, leading to inconsistencies.
A partial write context should typically be created, filled, written and
deleted within a same function.

Pull Request: https://projects.blender.org/blender/blender/pulls/122118
2024-07-01 15:27:54 +02:00
..
blender Core: Rewrite of 'partial blendfile write' feature. 2024-07-01 15:27:54 +02:00
creator Merge branch 'blender-v4.2-release' 2024-07-01 15:16:48 +10:00
CMakeLists.txt Revert changes from main commits that were merged into blender-v4.1-release 2024-03-18 15:04:12 +01:00