feat: UI elements for key combinations

This commit is contained in:
Sara Gerretsen 2025-12-16 15:46:21 +01:00
parent ab300878cf
commit c668771696
15 changed files with 415 additions and 33 deletions

View file

@ -2,19 +2,19 @@
[ext_resource type="PackedScene" uid="uid://cnux2fqne284i" path="res://objects/primitive_nodes/point_primitive_node.tscn" id="1_b1cmn"]
[ext_resource type="PackedScene" uid="uid://wkqhvjnxs2mx" path="res://objects/terrain_chunk.tscn" id="1_pxqd5"]
[ext_resource type="SaveData" uid="uid://djlwnfbjmjb6a" path="res://default_file.tres" id="3_78fwb"]
[ext_resource type="Theme" uid="uid://dh5hqcu3vyhrh" path="res://editor_theme.tres" id="3_ba0ut"]
[ext_resource type="Texture2D" uid="uid://b8hetdn3d3ysr" path="res://assets/icons/point.svg" id="4_5lcyj"]
[ext_resource type="Texture2D" uid="uid://bb0mnjwx58nt3" path="res://assets/icons/plus.svg" id="4_q68jb"]
[ext_resource type="Texture2D" uid="uid://bl3gn6qruuy8w" path="res://assets/icons/plane.svg" id="4_xg7d5"]
[ext_resource type="Texture2D" uid="uid://cwl3no6dbtjrf" path="res://assets/icons/save.svg" id="5_74j0u"]
[ext_resource type="Texture2D" uid="uid://d1te42w7wpkrx" path="res://assets/icons/noise.svg" id="5_eqbpn"]
[ext_resource type="PackedScene" uid="uid://bsvvhue5x4rb" path="res://ui/primitive_inspectors/point_primitive_inspector.tscn" id="8_5tm2q"]
[ext_resource type="PackedScene" uid="uid://c5desl3kt72c7" path="res://ui/primitive_inspectors/noise_primitive_inspector.tscn" id="9_3vi5u"]
[ext_resource type="PackedScene" uid="uid://bl16us512blpp" path="res://ui/primitive_inspectors/base_primitive_inspector.tscn" id="9_j8y2p"]
[ext_resource type="PackedScene" uid="uid://cq25h75v1bnn1" path="res://ui/primitive_inspectors/plane_primitive_inspector.tscn" id="9_o435n"]
[sub_resource type="PlanePrimitive" id="PlanePrimitive_ba0ut"]
blend_range = 1.0
baseline = 0.0
[ext_resource type="Texture2D" uid="uid://c1nd3r8w1yj1o" path="res://assets/icons/undo.svg" id="10_2w0at"]
[ext_resource type="Texture2D" uid="uid://fpnyca6s1f1y" path="res://assets/icons/redo.svg" id="11_5tdu1"]
[sub_resource type="Gradient" id="Gradient_b1cmn"]
interpolation_mode = 2
@ -109,21 +109,51 @@ domain_warp_fractal_gain = 0.662
[sub_resource type="NoisePrimitive" id="NoisePrimitive_5lcyj"]
noise = SubResource("FastNoiseLite_3vi5u")
[sub_resource type="GDScript" id="GDScript_74j0u"]
resource_name = "SaveButton"
script/source = "extends Button
@onready var editor : TerrainMeshEditor = %TerrainMeshEditor
func _pressed():
if Input.is_key_pressed(KEY_SHIFT):
editor.save_data_as()
else:
editor.save_data()
"
[sub_resource type="GDScript" id="GDScript_2w0at"]
resource_name = "UndoButton"
script/source = "extends Button
func _pressed():
EditHistory.undo_last()
"
[sub_resource type="GDScript" id="GDScript_5tdu1"]
resource_name = "RedoButton"
script/source = "extends Button
func _pressed():
EditHistory.redo_last()
"
[node name="Editor" type="Node3D" unique_id=1027707839]
[node name="TerrainMeshEditor" type="TerrainMeshEditor" parent="." unique_id=1382595562]
primitives = [SubResource("PlanePrimitive_ba0ut")]
unique_name_in_owner = true
vertex_color_gradient = SubResource("Gradient_b1cmn")
color_gradient_end_height = 100.0
chunk_count = 8
chunk_scene = ExtResource("1_pxqd5")
point_primitive_object = ExtResource("1_b1cmn")
new_file_data = ExtResource("3_78fwb")
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1468550752]
environment = SubResource("Environment_pxqd5")
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=978399107]
transform = Transform3D(-0.750999, -0.305988, 0.585126, -1.29815e-08, 0.886147, 0.463404, -0.660305, 0.348015, -0.665494, 0, 0, 0)
transform = Transform3D(-0.750999, -0.44822368, 0.48486787, -1.4901161e-08, 0.73431087, 0.678813, -0.66030496, 0.50978696, -0.55146533, 0, 0, 0)
light_color = Color(0.89, 0.82948, 0.7387, 1)
shadow_enabled = true
shadow_reverse_cull_face = true
@ -149,6 +179,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_vertical = 3
drag_area_highlight_in_editor = true
[node name="Layers" type="TabContainer" parent="LeftPanel/VBoxContainer" unique_id=2095156888]
@ -156,22 +187,22 @@ layout_mode = 2
size_flags_vertical = 3
current_tab = 0
[node name="Layers" type="VBoxContainer" parent="LeftPanel/VBoxContainer/Layers" unique_id=138865385]
[node name="File" type="VBoxContainer" parent="LeftPanel/VBoxContainer/Layers" unique_id=138865385]
layout_mode = 2
metadata/_tab_index = 0
[node name="HBoxContainer" type="HBoxContainer" parent="LeftPanel/VBoxContainer/Layers/Layers" unique_id=702489990]
[node name="HBoxContainer" type="HBoxContainer" parent="LeftPanel/VBoxContainer/Layers/File" unique_id=702489990]
layout_mode = 2
size_flags_vertical = 8
[node name="TextureRect" type="TextureRect" parent="LeftPanel/VBoxContainer/Layers/Layers/HBoxContainer" unique_id=1669840346]
[node name="TextureRect" type="TextureRect" parent="LeftPanel/VBoxContainer/Layers/File/HBoxContainer" unique_id=1669840346]
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
texture = ExtResource("4_q68jb")
expand_mode = 2
stretch_mode = 4
[node name="AddPointPrimitive" type="AddPrimitiveButton" parent="LeftPanel/VBoxContainer/Layers/Layers/HBoxContainer" unique_id=255935272 node_paths=PackedStringArray("terrain")]
[node name="AddPointPrimitive" type="AddPrimitiveButton" parent="LeftPanel/VBoxContainer/Layers/File/HBoxContainer" unique_id=255935272 node_paths=PackedStringArray("terrain")]
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
icon = SubResource("CompressedTexture2D_xg7d5")
@ -179,7 +210,7 @@ expand_icon = true
primitive_blueprint = SubResource("PointPrimitive_5lcyj")
terrain = NodePath("../../../../../../TerrainMeshEditor")
[node name="AddPlanePrimitive" type="AddPrimitiveButton" parent="LeftPanel/VBoxContainer/Layers/Layers/HBoxContainer" unique_id=850669113 node_paths=PackedStringArray("terrain")]
[node name="AddPlanePrimitive" type="AddPrimitiveButton" parent="LeftPanel/VBoxContainer/Layers/File/HBoxContainer" unique_id=850669113 node_paths=PackedStringArray("terrain")]
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
icon = ExtResource("4_xg7d5")
@ -187,7 +218,7 @@ expand_icon = true
primitive_blueprint = SubResource("PlanePrimitive_5lcyj")
terrain = NodePath("../../../../../../TerrainMeshEditor")
[node name="AddNoisePrimitive" type="AddPrimitiveButton" parent="LeftPanel/VBoxContainer/Layers/Layers/HBoxContainer" unique_id=761062556 node_paths=PackedStringArray("terrain")]
[node name="AddNoisePrimitive" type="AddPrimitiveButton" parent="LeftPanel/VBoxContainer/Layers/File/HBoxContainer" unique_id=761062556 node_paths=PackedStringArray("terrain")]
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
icon = ExtResource("5_eqbpn")
@ -195,7 +226,7 @@ expand_icon = true
primitive_blueprint = SubResource("NoisePrimitive_5lcyj")
terrain = NodePath("../../../../../../TerrainMeshEditor")
[node name="Tree" type="PrimitiveLayerList" parent="LeftPanel/VBoxContainer/Layers/Layers" unique_id=797700186 node_paths=PackedStringArray("terrain")]
[node name="Tree" type="PrimitiveLayerList" parent="LeftPanel/VBoxContainer/Layers/File" unique_id=797700186 node_paths=PackedStringArray("terrain")]
layout_mode = 2
size_flags_vertical = 3
hide_root = true
@ -209,6 +240,33 @@ icons = {
&"PointPrimitive": ExtResource("4_5lcyj")
}
[node name="HBoxContainer2" type="HBoxContainer" parent="LeftPanel/VBoxContainer/Layers/File" unique_id=20324709]
layout_mode = 2
[node name="SaveButton" type="Button" parent="LeftPanel/VBoxContainer/Layers/File/HBoxContainer2" unique_id=2060569358]
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
tooltip_text = "Save file: Ctrl-S/Cmd-S(mac)"
icon = ExtResource("5_74j0u")
expand_icon = true
script = SubResource("GDScript_74j0u")
[node name="Undo" type="Button" parent="LeftPanel/VBoxContainer/Layers/File/HBoxContainer2" unique_id=133676321]
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
tooltip_text = "Undo: Ctrl-Z/Cmd-Z(mac)"
icon = ExtResource("10_2w0at")
expand_icon = true
script = SubResource("GDScript_2w0at")
[node name="Redo" type="Button" parent="LeftPanel/VBoxContainer/Layers/File/HBoxContainer2" unique_id=946837272]
custom_minimum_size = Vector2(32, 32)
layout_mode = 2
tooltip_text = "Redo: Ctrl-Shift-Z/Cmd-Shift-Z(mac)"
icon = ExtResource("11_5tdu1")
expand_icon = true
script = SubResource("GDScript_5tdu1")
[node name="Inspector" type="LayerEditor" parent="LeftPanel/VBoxContainer" unique_id=833878161 node_paths=PackedStringArray("terrain")]
layout_mode = 2
size_flags_vertical = 3