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. 13
      terrain/editing/TerrainEditingControls+Editing.cs
  6. 14
      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"
type="CompressedTexture2D"
uid="uid://covyafauwthij"
path="res://.godot/imported/height_down.png-47ae6eeb5feb0ddf7bd952befb4351fe.ctex"
path="res://.godot/imported/height_lower.png-d00d3c7062c0a355f5c8381ee7e664da.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/textures/terrain/editing/height_down.png"
dest_files=["res://.godot/imported/height_down.png-47ae6eeb5feb0ddf7bd952befb4351fe.ctex"]
source_file="res://assets/textures/terrain/editing/height_lower.png"
dest_files=["res://.godot/imported/height_lower.png-d00d3c7062c0a355f5c8381ee7e664da.ctex"]
[params]

Before

Width:  |  Height:  |  Size: 149 B

After

Width:  |  Height:  |  Size: 149 B

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

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

@ -7,8 +7,8 @@ public partial class TerrainEditingControls
public Slider DrawSizeSlider { get; private set; }
public Button[] PaintTextureButtons { get; private set; }
public Button UpDownToggle { get; private set; }
public Button ConnectedToggle { get; private set; }
public Button RaiseLowerToggle { get; private set; }
public Button ConnectedToggle { get; private set; }
public ToolMode ToolMode { get => GetToolMode (); set => SetToolMode (value); }
public ToolShape ToolShape { get => GetToolShape(); set => SetToolShape(value); }
@ -44,12 +44,12 @@ public partial class TerrainEditingControls
foreach (var (i, button) in PaintTextureButtons.Select((b, i) => (i, b)))
button.Pressed += () => SetTexture(i + 1);
var drawSizeLabel = GetNode<Label>("SizeLabel");
DrawSizeSlider = GetNode<Slider>("SizeSlider");
var drawSizeLabel = GetNode<Label> ("SizeLabel");
DrawSizeSlider = GetNode<Slider>("SizeSlider");
DrawSizeSlider.ValueChanged += (_) => drawSizeLabel.Text = $"{DrawSize}";
UpDownToggle = GetNode<Button>("UpDown");
ConnectedToggle = GetNode<Button>("Connected");
RaiseLowerToggle = GetNode<Button>("RaiseLower");
ConnectedToggle = GetNode<Button>("Connected");
}
ToolMode GetToolMode()
@ -67,7 +67,7 @@ public partial class TerrainEditingControls
ToolShapeButtons[0].Item2.Icon = (value != ToolMode.Paint)
? 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;
}

@ -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://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://dxbfohim13ti1" path="res://assets/textures/terrain/editing/height_up.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://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_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://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"]
@ -91,7 +91,7 @@ value = -1.0
[node name="HSeparator2" type="HSeparator" parent="."]
layout_mode = 2
[node name="UpDown" type="Button" parent="."]
[node name="RaiseLower" type="Button" parent="."]
layout_mode = 2
toggle_mode = true
button_pressed = true

Loading…
Cancel
Save