Skip to content

Commit

Permalink
Confirmation box when removing custom slabs, column data always shows
Browse files Browse the repository at this point in the history
  • Loading branch information
rainlizard committed Oct 30, 2023
1 parent 4f2bb62 commit ca027eb
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 14 deletions.
17 changes: 17 additions & 0 deletions Scenes/Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -2140,6 +2140,22 @@ __meta__ = {
"_edit_use_anchors_": false
}

[node name="ConfirmDeleteCustomSlab" type="ConfirmationDialog" parent="Ui/UiSystem"]
visible = true
margin_left = 916.0
margin_top = -181.0
margin_right = 1216.0
margin_bottom = -76.0
rect_min_size = Vector2( 300, 105 )
popup_exclusive = true
window_title = "Confirm delete"
dialog_text = "Delete this custom slab?"
dialog_autowrap = true
script = ExtResource( 61 )
__meta__ = {
"_edit_use_anchors_": false
}

[node name="ConfirmSaveBeforeQuit" type="WindowDialog" parent="Ui/UiSystem"]
visible = true
margin_left = 944.0
Expand Down Expand Up @@ -6362,6 +6378,7 @@ script = SubResource( 20 )
[connection signal="confirmed" from="Ui/UiSystem/ConfirmDelete" to="Ui/UiSystem/MapBrowser" method="_on_ConfirmDelete_confirmed"]
[connection signal="confirmed" from="Ui/UiSystem/ConfirmDiscardChanges" to="Ui/UiSystem/Menu" method="_on_ConfirmDiscardChanges_confirmed"]
[connection signal="confirmed" from="Ui/UiSystem/ConfirmQuit" to="Editor" method="_on_ConfirmQuit_confirmed"]
[connection signal="confirmed" from="Ui/UiSystem/ConfirmDeleteCustomSlab" to="Ui/UiTools/PickSlabWindow" method="_on_ConfirmDeleteCustomSlab_confirmed"]
[connection signal="pressed" from="Ui/UiSystem/ConfirmSaveBeforeQuit/VBoxContainer/HBoxContainer/ButtonConfirmExitSave" to="Ui/UiSystem/ConfirmSaveBeforeQuit" method="_on_ButtonConfirmExitSave_pressed"]
[connection signal="pressed" from="Ui/UiSystem/ConfirmSaveBeforeQuit/VBoxContainer/HBoxContainer/ButtonConfirmExitDontSave" to="Ui/UiSystem/ConfirmSaveBeforeQuit" method="_on_ButtonConfirmExitDontSave_pressed"]
[connection signal="pressed" from="Ui/UiSystem/ConfirmSaveBeforeQuit/VBoxContainer/HBoxContainer/ButtonConfirmExitCancel" to="Ui/UiSystem/ConfirmSaveBeforeQuit" method="_on_ButtonConfirmExitCancel_pressed"]
Expand Down
17 changes: 11 additions & 6 deletions Scenes/PickSlabWindow.gd
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ onready var oColumnEditor = Nodelist.list["oColumnEditor"]
onready var oColumnEditorTabs = Nodelist.list["oColumnEditorTabs"]
onready var oDkDat = Nodelist.list["oDkDat"]
onready var oPlaceLockedCheckBox = Nodelist.list["oPlaceLockedCheckBox"]
onready var oConfirmDeleteCustomSlab = Nodelist.list["oConfirmDeleteCustomSlab"]



onready var oSelectedRect = $Clippy/SelectedRect
Expand Down Expand Up @@ -233,13 +235,16 @@ func _on_slab_portrait_gui_input(event, id):
if event.is_action_pressed("mouse_right"):
var slabID = id.get_meta("ID_of_slab")
if slabID >= 1000:
oCustomSlabSystem.remove_custom_slab(slabID)

for child in current_grid_container().get_children():
if child.get_meta("ID_of_slab") == slabID:
child.queue_free()

Utils.popup_centered(oConfirmDeleteCustomSlab)
oConfirmDeleteCustomSlab.set_meta("ID_TO_DELETE", slabID)
_on_hovered_none()

func rect_changed_start_timer():
rectChangedTimer.start(0.2)

func _on_ConfirmDeleteCustomSlab_confirmed():
var slabID = oConfirmDeleteCustomSlab.get_meta("ID_TO_DELETE")
for child in tabs[Slabs.TAB_CUSTOM][GRIDCON_PATH].get_children():
if child.has_meta("ID_of_slab") and child.get_meta("ID_of_slab") == slabID:
child.queue_free()
oCustomSlabSystem.remove_custom_slab(slabID)
16 changes: 8 additions & 8 deletions Scenes/ViewColumn.gd
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@ func update_details():
# oColumnListData.clear()
# return

if oColumnEditor.visible == true:
if oColumnEditorVoxelView.visible == true:
entryIndex = oColumnEditorVoxelView.viewObject
if oCustomSlabVoxelView.visible == true:
if is_instance_valid(get_focus_owner()):
if is_instance_valid(get_focus_owner().get_parent()):
if get_focus_owner().get_parent() is SpinBox:
entryIndex = get_focus_owner().get_parent().value
# if oColumnEditor.visible == true:
# if oColumnEditorVoxelView.visible == true:
# entryIndex = oColumnEditorVoxelView.viewObject
# if oCustomSlabVoxelView.visible == true:
# if is_instance_valid(get_focus_owner()):
# if is_instance_valid(get_focus_owner().get_parent()):
# if get_focus_owner().get_parent() is SpinBox:
# entryIndex = get_focus_owner().get_parent().value

for i in 16:
var description
Expand Down

0 comments on commit ca027eb

Please sign in to comment.