From ae124242987f687c792c5771ca262ceed49c597e Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 15 Jan 2018 18:27:50 -0200 Subject: [PATCH] Outliner/Collections: Fix objects disappearing when moving to collections Bug introduced on fb4cd136a7c (multi-object drag-and-drop). How to reproduce the bug: * Create a new collection * Move the Cube to the new collection * Move the Camera to the new collection (Cube disappears) * Move the Lamp to the new collection (Camera disappears) Explanation of the bug: The moved object was still selected, so we were trying to add the object to the collection were the object was already inserted (which would fail silently) and then remove it. --- source/blender/blenkernel/intern/collection.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 4830e9456cd..6846683fe13 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -412,8 +412,9 @@ bool BKE_collection_object_remove(Main *bmain, ID *owner_id, SceneCollection *sc */ void BKE_collection_object_move(ID *owner_id, SceneCollection *sc_dst, SceneCollection *sc_src, Object *ob) { - BKE_collection_object_add(owner_id, sc_dst, ob); - BKE_collection_object_remove(NULL, owner_id, sc_src, ob, false); + if (BKE_collection_object_add(owner_id, sc_dst, ob)) { + BKE_collection_object_remove(NULL, owner_id, sc_src, ob, false); + } } /**