diff options
author | Sebastián Barschkis <sebbas@sebbas.org> | 2020-09-23 16:54:08 +0300 |
---|---|---|
committer | Sebastián Barschkis <sebbas@sebbas.org> | 2020-09-23 16:54:33 +0300 |
commit | bda274d1fef8774383d7e89847726e7dc7b3a9a3 (patch) | |
tree | 1d526d88b3ba3f9407ed576a63820660f8a4ea2e /source/blender | |
parent | 738615cdfd988a16166b60af50df3bc664f346ca (diff) |
Fix T80833: Fluid Initial Velocity 'Source' incorrect when enabling Inflow
Do not escape flow / effector objects if they have a disabled use flow / use effector flag.
Vertex velocities still need to be kept track of in order to have correct object velocities when enabling flows / effectors intermittenly. It is possible though to skip the emission loop if the flags are disabled.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/fluid.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c index 70ee0c75933..1997d31544e 100644 --- a/source/blender/blenkernel/intern/fluid.c +++ b/source/blender/blenkernel/intern/fluid.c @@ -1085,7 +1085,9 @@ static void obstacles_from_mesh(Object *coll_ob, res[i] = bb->res[i]; } - if (BKE_bvhtree_from_mesh_get(&tree_data, me, BVHTREE_FROM_LOOPTRI, 4)) { + /* Skip effector sampling loop if object has disabled effector. */ + bool use_effector = fes->flags & FLUID_EFFECTOR_USE_EFFEC; + if (use_effector && BKE_bvhtree_from_mesh_get(&tree_data, me, BVHTREE_FROM_LOOPTRI, 4)) { ObstaclesFromDMData data = { .fes = fes, @@ -1174,13 +1176,11 @@ static void update_obstacleflags(FluidDomainSettings *fds, static bool escape_effectorobject(Object *flowobj, FluidDomainSettings *fds, - FluidEffectorSettings *fes, + FluidEffectorSettings *UNUSED(fes), int frame) { bool is_static = is_static_object(flowobj); - bool use_effector = (fes->flags & FLUID_EFFECTOR_USE_EFFEC); - bool is_resume = (fds->cache_frame_pause_data == frame); bool is_adaptive = (fds->flags & FLUID_DOMAIN_USE_ADAPTIVE_DOMAIN); bool is_first_frame = (frame == fds->cache_frame_start); @@ -1190,10 +1190,6 @@ static bool escape_effectorobject(Object *flowobj, if (is_adaptive) { is_static = false; } - /* Skip flow objects with disabled inflow flag. */ - if (!use_effector) { - return true; - } /* Skip static effector objects after initial frame. */ if (is_static && !is_first_frame && !is_resume) { return true; @@ -2163,7 +2159,9 @@ static void emit_from_mesh( res[i] = bb->res[i]; } - if (BKE_bvhtree_from_mesh_get(&tree_data, me, BVHTREE_FROM_LOOPTRI, 4)) { + /* Skip flow sampling loop if object has disabled flow. */ + bool use_flow = ffs->flags & FLUID_FLOW_USE_INFLOW; + if (use_flow && BKE_bvhtree_from_mesh_get(&tree_data, me, BVHTREE_FROM_LOOPTRI, 4)) { EmitFromDMData data = { .fds = fds, @@ -2706,9 +2704,6 @@ static bool escape_flowsobject(Object *flowobj, bool gas_flow = (ffs->type == FLUID_FLOW_TYPE_SMOKE || ffs->type == FLUID_FLOW_TYPE_FIRE || ffs->type == FLUID_FLOW_TYPE_SMOKEFIRE); bool is_geometry = (ffs->behavior == FLUID_FLOW_BEHAVIOR_GEOMETRY); - bool is_inflow = (ffs->behavior == FLUID_FLOW_BEHAVIOR_INFLOW); - bool is_outflow = (ffs->behavior == FLUID_FLOW_BEHAVIOR_OUTFLOW); - bool use_flow = (ffs->flags & FLUID_FLOW_USE_INFLOW); bool liquid_domain = fds->type == FLUID_DOMAIN_TYPE_LIQUID; bool gas_domain = fds->type == FLUID_DOMAIN_TYPE_GAS; @@ -2721,10 +2716,6 @@ static bool escape_flowsobject(Object *flowobj, if (is_adaptive) { is_static = false; } - /* Skip flow objects with disabled inflow flag. */ - if ((is_inflow || is_outflow) && !use_flow) { - return true; - } /* No need to compute emission value if it won't be applied. */ if (liquid_flow && is_geometry && !is_first_frame) { return true; |