Compare commits

...

2 commits

Author SHA1 Message Date
de2baa4637 Mark unsaved 2025-02-11 00:16:26 +01:00
1784176d24 Extract into update_minify_button 2025-02-11 00:16:12 +01:00

View file

@ -3,9 +3,7 @@ extends Control
func _process(_delta): func _process(_delta):
update_layer_number() update_layer_number()
var expanded = is_scene_expanded(get_scene()) update_minify_button()
$VBoxContainer/Minify.visible = expanded
$VBoxContainer/Expand.visible = !expanded
func _on_new_pressed(): func _on_new_pressed():
var dialog = EditorFileDialog.new() var dialog = EditorFileDialog.new()
@ -40,6 +38,7 @@ func _on_minify_pressed():
scene.remove_child(scene.get_node("ProjectionViewport")) scene.remove_child(scene.get_node("ProjectionViewport"))
scene.get_node("HeightMap").mesh_library = load("res://Assets/heightmap_meshlibrary.tres") scene.get_node("HeightMap").mesh_library = load("res://Assets/heightmap_meshlibrary.tres")
scene.remove_child(scene.get_node("NotMinified")) scene.remove_child(scene.get_node("NotMinified"))
EditorInterface.mark_scene_as_unsaved()
func _on_expand_pressed(): func _on_expand_pressed():
var scene = get_scene() var scene = get_scene()
@ -57,6 +56,7 @@ func _on_expand_pressed():
scene.add_child(sv) scene.add_child(sv)
sv.owner = scene sv.owner = scene
update_proj_map() update_proj_map()
EditorInterface.mark_scene_as_unsaved()
func _on_up_pressed(): func _on_up_pressed():
move_up_or_down(1) move_up_or_down(1)
@ -95,6 +95,11 @@ func _on_create_baseplate_pressed():
for cell in map.get_used_cells(): for cell in map.get_used_cells():
heightmap.set_cell_item(Vector3i(cell.x, -1, cell.y), cube) heightmap.set_cell_item(Vector3i(cell.x, -1, cell.y), cube)
func update_minify_button():
var expanded = is_scene_expanded(get_scene())
$VBoxContainer/Minify.visible = expanded
$VBoxContainer/Expand.visible = !expanded
func move_up_or_down(direction: int): func move_up_or_down(direction: int):
var selection = EditorInterface.get_selection().get_selected_nodes() var selection = EditorInterface.get_selection().get_selected_nodes()
if len(selection) != 1: return await error_not_editing_tilemap() if len(selection) != 1: return await error_not_editing_tilemap()