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-09 19:15:41 +0300
committerSebastián Barschkis <sebbas@sebbas.org>2020-02-09 19:15:41 +0300
commit86e24ea10cba05dcb48eccc026530edab14dfe01 (patch)
tree331f16e5e6afa766f7af825021c4c006cfe40a18 /source
parent4a08eb0707fc17e4e97430ffa33eb7d3e36db712 (diff)
Fluid: Fixes for fluid guiding
Fluid guiding functionality was broken in the bake / read cache loop in fluid.c. Committing this to the release branch as otherwise fluid guiding would not have worked as expected (i.e. not at all).
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/fluid.c27
-rw-r--r--source/blender/editors/physics/physics_fluid.c4
2 files changed, 16 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c
index ac6ed6b9949..3de1902db6e 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -3239,7 +3239,6 @@ static void manta_guiding(
FluidDomainSettings *mds = mmd->domain;
float fps = scene->r.frs_sec / scene->r.frs_sec_base;
float dt = DT_DEFAULT * (25.0f / fps) * mds->time_scale;
- ;
BLI_mutex_lock(&object_update_lock);
@@ -3325,15 +3324,6 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *mmd,
BKE_fluid_modifier_reset_ex(mmd, false);
}
- BKE_fluid_modifier_init(mmd, depsgraph, ob, scene, me);
-
- /* ensure that time parameters are initialized correctly before every step */
- float fps = scene->r.frs_sec / scene->r.frs_sec_base;
- mds->frame_length = DT_DEFAULT * (25.0f / fps) * mds->time_scale;
- mds->dt = mds->frame_length;
- mds->time_per_frame = 0;
- mds->time_total = (scene_framenr - 1) * mds->frame_length;
-
/* Guiding parent res pointer needs initialization */
guide_parent = mds->guide_parent;
if (guide_parent) {
@@ -3343,6 +3333,15 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *mmd,
}
}
+ BKE_fluid_modifier_init(mmd, depsgraph, ob, scene, me);
+
+ /* ensure that time parameters are initialized correctly before every step */
+ float fps = scene->r.frs_sec / scene->r.frs_sec_base;
+ mds->frame_length = DT_DEFAULT * (25.0f / fps) * mds->time_scale;
+ mds->dt = mds->frame_length;
+ mds->time_per_frame = 0;
+ mds->time_total = (scene_framenr - 1) * mds->frame_length;
+
objs = BKE_collision_objects_create(
depsgraph, ob, mds->fluid_group, &numobj, eModifierType_Fluid);
update_flowsflags(mds, objs, numobj);
@@ -3403,7 +3402,7 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *mmd,
resume_guide = (!is_startframe) && (mds->cache_frame_pause_guide == scene_framenr);
bool read_cache, bake_cache;
- read_cache = false, bake_cache = baking_data || baking_noise || baking_mesh || baking_particles;
+ read_cache = false, bake_cache = baking_data || baking_noise || baking_mesh || baking_particles || baking_guide;
bool with_gdomain;
with_gdomain = (mds->guide_source == FLUID_DOMAIN_GUIDE_SRC_DOMAIN);
@@ -3419,14 +3418,14 @@ static void BKE_fluid_modifier_processDomain(FluidModifierData *mmd,
switch (mode) {
case FLUID_DOMAIN_CACHE_FINAL:
/* Just load the data that has already been baked */
- if (!baking_data && !baking_noise && !baking_mesh && !baking_particles) {
+ if (!baking_data && !baking_noise && !baking_mesh && !baking_particles && !baking_guide) {
read_cache = true;
bake_cache = false;
}
break;
case FLUID_DOMAIN_CACHE_MODULAR:
/* Just load the data that has already been baked */
- if (!baking_data && !baking_noise && !baking_mesh && !baking_particles) {
+ if (!baking_data && !baking_noise && !baking_mesh && !baking_particles && !baking_guide) {
read_cache = true;
bake_cache = false;
break;
@@ -4561,7 +4560,7 @@ void BKE_fluid_modifier_create_type_data(struct FluidModifierData *mmd)
mmd->effector->flags = 0;
/* guide options */
- mmd->effector->guide_mode = FLUID_EFFECTOR_GUIDE_MAX;
+ mmd->effector->guide_mode = FLUID_EFFECTOR_GUIDE_OVERRIDE;
mmd->effector->vel_multi = 1.0f;
}
}
diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c
index af77d966c9d..c4812d373ab 100644
--- a/source/blender/editors/physics/physics_fluid.c
+++ b/source/blender/editors/physics/physics_fluid.c
@@ -505,7 +505,9 @@ static void fluid_free_startjob(void *customdata, short *stop, short *do_update,
cache_map |= FLUID_DOMAIN_OUTDATED_PARTICLES;
}
if (fluid_is_free_guiding(job) || fluid_is_free_all(job)) {
- cache_map |= FLUID_DOMAIN_OUTDATED_GUIDE;
+ cache_map |= (FLUID_DOMAIN_OUTDATED_DATA | FLUID_DOMAIN_OUTDATED_NOISE |
+ FLUID_DOMAIN_OUTDATED_MESH | FLUID_DOMAIN_OUTDATED_PARTICLES |
+ FLUID_DOMAIN_OUTDATED_GUIDE);
}
#ifdef WITH_FLUID
BKE_fluid_cache_free(mds, job->ob, cache_map);