From c2110213ca7a6b8ba2392cf6e8f5a61b7ba4b554 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 25 Jun 2018 14:21:15 +0200 Subject: Physics: update softbody and dynamic paint to get colliders from depsgraph. Because looping over the scene is unsafe and slow. --- source/blender/depsgraph/intern/depsgraph_physics.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'source/blender/depsgraph/intern/depsgraph_physics.cc') diff --git a/source/blender/depsgraph/intern/depsgraph_physics.cc b/source/blender/depsgraph/intern/depsgraph_physics.cc index 2745a6c8722..925a3497e22 100644 --- a/source/blender/depsgraph/intern/depsgraph_physics.cc +++ b/source/blender/depsgraph/intern/depsgraph_physics.cc @@ -40,10 +40,12 @@ extern "C" { } /* extern "C" */ #include "DNA_group_types.h" +#include "DNA_object_types.h" #include "DNA_object_force_types.h" #include "DEG_depsgraph_build.h" #include "DEG_depsgraph_physics.h" +#include "DEG_depsgraph_query.h" #include "depsgraph.h" #include "depsgraph_intern.h" @@ -73,7 +75,8 @@ ListBase *DEG_get_effector_relations(const Depsgraph *graph, return NULL; } - return (ListBase *)BLI_ghash_lookup(deg_graph->physics_relations[DEG_PHYSICS_EFFECTOR], collection); + ID *collection_orig = DEG_get_original_id(&collection->id); + return (ListBase *)BLI_ghash_lookup(deg_graph->physics_relations[DEG_PHYSICS_EFFECTOR], collection_orig); } ListBase *DEG_get_collision_relations(const Depsgraph *graph, @@ -86,7 +89,8 @@ ListBase *DEG_get_collision_relations(const Depsgraph *graph, return NULL; } - return (ListBase *)BLI_ghash_lookup(deg_graph->physics_relations[type], collection); + ID *collection_orig = DEG_get_original_id(&collection->id); + return (ListBase *)BLI_ghash_lookup(deg_graph->physics_relations[type], collection_orig); } /********************** Depsgraph Building API ************************/ @@ -174,7 +178,7 @@ ListBase *deg_build_effector_relations(Depsgraph *graph, if (relations == NULL) { ::Depsgraph *depsgraph = reinterpret_cast<::Depsgraph*>(graph); relations = BKE_effector_relations_create(depsgraph, graph->view_layer, collection); - BLI_ghash_insert(hash, collection, relations); + BLI_ghash_insert(hash, &collection->id, relations); } return relations; @@ -195,7 +199,7 @@ ListBase *deg_build_collision_relations(Depsgraph *graph, if (relations == NULL) { ::Depsgraph *depsgraph = reinterpret_cast<::Depsgraph*>(graph); relations = BKE_collision_relations_create(depsgraph, collection, modifier_type); - BLI_ghash_insert(hash, collection, relations); + BLI_ghash_insert(hash, &collection->id, relations); } return relations; -- cgit v1.2.3