Skip to content

Commit

Permalink
Added links to columnset editor, display slab IDs when saving slabset
Browse files Browse the repository at this point in the history
  • Loading branch information
rainlizard committed Jun 1, 2024
1 parent ce06a96 commit 84f5550
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 33 deletions.
5 changes: 4 additions & 1 deletion Autoload/Slabset.gd
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ func export_toml_slabset(filePath):
# else:
# print("Default: Beyond array size")


var list_of_modified_slabs = []

var lines = PoolStringArray()
var totalSlabs = max(dat.size(), tng.size()) / 28
Expand All @@ -277,6 +277,7 @@ func export_toml_slabset(filePath):
break

if hasChanges == true:
list_of_modified_slabs.append(slabID)
lines.append("[slab" + str(slabID) + "]")

for variationNumber in 28:
Expand Down Expand Up @@ -329,6 +330,8 @@ func export_toml_slabset(filePath):
textFile.close()

oMessage.quick("Saved: " + filePath)
oMessage.quick("Saved Slab IDs: " + str(list_of_modified_slabs).replace("[","").replace("]",""))

print('Exported in: ' + str(OS.get_ticks_msec() - CODETIME_START) + 'ms')


Expand Down
67 changes: 46 additions & 21 deletions Scenes/Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -5452,6 +5452,7 @@ size_flags_horizontal = 3
size_flags_vertical = 3

[node name="TabSlabset" type="VBoxContainer" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs"]
visible = false
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 12.0
Expand Down Expand Up @@ -5510,7 +5511,7 @@ size_flags_vertical = 3
scroll_horizontal_enabled = false

[node name="VBoxContainer" type="VBoxContainer" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabSlabset/HBoxContainer/VBoxContainer/ScrollContainer"]
margin_right = 236.0
margin_right = 18.0
margin_bottom = 839.0
size_flags_vertical = 3

Expand Down Expand Up @@ -5923,13 +5924,11 @@ size_flags_vertical = 3
scroll_vertical_enabled = false

[node name="VBoxContainer" type="VBoxContainer" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabSlabset/HBoxContainer/VBoxContainer/SlabsetPathsLabel/ScrollContainer"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_right = 218.0
size_flags_horizontal = 3
size_flags_vertical = 3

[node name="TabColumnset" type="HBoxContainer" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs"]
visible = false
[node name="TabColumnset" type="VBoxContainer" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs"]
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 12.0
Expand All @@ -5939,46 +5938,52 @@ margin_bottom = -12.0
size_flags_horizontal = 3
size_flags_vertical = 3

[node name="ColumnsetVoxelView" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset" instance=ExtResource( 19 )]
[node name="HBoxContainer" type="HBoxContainer" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset"]
margin_right = 1236.0
margin_bottom = 915.0
size_flags_horizontal = 3
size_flags_vertical = 3

[node name="ColumnsetVoxelView" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/HBoxContainer" instance=ExtResource( 19 )]
margin_right = 1006.0
margin_bottom = 815.0
margin_bottom = 915.0
displayingType = 3

[node name="VBoxContainer" type="VBoxContainer" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset"]
[node name="VBoxContainer" type="VBoxContainer" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/HBoxContainer"]
margin_left = 1010.0
margin_right = 1236.0
margin_bottom = 815.0
margin_bottom = 915.0

[node name="PanelContainer" type="PanelContainer" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/VBoxContainer"]
[node name="PanelContainer" type="PanelContainer" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/HBoxContainer/VBoxContainer"]
margin_right = 226.0
margin_bottom = 39.0

[node name="ColumnsetFilenameLabel" type="Label" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/VBoxContainer/PanelContainer"]
[node name="ColumnsetFilenameLabel" type="Label" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/HBoxContainer/VBoxContainer/PanelContainer"]
margin_left = 9.0
margin_top = 9.0
margin_right = 217.0
margin_bottom = 30.0
text = "columnset.toml"
align = 1

[node name="ColumnsetControls" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/VBoxContainer" instance=ExtResource( 137 )]
[node name="ColumnsetControls" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/HBoxContainer/VBoxContainer" instance=ExtResource( 137 )]
margin_top = 43.0
margin_right = 226.0
margin_bottom = 761.0
margin_bottom = 839.0
size_flags_horizontal = 1

[node name="PanelContainer2" type="PanelContainer" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/VBoxContainer"]
margin_top = 765.0
[node name="PanelContainer2" type="PanelContainer" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/HBoxContainer/VBoxContainer"]
margin_top = 843.0
margin_right = 226.0
margin_bottom = 815.0
margin_bottom = 893.0

[node name="HBoxContainer" type="HBoxContainer" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/VBoxContainer/PanelContainer2"]
[node name="HBoxContainer" type="HBoxContainer" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/HBoxContainer/VBoxContainer/PanelContainer2"]
margin_left = 9.0
margin_top = 9.0
margin_right = 217.0
margin_bottom = 41.0

[node name="ColumnsetHelpButton" type="TextureButton" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/VBoxContainer/PanelContainer2/HBoxContainer"]
[node name="ColumnsetHelpButton" type="TextureButton" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/HBoxContainer/VBoxContainer/PanelContainer2/HBoxContainer"]
margin_right = 51.0
margin_bottom = 32.0
rect_min_size = Vector2( 32, 32 )
Expand All @@ -5990,14 +5995,34 @@ texture_hover = ExtResource( 128 )
expand = true
stretch_mode = 4

[node name="ExportColumnsToml" type="Button" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/VBoxContainer/PanelContainer2/HBoxContainer"]
[node name="ExportColumnsToml" type="Button" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/HBoxContainer/VBoxContainer/PanelContainer2/HBoxContainer"]
margin_left = 55.0
margin_right = 208.0
margin_bottom = 27.0
size_flags_horizontal = 3
size_flags_vertical = 0
text = "Save columnset"

[node name="ColumnsetPathsLabel" type="PanelContainer" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/HBoxContainer/VBoxContainer"]
margin_top = 897.0
margin_right = 226.0
margin_bottom = 915.0
script = ExtResource( 91 )

[node name="ScrollContainer" type="ScrollContainer" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/HBoxContainer/VBoxContainer/ColumnsetPathsLabel"]
margin_left = 9.0
margin_top = 9.0
margin_right = 217.0
margin_bottom = 9.0
size_flags_horizontal = 3
size_flags_vertical = 3
scroll_vertical_enabled = false

[node name="VBoxContainer" type="VBoxContainer" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/HBoxContainer/VBoxContainer/ColumnsetPathsLabel/ScrollContainer"]
margin_right = 208.0
size_flags_horizontal = 3
size_flags_vertical = 3

[node name="NewMapWindow" type="WindowDialog" parent="Ui/UiSystem"]
visible = true
margin_left = -2580.0
Expand Down Expand Up @@ -7515,8 +7540,8 @@ script = SubResource( 20 )
[connection signal="pressed" from="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabSlabset/HBoxContainer/VBoxContainer/ScrollContainer/VBoxContainer/SlabsetCopyValues" to="Ui/UiSystem/SlabsetWindow" method="_on_SlabsetCopyValues_pressed"]
[connection signal="pressed" from="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabSlabset/HBoxContainer/VBoxContainer/PanelContainer/HBoxContainer/SlabsetHelpButton" to="Ui/UiSystem/SlabsetWindow" method="_on_SlabsetHelpButton_pressed"]
[connection signal="pressed" from="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabSlabset/HBoxContainer/VBoxContainer/PanelContainer/HBoxContainer/ExportSlabsToml" to="Ui/UiSystem/SlabsetWindow" method="_on_ExportSlabsToml_pressed"]
[connection signal="pressed" from="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/VBoxContainer/PanelContainer2/HBoxContainer/ColumnsetHelpButton" to="Ui/UiSystem/SlabsetWindow" method="_on_ColumnsetHelpButton_pressed"]
[connection signal="pressed" from="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/VBoxContainer/PanelContainer2/HBoxContainer/ExportColumnsToml" to="Ui/UiSystem/SlabsetWindow" method="_on_ExportColumnsToml_pressed"]
[connection signal="pressed" from="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/HBoxContainer/VBoxContainer/PanelContainer2/HBoxContainer/ColumnsetHelpButton" to="Ui/UiSystem/SlabsetWindow" method="_on_ColumnsetHelpButton_pressed"]
[connection signal="pressed" from="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabColumnset/HBoxContainer/VBoxContainer/PanelContainer2/HBoxContainer/ExportColumnsToml" to="Ui/UiSystem/SlabsetWindow" method="_on_ExportColumnsToml_pressed"]
[connection signal="visibility_changed" from="Ui/UiSystem/NewMapWindow" to="Ui/UiSystem/NewMapWindow" method="_on_NewMapWindow_visibility_changed"]
[connection signal="item_selected" from="Ui/UiSystem/NewMapWindow/MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer3/SetNewFormat" to="Ui/UiSystem/NewMapWindow" method="_on_NewMapFormat_item_selected"]
[connection signal="focus_exited" from="Ui/UiSystem/NewMapWindow/MarginContainer/HBoxContainer/VBoxContainer/HBoxContainer2/HBoxContainer/XSizeLine" to="Ui/UiSystem/NewMapWindow" method="_on_XSizeLine_focus_exited"]
Expand Down
25 changes: 14 additions & 11 deletions Scenes/SlabsetPathsLabel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,24 @@ onready var oCfgLoader = Nodelist.list["oCfgLoader"]

onready var containerForLabels = $ScrollContainer/VBoxContainer

# THIS SCRIPT IS USED BY BOTH SlabsetPathsLabel AND ColumnsetPathsLabel

func start():
var fileName
match name:
"SlabsetPathsLabel": fileName = "slabset.toml"
"ColumnsetPathsLabel": fileName = "columnset.toml"

for i in containerForLabels.get_children():
i.queue_free()

for cfg_type in [oCfgLoader.LOAD_CFG_FXDATA, oCfgLoader.LOAD_CFG_CAMPAIGN, oCfgLoader.LOAD_CFG_CURRENT_MAP]:
if oCfgLoader.paths_loaded.has(cfg_type) == false:
continue

# var addToGrid

# match cfg_type:
# oCfgLoader.LOAD_CFG_FXDATA:
# addToGrid = oFileListGridA
# oCfgLoader.LOAD_CFG_CAMPAIGN:
# addToGrid = oFileListGridB
# oCfgLoader.LOAD_CFG_CURRENT_MAP:
# addToGrid = oFileListGridC

for path in oCfgLoader.paths_loaded[cfg_type]:
if path:
if path.to_lower().ends_with("slabset.toml"):
if path.to_lower().ends_with(fileName):
add_linkbutton(path)

func add_linkbutton(path):
Expand All @@ -35,3 +32,9 @@ func add_linkbutton(path):

func _on_linkbutton_pressed(path):
OS.shell_open(path)


# match cfg_type:
# oCfgLoader.LOAD_CFG_FXDATA:
# oCfgLoader.LOAD_CFG_CAMPAIGN:
# oCfgLoader.LOAD_CFG_CURRENT_MAP:
2 changes: 2 additions & 0 deletions Scenes/SlabsetWindow.gd
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ onready var oOverheadGraphics = Nodelist.list["oOverheadGraphics"]
onready var oAddCustomSlabWindow = Nodelist.list["oAddCustomSlabWindow"]
onready var oCurrentMap = Nodelist.list["oCurrentMap"]
onready var oSlabsetPathsLabel = Nodelist.list["oSlabsetPathsLabel"]
onready var oColumnsetPathsLabel = Nodelist.list["oColumnsetPathsLabel"]

var clipboard = {
"dat": [],
Expand Down Expand Up @@ -101,6 +102,7 @@ func _on_SlabsetWindow_visibility_changed():
_on_SlabsetIDSpinBox_value_changed(oSlabsetIDSpinBox.value)

oSlabsetPathsLabel.start()
oColumnsetPathsLabel.start()

yield(get_tree(),'idle_frame')
oDkSlabsetVoxelView.oAllVoxelObjects.visible = true
Expand Down

0 comments on commit 84f5550

Please sign in to comment.