diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-01-15 23:27:50 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-01-15 23:27:50 +0300 |
commit | ae124242987f687c792c5771ca262ceed49c597e (patch) | |
tree | ff2b582eef1b9733070187b32e69a174ad9245a4 /source/blender/blenkernel/intern/collection.c | |
parent | b810e9ffc4bb03bdf7773b4311ac841b00af80d1 (diff) |
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.
Diffstat (limited to 'source/blender/blenkernel/intern/collection.c')
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 5 |
1 files 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); + } } /** |