From 46913bf0a08c7e9ae5525ff95af0c7dc3b2f622f Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 24 Aug 2021 12:23:39 +0200 Subject: Fix T90840: Can't duplicate or copy (Ctrl-C) object from linked file. We need to separate the flag telling duplicate code to not handle remapping to new IDs etc., from the one telling the code that we are currently duplicating a 'root' ID (i.e. not a dependency of another duplicated ID). This whole duplicate code/logic is still fairly unsatisfying, think it will need further refactor, or maybe even re-design, at some point... --- source/blender/blenkernel/intern/collection.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/blender/blenkernel/intern/collection.c') diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index d36e9b67d00..2d172f23428 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -692,14 +692,18 @@ Collection *BKE_collection_duplicate(Main *bmain, eLibIDDuplicateFlags duplicate_options) { const bool is_subprocess = (duplicate_options & LIB_ID_DUPLICATE_IS_SUBPROCESS) != 0; + const bool is_root_id = (duplicate_options & LIB_ID_DUPLICATE_IS_ROOT_ID) != 0; if (!is_subprocess) { BKE_main_id_newptr_and_tag_clear(bmain); + } + if (is_root_id) { /* In case root duplicated ID is linked, assume we want to get a local copy of it and duplicate * all expected linked data. */ if (ID_IS_LINKED(collection)) { duplicate_flags |= USER_DUP_LINKED_ID; } + duplicate_options &= ~LIB_ID_DUPLICATE_IS_ROOT_ID; } Collection *collection_new = collection_duplicate_recursive( -- cgit v1.2.3