Skip to content

Commit af327cc

Browse files
feat(editor): hide the grid in scripting mode, like play mode
Play mode already turned the reference grid off so the running game is not cluttered by editing aids. Scripting mode, which is how the breakout example runs, left it on. It now hides the grid on start and restores it on stop, after the scene restore so the value sticks.
1 parent 16b54f2 commit af327cc

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

apps/editor/worker/src/ecs/resources.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ pub struct ScriptingState {
405405
pub active: bool,
406406
pub snapshot: Option<nightshade::ecs::scene::Scene>,
407407
pub restore_camera: Option<Entity>,
408+
pub restore_show_grid: bool,
408409
}
409410

410411
pub struct GenerationSettings {

apps/editor/worker/src/systems/scripting.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ fn start(editor_world: &mut EditorWorld, world: &mut World) {
2424
world.resources.active_camera = Some(camera);
2525
}
2626
editor_world.resources.scripting.active = true;
27+
editor_world.resources.scripting.restore_show_grid = world.resources.debug_draw.show_grid;
28+
world.resources.debug_draw.show_grid = false;
2729
world.resources.physics.enabled = true;
2830
world.resources.script_runtime.enabled = true;
2931
nightshade::ecs::physics::resources::physics_world_wake_all(&mut world.resources.physics);
@@ -40,6 +42,7 @@ fn stop(editor_world: &mut EditorWorld, world: &mut World) {
4042
if let Some(scene) = editor_world.resources.scripting.snapshot.take() {
4143
crate::systems::project_io::restore_gameplay_scene(editor_world, world, &scene);
4244
}
45+
world.resources.debug_draw.show_grid = editor_world.resources.scripting.restore_show_grid;
4346
}
4447

4548
/// The scene's own camera: the first camera entity that is not editor

0 commit comments

Comments
 (0)