diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2019-06-17 17:07:19 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2019-06-17 17:10:18 +0300 |
commit | e0b8dccd623a39fe0bcc351484483932fde9d310 (patch) | |
tree | a115d6c17a609c8126a743f78da56c0c54a50610 /source/blender/blenkernel/intern/collection.c | |
parent | b46c21364ada2c1559524e57a136a031c937ce0a (diff) |
Fix T65674: Rigid bodies in duplicated collections are not automatically added to Rigid Body World.
As title says, we need to add back new copies of objects that are RB
items to the RBW collections...
Diffstat (limited to 'source/blender/blenkernel/intern/collection.c')
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 88ec4f8793f..5b718909601 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -43,6 +43,7 @@ #include "DNA_collection_types.h" #include "DNA_layer_types.h" #include "DNA_object_types.h" +#include "DNA_rigidbody_types.h" #include "DNA_scene_types.h" #include "DEG_depsgraph.h" @@ -286,6 +287,16 @@ static Collection *collection_duplicate_recursive(Main *bmain, collection_object_add(bmain, collection_new, ob_new, 0, true); collection_object_remove(bmain, collection_new, ob_old, false); + + if (ob_new->rigidbody_object != NULL) { + BLI_assert(ob_old->rigidbody_object != NULL); + for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) { + if (scene->rigidbody_world != NULL && + BKE_collection_has_object(scene->rigidbody_world->group, ob_old)) { + collection_object_add(bmain, scene->rigidbody_world->group, ob_new, 0, true); + } + } + } } } |