Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-06-25 15:07:14 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-06-25 15:11:55 +0300
commit38d6e82d1a666c317118a5ebfda39e4a67639e1a (patch)
tree2cec82b4d04364f44439138e913a7deb31f21e4d /source/blender/blenkernel/intern/collision.c
parent817bf582c27d6aa2d19027bb97ed3f708cf6347c (diff)
Fix use of non-evaluated collision and effector objects.
Only enabled objects in the view layer should be used, while temporarily hidden objects should still have an effect.
Diffstat (limited to 'source/blender/blenkernel/intern/collision.c')
-rw-r--r--source/blender/blenkernel/intern/collision.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/collision.c b/source/blender/blenkernel/intern/collision.c
index 19c170acf75..546f37dbee6 100644
--- a/source/blender/blenkernel/intern/collision.c
+++ b/source/blender/blenkernel/intern/collision.c
@@ -517,27 +517,16 @@ static void add_collision_object(ListBase *relations, Object *ob, int level, uns
* lookup of colliders during evaluation. */
ListBase *BKE_collision_relations_create(Depsgraph *depsgraph, Collection *collection, unsigned int modifier_type)
{
+ ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
+ Base *base = BKE_collection_or_layer_objects(NULL, NULL, view_layer, collection);
+ const bool for_render = (DEG_get_mode(depsgraph) == DAG_EVAL_RENDER);
+ const int base_flag = (for_render) ? BASE_ENABLED_RENDER : BASE_ENABLED_VIEWPORT;
+
ListBase *relations = MEM_callocN(sizeof(ListBase), "CollisionRelation list");
- int level = 0;
- /* gather all collision objects */
- if (collection) {
- /* use specified collection */
- FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(collection, object)
- {
- add_collision_object(relations, object, level, modifier_type);
- }
- FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
- }
- else {
- Scene *scene = DEG_get_input_scene(depsgraph);
- Scene *sce_iter;
- Base *base;
- /* add objects in same layer in scene */
- for (SETLOOPER(scene, sce_iter, base)) {
- if ((base->flag & BASE_VISIBLE) != 0) {
- add_collision_object(relations, base->object, level, modifier_type);
- }
+ for (; base; base = base->next) {
+ if (base->flag & base_flag) {
+ add_collision_object(relations, base->object, 0, modifier_type);
}
}