From ca2be030ea78fd9b43152f9b9ced6aba61422739 Mon Sep 17 00:00:00 2001 From: Duncan Freeman Date: Wed, 13 Mar 2024 12:10:33 -0700 Subject: [PATCH] Enable collisions when life is disabled --- src/app.rs | 56 ++++++++++++++++++++++++++++++++++-------------------- src/sim.rs | 2 +- 2 files changed, 36 insertions(+), 22 deletions(-) diff --git a/src/app.rs b/src/app.rs index be44537..7863753 100644 --- a/src/app.rs +++ b/src/app.rs @@ -494,29 +494,44 @@ impl TemplateApp { let mut do_reset = false; ui.strong("Particle behaviour"); + let mut changed = false; Grid::new("particle mode settings").show(ui, |ui| { - ui.radio_value( - &mut self.save.working.tweak.particle_mode, - ParticleBehaviourMode::Off, - "Off (kinematics only)", - ); - ui.radio_value( - &mut self.save.working.tweak.particle_mode, - ParticleBehaviourMode::NodeGraph, - "Node graph", - ); + changed |= ui + .radio_value( + &mut self.save.working.tweak.particle_mode, + ParticleBehaviourMode::Off, + "Off (kinematics only)", + ) + .changed(); + changed |= ui + .radio_value( + &mut self.save.working.tweak.particle_mode, + ParticleBehaviourMode::NodeGraph, + "Node graph", + ) + .changed(); ui.end_row(); - ui.radio_value( - &mut self.save.working.tweak.particle_mode, - ParticleBehaviourMode::ParticleLife, - "Particle life", - ); - ui.radio_value( - &mut self.save.working.tweak.particle_mode, - ParticleBehaviourMode::Both, - "Both (graph + life)", - ); + + changed |= ui + .radio_value( + &mut self.save.working.tweak.particle_mode, + ParticleBehaviourMode::ParticleLife, + "Particle life", + ) + .changed(); + + changed |= ui + .radio_value( + &mut self.save.working.tweak.particle_mode, + ParticleBehaviourMode::Both, + "Both (graph + life)", + ) + .changed(); }); + if changed { + self.save.working.tweak.enable_particle_collisions = + !self.save.working.tweak.particle_mode.uses_life(); + } ui.separator(); ui.strong("Save data"); @@ -841,7 +856,6 @@ impl TemplateApp { ui.checkbox(&mut self.save.working.well, "Enable"); }); - if self.save.working.tweak.enable_grid_transfer { ui.separator(); ui.strong("Incompressibility Solver"); diff --git a/src/sim.rs b/src/sim.rs index ff68dff..c992832 100644 --- a/src/sim.rs +++ b/src/sim.rs @@ -887,7 +887,7 @@ fn per_neighbor_node_interactions( impl Default for SimTweak { fn default() -> Self { Self { - enable_particle_collisions: false, + enable_particle_collisions: true, enable_incompress: true, enable_grid_transfer: true, pic_apic_ratio: 1.,