diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-21 20:45:39 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-22 18:57:22 +0300 |
commit | cc4dc2dce26c724e27598e4a1878e00fdf30dcf2 (patch) | |
tree | 0ccf3d58e17666a24f9b0b6325666d0453b55645 /source/blender/blenkernel/intern/smoke.c | |
parent | 79615c5adb46ffaa84d17b548074cec83d1071bb (diff) |
Depsgraph: cache effector relations, for performance and stability.
To find all effectors in the scene, we need to loop over all objects.
Doing this during depsgraph evaluation caused crashes because not all
objects are guaranteed to be evaluated yet.
To fix this, we now cache the relations as part of the dependency graph
build. As a bonus this also makes evaluation faster for big scenes,
since looping over all objects for each particle system is slow.
Fixes T55156.
Diffstat (limited to 'source/blender/blenkernel/intern/smoke.c')
-rw-r--r-- | source/blender/blenkernel/intern/smoke.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index 6bdce647bd9..5ba9b7ce4dc 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -2512,7 +2512,7 @@ static void update_effectors_task_cb( mul_m4_v3(sds->obmat, voxelCenter); pd_point_from_loc(data->scene, voxelCenter, vel, index, &epoint); - pdDoEffectors(data->effectors, NULL, sds->effector_weights, &epoint, retvel, NULL); + BKE_effectors_apply(data->effectors, NULL, sds->effector_weights, &epoint, retvel, NULL); /* convert retvel to local space */ mag = len_v3(retvel); @@ -2533,7 +2533,7 @@ static void update_effectors(struct Depsgraph *depsgraph, Scene *scene, Object * ListBase *effectors; /* make sure smoke flow influence is 0.0f */ sds->effector_weights->weight[PFIELD_SMOKEFLOW] = 0.0f; - effectors = pdInitEffectors(depsgraph, scene, ob, NULL, sds->effector_weights, true); + effectors = BKE_effectors_create(depsgraph, scene, ob, NULL, sds->effector_weights); if (effectors) { // precalculate wind forces @@ -2560,7 +2560,7 @@ static void update_effectors(struct Depsgraph *depsgraph, Scene *scene, Object * &settings); } - pdEndEffectors(&effectors); + BKE_effectors_free(effectors); } static void step( |