diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-03-08 17:01:31 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-03-08 17:01:31 +0300 |
commit | 9e0921497912cbfe9846358d1cb1220f88315f80 (patch) | |
tree | 093e2de27514b297de63ce6ea1597401507622ab /source/blender/blenkernel/intern/lib_id.c | |
parent | cfd11af9819433c5b83359b72f002fcd59fdc1ab (diff) |
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
Diffstat (limited to 'source/blender/blenkernel/intern/lib_id.c')
-rw-r--r-- | source/blender/blenkernel/intern/lib_id.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index a511c1f9c4c..f3a1c01ad26 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -1139,6 +1139,7 @@ static uint global_session_uuid = 0; void BKE_lib_libblock_session_uuid_ensure(ID *id) { if (id->session_uuid == MAIN_ID_SESSION_UUID_UNSET) { + BLI_assert((id->tag & LIB_TAG_TEMP_MAIN) == 0); /* Caller must ensure this. */ id->session_uuid = atomic_add_and_fetch_uint32(&global_session_uuid, 1); /* In case overflow happens, still assign a valid ID. This way opening files many times works * correctly. */ |