Rename up/down to raise/lower

main
copygirl 2 months ago
parent 2e5edf092c
commit aff3c22d22
  1. 0
      assets/textures/terrain/editing/height_lower.png
  2. 6
      assets/textures/terrain/editing/height_lower.png.import
  3. 0
      assets/textures/terrain/editing/height_raise.png
  4. 6
      assets/textures/terrain/editing/height_raise.png.import
  5. 11
      terrain/editing/TerrainEditingControls+Editing.cs
  6. 6
      terrain/editing/TerrainEditingControls.cs
  7. 6
      terrain/editing/TerrainEditingControls.tscn

Before

Width:  |  Height:  |  Size: 135 B

After

Width:  |  Height:  |  Size: 135 B

@ -3,15 +3,15 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://covyafauwthij" uid="uid://covyafauwthij"
path="res://.godot/imported/height_down.png-47ae6eeb5feb0ddf7bd952befb4351fe.ctex" path="res://.godot/imported/height_lower.png-d00d3c7062c0a355f5c8381ee7e664da.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://assets/textures/terrain/editing/height_down.png" source_file="res://assets/textures/terrain/editing/height_lower.png"
dest_files=["res://.godot/imported/height_down.png-47ae6eeb5feb0ddf7bd952befb4351fe.ctex"] dest_files=["res://.godot/imported/height_lower.png-d00d3c7062c0a355f5c8381ee7e664da.ctex"]
[params] [params]

Before

Width:  |  Height:  |  Size: 149 B

After

Width:  |  Height:  |  Size: 149 B

@ -3,15 +3,15 @@
importer="texture" importer="texture"
type="CompressedTexture2D" type="CompressedTexture2D"
uid="uid://dxbfohim13ti1" uid="uid://dxbfohim13ti1"
path="res://.godot/imported/height_up.png-d84180c0cff17a8285e5e5cb8f54e819.ctex" path="res://.godot/imported/height_raise.png-a5718ceb2e90ce17597f6300a0a9a715.ctex"
metadata={ metadata={
"vram_texture": false "vram_texture": false
} }
[deps] [deps]
source_file="res://assets/textures/terrain/editing/height_up.png" source_file="res://assets/textures/terrain/editing/height_raise.png"
dest_files=["res://.godot/imported/height_up.png-d84180c0cff17a8285e5e5cb8f54e819.ctex"] dest_files=["res://.godot/imported/height_raise.png-a5718ceb2e90ce17597f6300a0a9a715.ctex"]
[params] [params]

@ -111,11 +111,12 @@ public partial class TerrainEditingControls
} }
} }
var isFlatten = ToolMode == ToolMode.Flatten;
var isRaise = RaiseLowerToggle.ButtonPressed;
const float AdjustHeight = 0.5f; const float AdjustHeight = 0.5f;
var flatten = ToolMode == ToolMode.Flatten; var amount = isFlatten ? terrain.GetTile(tile).Height[corner]
var amount = flatten ? terrain.GetTile(tile).Height[corner] : isRaise ? AdjustHeight : -AdjustHeight;
: UpDownToggle.ButtonPressed ? +AdjustHeight
: -AdjustHeight;
var tilesPrevious = new List<(TilePos, Corners<float>)>(); var tilesPrevious = new List<(TilePos, Corners<float>)>();
var tilesChanged = new List<(TilePos, Corners<float>)>(); var tilesChanged = new List<(TilePos, Corners<float>)>();
@ -126,7 +127,7 @@ public partial class TerrainEditingControls
var newHeight = tile2.Height; var newHeight = tile2.Height;
foreach (var corner2 in group) { foreach (var corner2 in group) {
if (flatten) newHeight[corner2] = amount; if (isFlatten) newHeight[corner2] = amount;
else newHeight[corner2] += amount; else newHeight[corner2] += amount;
} }
tilesChanged.Add((pos, newHeight)); tilesChanged.Add((pos, newHeight));

@ -7,7 +7,7 @@ public partial class TerrainEditingControls
public Slider DrawSizeSlider { get; private set; } public Slider DrawSizeSlider { get; private set; }
public Button[] PaintTextureButtons { get; private set; } public Button[] PaintTextureButtons { get; private set; }
public Button UpDownToggle { get; private set; } public Button RaiseLowerToggle { get; private set; }
public Button ConnectedToggle { get; private set; } public Button ConnectedToggle { get; private set; }
public ToolMode ToolMode { get => GetToolMode (); set => SetToolMode (value); } public ToolMode ToolMode { get => GetToolMode (); set => SetToolMode (value); }
@ -48,7 +48,7 @@ public partial class TerrainEditingControls
DrawSizeSlider = GetNode<Slider>("SizeSlider"); DrawSizeSlider = GetNode<Slider>("SizeSlider");
DrawSizeSlider.ValueChanged += (_) => drawSizeLabel.Text = $"{DrawSize}"; DrawSizeSlider.ValueChanged += (_) => drawSizeLabel.Text = $"{DrawSize}";
UpDownToggle = GetNode<Button>("UpDown"); RaiseLowerToggle = GetNode<Button>("RaiseLower");
ConnectedToggle = GetNode<Button>("Connected"); ConnectedToggle = GetNode<Button>("Connected");
} }
@ -67,7 +67,7 @@ public partial class TerrainEditingControls
ToolShapeButtons[0].Item2.Icon = (value != ToolMode.Paint) ToolShapeButtons[0].Item2.Icon = (value != ToolMode.Paint)
? CornerTextureNormal : CornerTexturePaint; ? CornerTextureNormal : CornerTexturePaint;
UpDownToggle.Disabled = value is ToolMode.Flatten or ToolMode.Paint; RaiseLowerToggle.Disabled = value is ToolMode.Flatten or ToolMode.Paint;
ConnectedToggle.Disabled = value is ToolMode.Paint; ConnectedToggle.Disabled = value is ToolMode.Paint;
} }

@ -9,8 +9,8 @@
[ext_resource type="Texture2D" uid="uid://dc0q2xn2cgcjw" path="res://assets/textures/terrain/editing/corner_paint.png" id="3_e00xo"] [ext_resource type="Texture2D" uid="uid://dc0q2xn2cgcjw" path="res://assets/textures/terrain/editing/corner_paint.png" id="3_e00xo"]
[ext_resource type="Texture2D" uid="uid://2u1ldmh0osbx" path="res://assets/textures/terrain/editing/circle.png" id="2_yvc34"] [ext_resource type="Texture2D" uid="uid://2u1ldmh0osbx" path="res://assets/textures/terrain/editing/circle.png" id="2_yvc34"]
[ext_resource type="Texture2D" uid="uid://btjd1704xtdjv" path="res://assets/textures/terrain/editing/square.png" id="3_aaaoe"] [ext_resource type="Texture2D" uid="uid://btjd1704xtdjv" path="res://assets/textures/terrain/editing/square.png" id="3_aaaoe"]
[ext_resource type="Texture2D" uid="uid://dxbfohim13ti1" path="res://assets/textures/terrain/editing/height_up.png" id="9_u4loi"] [ext_resource type="Texture2D" uid="uid://dxbfohim13ti1" path="res://assets/textures/terrain/editing/height_raise.png" id="9_u4loi"]
[ext_resource type="Texture2D" uid="uid://covyafauwthij" path="res://assets/textures/terrain/editing/height_down.png" id="10_owj33"] [ext_resource type="Texture2D" uid="uid://covyafauwthij" path="res://assets/textures/terrain/editing/height_lower.png" id="10_owj33"]
[ext_resource type="Texture2D" uid="uid://dsbovbbrtuv8f" path="res://assets/textures/terrain/editing/connected_on.png" id="8_4qifu"] [ext_resource type="Texture2D" uid="uid://dsbovbbrtuv8f" path="res://assets/textures/terrain/editing/connected_on.png" id="8_4qifu"]
[ext_resource type="Texture2D" uid="uid://c5j5v62f7p6qt" path="res://assets/textures/terrain/editing/connected_off.png" id="12_5hs2d"] [ext_resource type="Texture2D" uid="uid://c5j5v62f7p6qt" path="res://assets/textures/terrain/editing/connected_off.png" id="12_5hs2d"]
[ext_resource type="Image" uid="uid://b0jp1dyxugbr7" path="res://assets/textures/terrain/grass.png" id="Image_d41co"] [ext_resource type="Image" uid="uid://b0jp1dyxugbr7" path="res://assets/textures/terrain/grass.png" id="Image_d41co"]
@ -91,7 +91,7 @@ value = -1.0
[node name="HSeparator2" type="HSeparator" parent="."] [node name="HSeparator2" type="HSeparator" parent="."]
layout_mode = 2 layout_mode = 2
[node name="UpDown" type="Button" parent="."] [node name="RaiseLower" type="Button" parent="."]
layout_mode = 2 layout_mode = 2
toggle_mode = true toggle_mode = true
button_pressed = true button_pressed = true

Loading…
Cancel
Save