diff options
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 6a0ec8cc2cb..3c5a0f136ba 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -11019,21 +11019,25 @@ static ID *link_named_part( /** * Simple reader for copy/paste buffers. */ -void BLO_library_link_copypaste(Main *mainl, BlendHandle *bh) +int BLO_library_link_copypaste(Main *mainl, BlendHandle *bh, const unsigned int id_types_mask) { FileData *fd = (FileData *)(bh); BHead *bhead; + int num_directly_linked = 0; for (bhead = blo_bhead_first(fd); bhead; bhead = blo_bhead_next(fd, bhead)) { ID *id = NULL; if (bhead->code == ENDB) break; - if (ELEM(bhead->code, ID_OB, ID_GR)) { + + if (BKE_idcode_is_valid(bhead->code) && BKE_idcode_is_linkable(bhead->code) && + (id_types_mask == 0 || (BKE_idcode_to_idfilter((short)bhead->code) & id_types_mask) != 0)) + { read_libblock(fd, mainl, bhead, LIB_TAG_NEED_EXPAND | LIB_TAG_INDIRECT, &id); + num_directly_linked++; } - if (id) { /* sort by name in list */ ListBase *lb = which_libbase(mainl, GS(id->name)); @@ -11049,6 +11053,8 @@ void BLO_library_link_copypaste(Main *mainl, BlendHandle *bh) } } } + + return num_directly_linked; } static ID *link_named_part_ex( |