Fix T87189: Copy/pasting IDs does not handle properly instantiation.

Copy/Paste uses its own code path for ID linking, which was not setting
`LIB_TAG_DOIT` for proper instantiation later on.

Would be nice the make this logic closer to the rest of the link/append
code at some point, but for now this fix will do.
This commit is contained in:
Bastien Montagne 2021-10-01 12:18:56 +02:00
parent 21c29480c3
commit 798e593002
Notes: blender-bot 2023-02-13 23:39:48 +01:00
Referenced by issue #87189, Copy/pasting objects used in modifiers (or objects in collections used in modifiers) are not linked to the scene
1 changed files with 7 additions and 0 deletions

View File

@ -4788,6 +4788,13 @@ int BLO_library_link_copypaste(Main *mainl, BlendHandle *bh, const uint64_t id_t
ListBase *lb = which_libbase(mainl, GS(id->name));
id_sort_by_name(lb, id, NULL);
/* Tag as loose object (or data associated with objects)
* needing to be instantiated (see also #link_named_part and its usage of
* #BLO_LIBLINK_NEEDS_ID_TAG_DOIT above). */
if (library_link_idcode_needs_tag_check(GS(id->name), BLO_LIBLINK_NEEDS_ID_TAG_DOIT)) {
id->tag |= LIB_TAG_DOIT;
}
if (bhead->code == ID_OB) {
/* Instead of instancing Base's directly, postpone until after collections are loaded
* otherwise the base's flag is set incorrectly when collections are used */