Fluid: Disable subframes when using adaptive time-steps in the first frame

First frame should only produce inflow once and not compute the emission for the frame before the first frame. Problem became evident in T74062.
This commit is contained in:
Sebastián Barschkis 2020-04-08 13:42:40 +02:00
parent c2cb87f897
commit ff2c67d7e8
Notes: blender-bot 2023-02-14 06:55:40 +01:00
Referenced by issue #74062, Mantaflow Gas domain: 'use adaptive time steps' doesn't seem to adapt.
1 changed files with 4 additions and 2 deletions

View File

@ -1250,7 +1250,8 @@ static void update_obstacles(Depsgraph *depsgraph,
/* Set scene time */
/* Handle emission subframe */
if (subframe < subframes || time_per_frame + dt + FLT_EPSILON < frame_length) {
if ((subframe < subframes || time_per_frame + dt + FLT_EPSILON < frame_length) &&
!is_first_frame) {
scene->r.subframe = (time_per_frame + (subframe + 1.0f) * subframe_dt) / frame_length;
scene->r.cfra = frame - 1;
}
@ -2763,7 +2764,8 @@ static void update_flowsfluids(struct Depsgraph *depsgraph,
FluidObjectBB bb_temp = {NULL};
/* Set scene time */
if (subframe < subframes || time_per_frame + dt + FLT_EPSILON < frame_length) {
if ((subframe < subframes || time_per_frame + dt + FLT_EPSILON < frame_length) &&
!is_first_frame) {
scene->r.subframe = (time_per_frame + (subframe + 1.0f) * subframe_dt) / frame_length;
scene->r.cfra = frame - 1;
}