diff --git a/docs/TODO_ux.md b/docs/TODO_ux.md index 4d7536d9af..856e5391fa 100644 --- a/docs/TODO_ux.md +++ b/docs/TODO_ux.md @@ -2,8 +2,8 @@ ## Performance -- disable time travel recording by default - cache draw stuff + - carefully. dont upload unbounded stuff to GPU in time travel. ## Quick n easy diff --git a/editor/src/plugins/sim/time_travel.rs b/editor/src/plugins/sim/time_travel.rs index e02a677444..7a2dbed0d5 100644 --- a/editor/src/plugins/sim/time_travel.rs +++ b/editor/src/plugins/sim/time_travel.rs @@ -9,6 +9,7 @@ pub struct TimeTravel { current_tick: Option, // Determines the tick of state_per_tick[0] first_tick: Tick, + should_record: bool, } struct StateAtTime { @@ -24,6 +25,7 @@ impl TimeTravel { state_per_tick: Vec::new(), current_tick: None, first_tick: Tick::zero(), + should_record: false, } } @@ -66,7 +68,9 @@ impl TimeTravel { // Don't really need to indicate activeness here. pub fn event(&mut self, ctx: &mut PluginCtx) { - self.record_state(&ctx.primary.sim, &ctx.primary.map); + if self.should_record { + self.record_state(&ctx.primary.sim, &ctx.primary.map); + } if let Some(tick) = self.current_tick { ctx.input.set_mode_with_prompt( @@ -84,6 +88,10 @@ impl TimeTravel { self.current_tick = None; } } else if ctx.input.action_chosen("start time traveling") { + if !self.should_record { + self.should_record = true; + self.record_state(&ctx.primary.sim, &ctx.primary.map); + } self.current_tick = Some(ctx.primary.sim.time); } }