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:
authorBastien Montagne <bastien@blender.org>2021-09-17 17:22:29 +0300
committerBastien Montagne <bastien@blender.org>2021-09-22 17:55:39 +0300
commit794c2828af60af02a38381c2a9a81f9046381074 (patch)
tree3c2c5c595c1c7e7f8a31598aa149ff6a4333b54c /source/blender/blenkernel/BKE_main.h
parent707bcd5693aedc0c1a461bbb0ce88680e32de561 (diff)
Initial implementation of local ID re-use when appending.
This commit adds to ID struct a new optional 'weak reference' to a linked ID (in the form of a blend file library path and full ID name). This can then be used on next append to try to find a matching local ID instead of re-making the linked data local again. Ref. T90545 NOTE: ID re-use will be disabled for regular append for the time being (3.0 release), and only used for assets. Therefore, this commit should not change anything user-wise. Differential Revision: https://developer.blender.org/D12545
Diffstat (limited to 'source/blender/blenkernel/BKE_main.h')
-rw-r--r--source/blender/blenkernel/BKE_main.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h
index ae60a5563b5..93d5b5c5aa6 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -212,6 +212,32 @@ void BKE_main_relations_tag_set(struct Main *bmain,
struct GSet *BKE_main_gset_create(struct Main *bmain, struct GSet *gset);
+/*
+ * Temporary runtime API to allow re-using local (already appended) IDs instead of appending a new
+ * copy again.
+ */
+
+struct GHash *BKE_main_library_weak_reference_create(struct Main *bmain) ATTR_NONNULL();
+void BKE_main_library_weak_reference_destroy(struct GHash *library_weak_reference_mapping)
+ ATTR_NONNULL();
+struct ID *BKE_main_library_weak_reference_search_item(
+ struct GHash *library_weak_reference_mapping,
+ const char *library_filepath,
+ const char *library_id_name) ATTR_NONNULL();
+void BKE_main_library_weak_reference_add_item(struct GHash *library_weak_reference_mapping,
+ const char *library_filepath,
+ const char *library_id_name,
+ struct ID *new_id) ATTR_NONNULL();
+void BKE_main_library_weak_reference_update_item(struct GHash *library_weak_reference_mapping,
+ const char *library_filepath,
+ const char *library_id_name,
+ struct ID *old_id,
+ struct ID *new_id) ATTR_NONNULL();
+void BKE_main_library_weak_reference_remove_item(struct GHash *library_weak_reference_mapping,
+ const char *library_filepath,
+ const char *library_id_name,
+ struct ID *old_id) ATTR_NONNULL();
+
/* *** Generic utils to loop over whole Main database. *** */
#define FOREACH_MAIN_LISTBASE_ID_BEGIN(_lb, _id) \