[Bf-blender-cvs] [ae124242987] blender2.8: Outliner/Collections: Fix objects disappearing when moving to collections

Dalai Felinto noreply at git.blender.org
Mon Jan 15 22:09:00 CET 2018


Commit: ae124242987f687c792c5771ca262ceed49c597e
Author: Dalai Felinto
Date:   Mon Jan 15 18:27:50 2018 -0200
Branches: blender2.8
https://developer.blender.org/rBae124242987f687c792c5771ca262ceed49c597e

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.

===================================================================

M	source/blender/blenkernel/intern/collection.c

===================================================================

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);
+	}
 }
 
 /**



More information about the Bf-blender-cvs mailing list