From ead8260a49debaeb69967b2b4d2b62bf97333328 Mon Sep 17 00:00:00 2001 From: Aras Pranckevicius Date: Tue, 2 Aug 2022 21:01:09 +0300 Subject: Object: move collection resync after empty duplicate early-out As pointed out in rB02b1a209be88 comment, the BKE_main_collection_sync should be after "nothing to duplicate" early-out. --- source/blender/editors/object/object_add.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/object/object_add.cc b/source/blender/editors/object/object_add.cc index 55366348f38..acd7a8e3c13 100644 --- a/source/blender/editors/object/object_add.cc +++ b/source/blender/editors/object/object_add.cc @@ -3715,14 +3715,15 @@ static int duplicate_exec(bContext *C, wmOperator *op) } } CTX_DATA_END; - /* Sync the collection now, after everything is duplicated. */ BKE_layer_collection_resync_allow(); - BKE_main_collection_sync(bmain); if (source_bases_new_objects.is_empty()) { return OPERATOR_CANCELLED; } + /* Sync the collection now, after everything is duplicated. */ + BKE_main_collection_sync(bmain); + /* After sync we can get to the new Base data, process it here. */ for (const auto &item : source_bases_new_objects) { Object *ob_new = item.second; -- cgit v1.2.3