[Bf-blender-cvs] [0ca44974c97] fluid-mantaflow: Mantaflow: Fix for bake not being triggered when executed for the first time
Sebastián Barschkis
noreply at git.blender.org
Tue Nov 26 23:21:45 CET 2019
Commit: 0ca44974c97fbfd39187fb123c35037b17eaac60
Author: Sebastián Barschkis
Date: Tue Nov 26 23:21:36 2019 +0100
Branches: fluid-mantaflow
https://developer.blender.org/rB0ca44974c97fbfd39187fb123c35037b17eaac60
Mantaflow: Fix for bake not being triggered when executed for the first time
===================================================================
M source/blender/blenkernel/intern/manta.c
M source/blender/editors/physics/physics_manta.c
===================================================================
diff --git a/source/blender/blenkernel/intern/manta.c b/source/blender/blenkernel/intern/manta.c
index 1c4e9b35111..d5f8595927b 100644
--- a/source/blender/blenkernel/intern/manta.c
+++ b/source/blender/blenkernel/intern/manta.c
@@ -4167,9 +4167,9 @@ static void mantaModifier_process(
if (!baking_data && !baking_noise && !baking_mesh && !baking_particles) {
read_cache = true;
bake_cache = false;
- break;
}
- case FLUID_DOMAIN_CACHE_MODULAR: {
+ break;
+ case FLUID_DOMAIN_CACHE_MODULAR:
/* Just load the data that has already been baked */
if (!baking_data && !baking_noise && !baking_mesh && !baking_particles) {
read_cache = true;
@@ -4203,7 +4203,6 @@ static void mantaModifier_process(
/* Force to read cache as we're resuming the bake */
read_cache = true;
break;
- }
case FLUID_DOMAIN_CACHE_REPLAY:
default:
/* Always trying to read the cache in replay mode. */
@@ -4211,8 +4210,10 @@ static void mantaModifier_process(
break;
}
- /* Cache outdated? If so reset, don't read, and then just rebake. */
- if (bake_outdated) {
+ /* Cache outdated? If so reset, don't read, and then just rebake.
+ * Note: Only do this in replay mode! */
+ bool mode_replay = (mode == FLUID_DOMAIN_CACHE_REPLAY);
+ if (bake_outdated && mode_replay) {
read_cache = false;
bake_cache = true;
BKE_manta_cache_free(mds, ob, mds->cache_flag);
diff --git a/source/blender/editors/physics/physics_manta.c b/source/blender/editors/physics/physics_manta.c
index d1d29be2362..a514d0405fd 100644
--- a/source/blender/editors/physics/physics_manta.c
+++ b/source/blender/editors/physics/physics_manta.c
@@ -324,7 +324,7 @@ static void manta_bake_startjob(void *customdata, short *stop, short *do_update,
tmpDir[0] = '\0';
BLI_path_join(tmpDir, sizeof(tmpDir), mds->cache_directory, FLUID_DOMAIN_DIR_NOISE, NULL);
BLI_dir_create_recursive(tmpDir); /* Create 'noise' subdir if it does not exist already */
- mds->cache_flag &= ~FLUID_DOMAIN_BAKED_NOISE;
+ mds->cache_flag &= ~(FLUID_DOMAIN_BAKED_NOISE | FLUID_DOMAIN_OUTDATED_NOISE);
mds->cache_flag |= FLUID_DOMAIN_BAKING_NOISE;
job->pause_frame = &mds->cache_frame_pause_noise;
}
@@ -332,7 +332,7 @@ static void manta_bake_startjob(void *customdata, short *stop, short *do_update,
tmpDir[0] = '\0';
BLI_path_join(tmpDir, sizeof(tmpDir), mds->cache_directory, FLUID_DOMAIN_DIR_MESH, NULL);
BLI_dir_create_recursive(tmpDir); /* Create 'mesh' subdir if it does not exist already */
- mds->cache_flag &= ~FLUID_DOMAIN_BAKED_MESH;
+ mds->cache_flag &= ~(FLUID_DOMAIN_BAKED_MESH | FLUID_DOMAIN_OUTDATED_MESH);
mds->cache_flag |= FLUID_DOMAIN_BAKING_MESH;
job->pause_frame = &mds->cache_frame_pause_mesh;
}
@@ -340,7 +340,7 @@ static void manta_bake_startjob(void *customdata, short *stop, short *do_update,
tmpDir[0] = '\0';
BLI_path_join(tmpDir, sizeof(tmpDir), mds->cache_directory, FLUID_DOMAIN_DIR_PARTICLES, NULL);
BLI_dir_create_recursive(tmpDir); /* Create 'particles' subdir if it does not exist already */
- mds->cache_flag &= ~FLUID_DOMAIN_BAKED_PARTICLES;
+ mds->cache_flag &= ~(FLUID_DOMAIN_BAKED_PARTICLES | FLUID_DOMAIN_OUTDATED_PARTICLES);
mds->cache_flag |= FLUID_DOMAIN_BAKING_PARTICLES;
job->pause_frame = &mds->cache_frame_pause_particles;
}
@@ -348,7 +348,7 @@ static void manta_bake_startjob(void *customdata, short *stop, short *do_update,
tmpDir[0] = '\0';
BLI_path_join(tmpDir, sizeof(tmpDir), mds->cache_directory, FLUID_DOMAIN_DIR_GUIDING, NULL);
BLI_dir_create_recursive(tmpDir); /* Create 'guiding' subdir if it does not exist already */
- mds->cache_flag &= ~FLUID_DOMAIN_BAKED_GUIDING;
+ mds->cache_flag &= ~(FLUID_DOMAIN_BAKED_GUIDING | FLUID_DOMAIN_OUTDATED_GUIDING);
mds->cache_flag |= FLUID_DOMAIN_BAKING_GUIDING;
job->pause_frame = &mds->cache_frame_pause_guiding;
}
@@ -359,7 +359,7 @@ static void manta_bake_startjob(void *customdata, short *stop, short *do_update,
tmpDir[0] = '\0';
BLI_path_join(tmpDir, sizeof(tmpDir), mds->cache_directory, FLUID_DOMAIN_DIR_DATA, NULL);
BLI_dir_create_recursive(tmpDir); /* Create 'data' subdir if it does not exist already */
- mds->cache_flag &= ~FLUID_DOMAIN_BAKED_DATA;
+ mds->cache_flag &= ~(FLUID_DOMAIN_BAKED_DATA | FLUID_DOMAIN_OUTDATED_DATA);
mds->cache_flag |= FLUID_DOMAIN_BAKING_DATA;
job->pause_frame = &mds->cache_frame_pause_data;
@@ -444,8 +444,6 @@ static void manta_free_startjob(void *customdata, short *stop, short *do_update,
cache_map |= FLUID_DOMAIN_OUTDATED_GUIDING;
}
BKE_manta_cache_free(mds, job->ob, cache_map);
- /* TODO (sebbas): Really need this update call ?? */
- DEG_id_tag_update(&job->ob->id, ID_RECALC_GEOMETRY);
*do_update = true;
*stop = 0;
More information about the Bf-blender-cvs
mailing list