From c808739b78980a83fc04d51b8bdfefd8510e363f Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Fri, 27 Oct 2023 22:56:49 +0200 Subject: [PATCH] Hide WorldChunk Texture overlays by default. --- scenes/WorldChunk.cs | 24 ++++++++++++++++++++++-- scenes/WorldChunk.tscn | 1 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/scenes/WorldChunk.cs b/scenes/WorldChunk.cs index 33e0c96..5a0edbb 100644 --- a/scenes/WorldChunk.cs +++ b/scenes/WorldChunk.cs @@ -19,10 +19,25 @@ public class WorldChunk : Spatial [Export] public Texture NavigationMap; [Export] public Texture HeightMap; [Export] public int Size = 32; - [Export] public Vector2 ChunkAddress; - // [Export] public Vector2 Size = new Vector2(1, 1); + [Export] + public bool ShowTextureOverlay + { + get + { + return _showTextureOverlay; + } + + set + { + if (PlaneRectMesh != null) + { + PlaneRectMesh.Visible = value; + } + } + } + // signals // delegate void OnCoordClicked(Vector2 world_pos); @@ -34,6 +49,7 @@ public class WorldChunk : Spatial private TextureRect _heightmapRect; private SpatialMaterial _rectMaterial = new SpatialMaterial(); + private bool _showTextureOverlay = false; public WorldChunk() { @@ -78,6 +94,10 @@ public class WorldChunk : Spatial { PlaneRectMesh = (MeshInstance)FindNode("PlaneRectMesh"); Debug.Assert(PlaneRectMesh != null); + if (PlaneRectMesh.Visible) + { + _showTextureOverlay = true; + } Transform planeRectTransform = Transform.Identity; planeRectTransform = diff --git a/scenes/WorldChunk.tscn b/scenes/WorldChunk.tscn index 933054d..b8aad26 100644 --- a/scenes/WorldChunk.tscn +++ b/scenes/WorldChunk.tscn @@ -32,6 +32,7 @@ script = ExtResource( 1 ) [node name="PlaneRectMesh" type="MeshInstance" parent="."] transform = Transform( 2, 0, 0, 0, 0.125, 0, 0, 0, 2, 0, -0.1, 0 ) +visible = false mesh = SubResource( 27 ) material/0 = SubResource( 28 )