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
path: root/source
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2021-12-02 13:16:22 +0300
committerJulian Eisel <julian@blender.org>2021-12-02 13:18:27 +0300
commit67c490daafd9642f91c2ca7a93482e3176e4c70c (patch)
treeb23490aa13da10668dcdb0189d6261a992308c6a /source
parent68e37552099231ff2b1beb6c7135dfa7fcc418e9 (diff)
Fix T93548: Appended (material) assets don't have a fake user
Since our design is to always keep data-blocks marked as assets on exit, and our technical design for this is to do this via fake users, ensure the fake user is set for an appended asset. Reviewed by: Bastien Montagne Differential Revision: https://developer.blender.org/D13443
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/lib_id.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c
index cd5b266eb75..cfc3502e2cd 100644
--- a/source/blender/blenkernel/intern/lib_id.c
+++ b/source/blender/blenkernel/intern/lib_id.c
@@ -179,8 +179,14 @@ void BKE_lib_id_clear_library_data(Main *bmain, ID *id, const int flags)
BKE_lib_libblock_session_uuid_renew(id);
}
- if ((flags & LIB_ID_MAKELOCAL_ASSET_DATA_CLEAR) != 0 && id->asset_data != NULL) {
- BKE_asset_metadata_free(&id->asset_data);
+ if (ID_IS_ASSET(id)) {
+ if ((flags & LIB_ID_MAKELOCAL_ASSET_DATA_CLEAR) != 0) {
+ BKE_asset_metadata_free(&id->asset_data);
+ }
+ else {
+ /* Assets should always have a fake user. Ensure this is the case after "Make Local". */
+ id_fake_user_set(id);
+ }
}
/* We need to tag this IDs and all of its users, conceptually new local ID and original linked