diff options
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/BLO_readfile.h | 2 | ||||
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index c3a1c0e5185..bff35167792 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -138,7 +138,7 @@ void BLO_library_link_end( struct Main *mainl, BlendHandle **bh, int flag, struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, const struct View3D *v3d); -void BLO_library_link_copypaste(struct Main *mainl, BlendHandle *bh); +int BLO_library_link_copypaste(struct Main *mainl, BlendHandle *bh, const unsigned int id_types_mask); void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char *blockname); 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( |