feat: deleting primitives at runtime
This commit is contained in:
parent
5f7e0853b1
commit
5953ff49a1
3 changed files with 24 additions and 0 deletions
|
|
@ -22,6 +22,19 @@ func _on_item_selected(index: int) -> void:
|
|||
EditHistory.push_action(primitive.set_blend_mode.bind(index), primitive.set_blend_mode.bind(before))
|
||||
"
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_ivj30"]
|
||||
resource_name = "DeletePrimitive"
|
||||
script/source = "extends Button
|
||||
|
||||
@onready var terrain : TerrainMeshEditor = ($\"../../../..\" as LayerEditor).terrain
|
||||
@onready var primitive : TerrainPrimitive = terrain.current_selected
|
||||
|
||||
func _pressed() -> void:
|
||||
var idx : int = terrain.primitives.find(primitive)
|
||||
EditHistory.push_action(terrain.remove_primitive.bind(primitive), terrain.insert_primitive.bind(primitive, idx))
|
||||
terrain.current_selected = null
|
||||
"
|
||||
|
||||
[node name="Primitive" type="MarginContainer" unique_id=905749607]
|
||||
offset_right = 302.0
|
||||
offset_bottom = 230.0
|
||||
|
|
@ -76,6 +89,7 @@ layout_mode = 2
|
|||
icon = ExtResource("1_h3glg")
|
||||
icon_alignment = 1
|
||||
expand_icon = true
|
||||
script = SubResource("GDScript_ivj30")
|
||||
|
||||
[connection signal="item_selected" from="VBoxContainer/BlendModeSelector" to="VBoxContainer/BlendModeSelector" method="_on_item_selected"]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue