Fix ID copying outside of Main affecting 'directly linked' status of other IDs.

Copying an ID outside of BMain should not assume that the datablocks it
uses are now directly linked. This would be wrong e.g. in case that new
no-main ID is copied from a linked data-block and is supposed to remain
a linked data.
This commit is contained in:
Bastien Montagne 2021-05-18 18:42:29 +02:00
parent 3826c161ad
commit a881b5272b
1 changed files with 7 additions and 1 deletions

View File

@ -525,7 +525,13 @@ static int id_copy_libmanagement_cb(LibraryIDLinkCallbackData *cb_data)
/* Increase used IDs refcount if needed and required. */
if ((data->flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0 && (cb_flag & IDWALK_CB_USER)) {
id_us_plus(id);
if ((data->flag & LIB_ID_CREATE_NO_MAIN) != 0) {
BLI_assert(cb_data->id_self->tag & LIB_TAG_NO_MAIN);
id_us_plus_no_lib(id);
}
else {
id_us_plus(id);
}
}
return IDWALK_RET_NOP;