fix: wrong edit history;feat: blendmode selector
This commit is contained in:
parent
18ecb79957
commit
0f8733ef3e
9 changed files with 251 additions and 33 deletions
|
|
@ -0,0 +1,76 @@
|
|||
[gd_scene format=3 uid="uid://bl16us512blpp"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cwby0in0f2wi2" path="res://ui/editor_elements/float_editor.tscn" id="1_dildi"]
|
||||
[ext_resource type="Texture2D" uid="uid://bt72qid068u8u" path="res://assets/icons/delete.svg" id="1_h3glg"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_h3glg"]
|
||||
resource_name = "BlendModeSelector"
|
||||
script/source = "extends OptionButton
|
||||
|
||||
@onready var terrain : TerrainMeshEditor = $\"../../..\".terrain
|
||||
@onready var primitive : TerrainPrimitive = terrain.current_selected
|
||||
|
||||
|
||||
func _on_item_selected(index: int) -> void:
|
||||
var before : int = primitive.blend_mode
|
||||
EditHistory.push_action(primitive.set_blend_mode.bind(index), primitive.set_blend_mode.bind(before))
|
||||
"
|
||||
|
||||
[node name="PointPrimitive" type="MarginContainer" unique_id=905749607]
|
||||
offset_right = 302.0
|
||||
offset_bottom = 230.0
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_top = 5
|
||||
theme_override_constants/margin_right = 5
|
||||
theme_override_constants/margin_bottom = 5
|
||||
metadata/_tab_index = 0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="." unique_id=236606520]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="BlendRange" type="Label" parent="VBoxContainer" unique_id=455258354]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Blend Range"
|
||||
|
||||
[node name="FloatEditor3" parent="VBoxContainer" unique_id=1730998858 instance=ExtResource("1_dildi")]
|
||||
layout_mode = 2
|
||||
changes_value = "blend_range"
|
||||
|
||||
[node name="SpinBox" parent="VBoxContainer/FloatEditor3" index="0" unique_id=580598896]
|
||||
min_value = 0.0
|
||||
max_value = 1000.0
|
||||
|
||||
[node name="HSlider" parent="VBoxContainer/FloatEditor3" index="1" unique_id=163542019]
|
||||
max_value = 100.0
|
||||
value = 100.0
|
||||
exp_edit = true
|
||||
tick_count = 11
|
||||
ticks_on_borders = true
|
||||
|
||||
[node name="BlendModeSelector" type="OptionButton" parent="VBoxContainer" unique_id=1342650865]
|
||||
layout_mode = 2
|
||||
selected = 0
|
||||
item_count = 3
|
||||
popup/item_0/text = "Peaks"
|
||||
popup/item_0/id = 0
|
||||
popup/item_1/text = "Valleys"
|
||||
popup/item_1/id = 1
|
||||
popup/item_2/text = "Both"
|
||||
popup/item_2/id = 2
|
||||
script = SubResource("GDScript_h3glg")
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer" unique_id=274380821]
|
||||
layout_mode = 2
|
||||
alignment = 2
|
||||
|
||||
[node name="Button" type="Button" parent="VBoxContainer/HBoxContainer" unique_id=1514690251]
|
||||
custom_minimum_size = Vector2(32, 32)
|
||||
layout_mode = 2
|
||||
icon = ExtResource("1_h3glg")
|
||||
icon_alignment = 1
|
||||
expand_icon = true
|
||||
|
||||
[connection signal="item_selected" from="VBoxContainer/BlendModeSelector" to="VBoxContainer/BlendModeSelector" method="_on_item_selected"]
|
||||
|
||||
[editable path="VBoxContainer/FloatEditor3"]
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
[gd_scene format=3 uid="uid://bsvvhue5x4rb"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://cwby0in0f2wi2" path="res://ui/editor_elements/float_editor.tscn" id="1_qb00w"]
|
||||
[ext_resource type="PackedScene" uid="uid://bl16us512blpp" path="res://ui/primitive_inspectors/base_primitive_inspector.tscn" id="1_tqa7h"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_qb00w"]
|
||||
[sub_resource type="GDScript" id="GDScript_qfu2v"]
|
||||
resource_name = "PositionEditor"
|
||||
script/source = "extends HBoxContainer
|
||||
|
||||
@onready var terrain : TerrainMeshEditor = $\"../../..\".terrain
|
||||
|
|
@ -15,8 +17,8 @@ func _ready():
|
|||
|
||||
func _primitive_changed():
|
||||
var new_position : Vector2 = primitive.center
|
||||
$XBox.value = new_position.x
|
||||
$YBox.value = new_position.y
|
||||
$XBox.set_value_no_signal(new_position.x)
|
||||
$YBox.set_value_no_signal(new_position.y)
|
||||
|
||||
func _x_changed(value : float):
|
||||
var old : Vector2 = primitive.center
|
||||
|
|
@ -27,64 +29,55 @@ func _y_changed(value : float):
|
|||
EditHistory.push_action(primitive.set.bind(\"center\", Vector2(old.x, value)), primitive.set.bind(\"center\", old))
|
||||
"
|
||||
|
||||
[node name="PointPrimitive" type="MarginContainer" unique_id=905749607]
|
||||
offset_right = 302.0
|
||||
offset_bottom = 230.0
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_top = 5
|
||||
theme_override_constants/margin_right = 5
|
||||
theme_override_constants/margin_bottom = 5
|
||||
metadata/_tab_index = 0
|
||||
[node name="PointPrimitive" unique_id=905749607 instance=ExtResource("1_tqa7h")]
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="." unique_id=236606520]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HeightLabel" type="Label" parent="VBoxContainer" unique_id=1478707845]
|
||||
[node name="HeightLabel" type="Label" parent="VBoxContainer" parent_id_path=PackedInt32Array(236606520) index="0" unique_id=1675918554]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Height"
|
||||
|
||||
[node name="FloatEditor" parent="VBoxContainer" unique_id=1730998858 instance=ExtResource("1_qb00w")]
|
||||
[node name="FloatEditor" parent="VBoxContainer" parent_id_path=PackedInt32Array(236606520) index="1" unique_id=1730998858 instance=ExtResource("1_qb00w")]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Slope" type="Label" parent="VBoxContainer" unique_id=303736827]
|
||||
[node name="Slope" type="Label" parent="VBoxContainer" parent_id_path=PackedInt32Array(236606520) index="2" unique_id=1362885374]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Slope"
|
||||
|
||||
[node name="FloatEditor2" parent="VBoxContainer" unique_id=1151227800 instance=ExtResource("1_qb00w")]
|
||||
[node name="FloatEditor2" parent="VBoxContainer" parent_id_path=PackedInt32Array(236606520) index="3" unique_id=739098632 instance=ExtResource("1_qb00w")]
|
||||
layout_mode = 2
|
||||
changes_value = "slope"
|
||||
|
||||
[node name="HSlider" parent="VBoxContainer/FloatEditor2" index="0" unique_id=163542019]
|
||||
[node name="SpinBox" parent="VBoxContainer/FloatEditor2" index="0" unique_id=580598896]
|
||||
step = 0.1
|
||||
|
||||
[node name="HSlider" parent="VBoxContainer/FloatEditor2" index="1" unique_id=163542019]
|
||||
min_value = -2.0
|
||||
max_value = 2.0
|
||||
value = -0.5
|
||||
tick_count = 5
|
||||
ticks_on_borders = true
|
||||
|
||||
[node name="SpinBox" parent="VBoxContainer/FloatEditor2" index="1" unique_id=580598896]
|
||||
step = 0.1
|
||||
|
||||
[node name="Position" type="Label" parent="VBoxContainer" unique_id=200995882]
|
||||
[node name="Position" type="Label" parent="VBoxContainer" parent_id_path=PackedInt32Array(236606520) index="4" unique_id=527506771]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Position"
|
||||
|
||||
[node name="HSplitContainer" type="HBoxContainer" parent="VBoxContainer" unique_id=1958091184]
|
||||
[node name="HSplitContainer" type="HBoxContainer" parent="VBoxContainer" parent_id_path=PackedInt32Array(236606520) index="5" unique_id=2016506236]
|
||||
layout_mode = 2
|
||||
script = SubResource("GDScript_qb00w")
|
||||
script = SubResource("GDScript_qfu2v")
|
||||
|
||||
[node name="XBox" type="SpinBox" parent="VBoxContainer/HSplitContainer" unique_id=2044129298]
|
||||
[node name="XBox" type="SpinBox" parent="VBoxContainer/HSplitContainer" index="0" unique_id=1149105773]
|
||||
layout_mode = 2
|
||||
min_value = -10000.0
|
||||
max_value = 10000.0
|
||||
prefix = "x"
|
||||
|
||||
[node name="YBox" type="SpinBox" parent="VBoxContainer/HSplitContainer" unique_id=1865142111]
|
||||
[node name="YBox" type="SpinBox" parent="VBoxContainer/HSplitContainer" index="1" unique_id=1897326873]
|
||||
layout_mode = 2
|
||||
min_value = -10000.0
|
||||
max_value = 10000.0
|
||||
prefix = "y"
|
||||
|
||||
[editable path="VBoxContainer/FloatEditor2"]
|
||||
[editable path="VBoxContainer/FloatEditor3"]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue