diff options
author | Bastien Montagne <bastien@blender.org> | 2021-09-17 17:22:29 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2021-09-22 17:55:39 +0300 |
commit | 794c2828af60af02a38381c2a9a81f9046381074 (patch) | |
tree | 3c2c5c595c1c7e7f8a31598aa149ff6a4333b54c /source/blender/blenloader | |
parent | 707bcd5693aedc0c1a461bbb0ce88680e32de561 (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/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 15653264211..3cda1e613f8 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2195,6 +2195,13 @@ static void direct_link_id_common( /* Initialize with provided tag. */ id->tag = tag; + if (ID_IS_LINKED(id)) { + id->library_weak_reference = NULL; + } + else { + BLO_read_data_address(reader, &id->library_weak_reference); + } + if (tag & LIB_TAG_ID_LINK_PLACEHOLDER) { /* For placeholder we only need to set the tag and properly initialize generic ID fields above, * no further data to read. */ |