diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-25 15:21:15 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-25 18:15:07 +0300 |
commit | c2110213ca7a6b8ba2392cf6e8f5a61b7ba4b554 (patch) | |
tree | dfdf68849767fc5f04dda17b0b8db5c97b3e7e07 /source/blender/depsgraph/intern/depsgraph_physics.cc | |
parent | 2c9b32949bc00e73603bcabadb74e5b3176a161a (diff) |
Physics: update softbody and dynamic paint to get colliders from depsgraph.
Because looping over the scene is unsafe and slow.
Diffstat (limited to 'source/blender/depsgraph/intern/depsgraph_physics.cc')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_physics.cc | 12 |
1 files changed, 8 insertions, 4 deletions
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; |