Fix T76097: Simulations don't take animated gravity into account

Together with 21485e94aa this commit should fix the issue with animated gravity values.
This commit is contained in:
Sebastián Barschkis 2020-04-30 18:08:52 +02:00
parent 4612ca3ede
commit 31d3f034ab
Notes: blender-bot 2023-02-14 00:37:17 +01:00
Referenced by issue #76097, Simulations don't take animated gravity into account
1 changed files with 6 additions and 0 deletions

View File

@ -3772,6 +3772,12 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *mmd,
/* Get distance between cache start and current frame for total time. */
mds->time_total = abs(scene_framenr - mds->cache_frame_start) * mds->frame_length;
/* Ensure that gravity is copied over every frame (could be keyframed). */
if (scene->physics_settings.flag & PHYS_GLOBAL_GRAVITY) {
copy_v3_v3(mds->gravity, scene->physics_settings.gravity);
mul_v3_fl(mds->gravity, mds->effector_weights->global_gravity);
}
int next_frame = scene_framenr + 1;
int prev_frame = scene_framenr - 1;
/* Ensure positivity of previous frame. */