3d5d572db6
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 |
||
---|---|---|
.. | ||
blender | ||
creator | ||
CMakeLists.txt |