Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorSebastián Barschkis <sebbas@sebbas.org>2020-02-06 18:53:00 +0300
committerSebastián Barschkis <sebbas@sebbas.org>2020-02-06 18:53:00 +0300
commite7d71ce9cf1eb8ea73d5d77527fc65e7bd6f5d4d (patch)
tree4795d131ad4c0aa0b6fc6a4c0da77b33b50cfb92 /source
parentae112a38ab8d5b6cb7fe8e9209aa7e0e0209a6db (diff)
Fluid: Fixed slow cache loading for smoke data
Cache files are currently loaded via the Manta Python API. With very big caches this can slow down the viewport playback. Especially smoke simulations, which just load grids and no meshes, can suffer from this. This fix solves this problem by directly loading the cache files from disk (no Python). This fix has been in the works for some time. The developer of this patch is ready to handle any potential fall-out of this patch quickly.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/fluid.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c
index f35aebbae16..8b959e30aff 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -3505,10 +3505,14 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *mmd,
manta_needs_realloc(mds->fluid, mmd)) {
BKE_fluid_reallocate_fluid(mds, mds->res, 1);
}
- has_noise = manta_read_noise(mds->fluid, mmd, noise_frame);
+ if (!baking_data && !baking_noise && !mode_replay) {
+ has_data = manta_update_noise_structures(mds->fluid, mmd, noise_frame);
+ }
+ else {
+ has_noise = manta_read_noise(mds->fluid, mmd, noise_frame);
+ }
- /* In case of using the adaptive domain, copy all data that was read to a new fluid object.
- */
+ /* When using the adaptive domain, copy all data that was read to a new fluid object. */
if (with_adaptive && baking_noise) {
/* Adaptive domain needs to know about current state, so save it, then copy. */
copy_v3_v3_int(o_res, mds->res);
@@ -3521,7 +3525,13 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *mmd,
mds, o_res, mds->res, o_min, mds->res_min, o_max, o_shift, mds->shift);
}
}
- has_data = manta_read_data(mds->fluid, mmd, data_frame);
+ if (!baking_data && !baking_noise && !mode_replay) {
+ /* There is no need to call manta_update_smoke_structures() here.
+ * The noise cache has already been read with manta_update_noise_structures(). */
+ }
+ else {
+ has_data = manta_read_data(mds->fluid, mmd, data_frame);
+ }
}
/* Read data cache only */
else {
@@ -3532,7 +3542,12 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *mmd,
BKE_fluid_reallocate_fluid(mds, mds->res, 1);
}
/* Read data cache */
- has_data = manta_read_data(mds->fluid, mmd, data_frame);
+ if (!baking_data && !baking_particles && !baking_mesh && !mode_replay) {
+ has_data = manta_update_smoke_structures(mds->fluid, mmd, data_frame);
+ }
+ else {
+ has_data = manta_read_data(mds->fluid, mmd, data_frame);
+ }
}
if (with_liquid) {
if (!baking_data && !baking_particles && !baking_mesh && !mode_replay) {