Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-03-08 17:01:31 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-03-08 17:01:31 +0300
commit9e0921497912cbfe9846358d1cb1220f88315f80 (patch)
tree093e2de27514b297de63ce6ea1597401507622ab /source/blender/python/intern/bpy_rna_types_capi.c
parentcfd11af9819433c5b83359b72f002fcd59fdc1ab (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/python/intern/bpy_rna_types_capi.c')
-rw-r--r--source/blender/python/intern/bpy_rna_types_capi.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/python/intern/bpy_rna_types_capi.c b/source/blender/python/intern/bpy_rna_types_capi.c
index 042f7b6fd67..9b15e84663d 100644
--- a/source/blender/python/intern/bpy_rna_types_capi.c
+++ b/source/blender/python/intern/bpy_rna_types_capi.c
@@ -36,6 +36,7 @@
#include "bpy_library.h"
#include "bpy_rna.h"
#include "bpy_rna_callback.h"
+#include "bpy_rna_data.h"
#include "bpy_rna_id_collection.h"
#include "bpy_rna_types_capi.h"
#include "bpy_rna_ui.h"
@@ -56,6 +57,7 @@ static struct PyMethodDef pyrna_blenddata_methods[] = {
{NULL, NULL, 0, NULL}, /* #BPY_rna_id_collection_user_map_method_def */
{NULL, NULL, 0, NULL}, /* #BPY_rna_id_collection_batch_remove_method_def */
{NULL, NULL, 0, NULL}, /* #BPY_rna_id_collection_orphans_purge_method_def */
+ {NULL, NULL, 0, NULL}, /* #BPY_rna_data_context_method_def */
{NULL, NULL, 0, NULL},
};
@@ -207,8 +209,9 @@ void BPY_rna_types_extend_capi(void)
ARRAY_SET_ITEMS(pyrna_blenddata_methods,
BPY_rna_id_collection_user_map_method_def,
BPY_rna_id_collection_batch_remove_method_def,
- BPY_rna_id_collection_orphans_purge_method_def);
- BLI_assert(ARRAY_SIZE(pyrna_blenddata_methods) == 4);
+ BPY_rna_id_collection_orphans_purge_method_def,
+ BPY_rna_data_context_method_def);
+ BLI_assert(ARRAY_SIZE(pyrna_blenddata_methods) == 5);
pyrna_struct_type_extend_capi(&RNA_BlendData, pyrna_blenddata_methods, NULL);
/* BlendDataLibraries */