PyAPI: add bpy.types.BlendFile.temp_data for temporary library loading

This adds support for creating a `BlendFile` (internally called `Main`),
which is limited to a context.

Temporary data can now be created which can then use
`.libraries.load()` the same as with `bpy.data`.

To prevent errors caused by mixing the temporary ID's with data in
`bpy.data` they are tagged as temporary so they can't be assigned
to properties, however they can be passed as arguments to functions.

Reviewed By: mont29, sybren

Ref D10612
This commit is contained in:
2021-03-09 01:01:31 +11:00
parent cfd11af981
commit 9e09214979
11 changed files with 306 additions and 7 deletions

View File

@@ -44,6 +44,7 @@
#include "bpy_operator.h"
#include "bpy_props.h"
#include "bpy_rna.h"
#include "bpy_rna_data.h"
#include "bpy_rna_gizmo.h"
#include "bpy_rna_id_collection.h"
#include "bpy_rna_types_capi.h"
@@ -425,6 +426,8 @@ void BPy_init_modules(struct bContext *C)
/* needs to be first so bpy_types can run */
BPY_library_load_type_ready();
BPY_rna_data_context_type_ready();
BPY_rna_gizmo_module(mod);
bpy_import_test("bpy_types");