Fix #157854: Fluid domain mesh missing in F12 render

Fix #157854: Fluid domain mesh missing in F12 render

## Problem

Baked Mantaflow meshes are visible in the viewport but missing during F12 render.

## Cause

During render evaluation (`DAG_EVAL_RENDER`), the depsgraph builds a fresh context. In `fluid_modifier_processDomain`, cache reading (`manta_read_mesh`, etc.) was attempted before the fluid object was reallocated to match the cached configuration.

When `manta_needs_realloc` returned true, cache reading was skipped, causing a fallback to the domain bounding box instead of the baked mesh.

## Solution

Move `BKE_fluid_reallocate_fluid` to the start of the `if (read_cache)` block so the fluid object is always correctly allocated before reading cache data.

This ensures cache loading works correctly during render evaluation.
![Screenshot 2026-04-28 at 01.15.00.png](/attachments/278e44ff-fd18-4ee6-a2af-54703efb73ce)

Fixes #157854

Pull Request: https://projects.blender.org/blender/blender/pulls/157898
This commit is contained in:
Tibo Stans 2026-04-28 12:40:54 +02:00 • committed by Sebastian Parborg
parent f508fa2671
commit 87d48ea687

View file

@ -3888,6 +3888,11 @@ static void fluid_modifier_processDomain(FluidModifierData *fmd,
/* Try to read from cache and keep track of read success. */
if (read_cache) {
/* Reallocate fluid object to match cached config before reading mesh/particles. */
if (has_config && manta_needs_realloc(fds->fluid, fmd)) {
BKE_fluid_reallocate_fluid(fds, fds->res, 1);
}
/* Read mesh cache. */
if (with_liquid && with_mesh) {
if (mesh_frame != scene_framenr) {
@ -3944,13 +3949,6 @@ static void fluid_modifier_processDomain(FluidModifierData *fmd,
has_config = manta_read_config(fds->fluid, fmd, data_frame);
}
if (with_smoke || with_liquid) {
/* Read config and realloc fluid object if needed. */
if (has_config && manta_needs_realloc(fds->fluid, fmd)) {
BKE_fluid_reallocate_fluid(fds, fds->res, 1);
}
}
read_partial = !baking_data && !baking_particles && !baking_mesh && next_data &&
!grid_display;
read_all = !read_partial && with_resumable_cache;