Skip to content

Commit

Permalink
Add blue highlight to spinboxes for SlabID and Variation that have be…
Browse files Browse the repository at this point in the history
…en edited
  • Loading branch information
rainlizard committed Jun 2, 2024
1 parent 74b5f85 commit be3df46
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
11 changes: 7 additions & 4 deletions Scenes/Main.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -5482,7 +5482,7 @@ size_flags_vertical = 3
anchor_right = 1.0
anchor_bottom = 1.0

[node name="SlabsetIDLabel" type="Label" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabSlabset/HBoxContainer/DkSlabsetVoxelView/Control/VBoxContainer"]
[node name="SlabsetSlabNameLabel" type="Label" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabSlabset/HBoxContainer/DkSlabsetVoxelView/Control/VBoxContainer"]
margin_right = 933.0
margin_bottom = 21.0
size_flags_vertical = 1
Expand Down Expand Up @@ -5541,12 +5541,14 @@ margin_bottom = 71.0
margin_right = 281.0
margin_bottom = 31.0
size_flags_horizontal = 11
size_flags_vertical = 3
columns = 2

[node name="Label2" type="Label" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabSlabset/HBoxContainer/VBoxContainer/ScrollContainer/VBoxContainer/PanelContainer2/VBoxContainer/GridContainer"]
[node name="SlabsetTextSIDLabel" type="Label" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabSlabset/HBoxContainer/VBoxContainer/ScrollContainer/VBoxContainer/PanelContainer2/VBoxContainer/GridContainer"]
margin_top = 5.0
margin_right = 67.0
margin_right = 139.0
margin_bottom = 26.0
size_flags_horizontal = 3
text = "Slab ID"
__meta__ = {
"_edit_use_anchors_": false
Expand Down Expand Up @@ -5609,8 +5611,9 @@ columns = 2

[node name="Label" type="Label" parent="Ui/UiSystem/SlabsetWindow/SlabsetTabs/TabSlabset/HBoxContainer/VBoxContainer/ScrollContainer/VBoxContainer/PanelContainer5/VBoxContainer/GridContainer"]
margin_top = 5.0
margin_right = 89.0
margin_right = 139.0
margin_bottom = 26.0
size_flags_horizontal = 3
text = "Variation"
__meta__ = {
"_edit_use_anchors_": false
Expand Down
24 changes: 22 additions & 2 deletions Scenes/SlabsetWindow.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ onready var oDkSlabsetVoxelView = Nodelist.list["oDkSlabsetVoxelView"]
onready var oColumnsetVoxelView = Nodelist.list["oColumnsetVoxelView"]
onready var oVariationInfoLabel = Nodelist.list["oVariationInfoLabel"]
onready var oSlabsetIDSpinBox = Nodelist.list["oSlabsetIDSpinBox"]
onready var oSlabsetIDLabel = Nodelist.list["oSlabsetIDLabel"]
onready var oSlabsetSlabNameLabel = Nodelist.list["oSlabsetSlabNameLabel"]
onready var oGridContainerDynamicColumns3x3 = Nodelist.list["oGridContainerDynamicColumns3x3"]
onready var oVariationNumberSpinBox = Nodelist.list["oVariationNumberSpinBox"]
onready var oMessage = Nodelist.list["oMessage"]
Expand Down Expand Up @@ -35,6 +35,7 @@ onready var oAddCustomSlabWindow = Nodelist.list["oAddCustomSlabWindow"]
onready var oCurrentMap = Nodelist.list["oCurrentMap"]
onready var oSlabsetPathsLabel = Nodelist.list["oSlabsetPathsLabel"]
onready var oColumnsetPathsLabel = Nodelist.list["oColumnsetPathsLabel"]
onready var oSlabsetTextSIDLabel = Nodelist.list["oSlabsetTextSIDLabel"]

enum {
ONE_VARIATION,
Expand Down Expand Up @@ -184,10 +185,25 @@ func _on_SlabsetIDSpinBox_value_changed(value):
value = int(value)
if Slabs.data.has(value):
slabName = Slabs.data[value][Slabs.NAME]
oSlabsetIDLabel.text = slabName
oSlabsetSlabNameLabel.text = slabName
update_column_spinboxes()

func update_modified_label_for_slab_id():
if Slabset.is_slab_edited(int(oSlabsetIDSpinBox.value)):
oSlabsetIDSpinBox.modulate = Color(1.4,1.4,1.7)
else:
oSlabsetIDSpinBox.modulate = Color(1,1,1)

func update_modified_label_for_variation():
var variation = get_current_variation()
if Slabset.is_dat_variation_different(variation) or Slabset.is_tng_variation_different(variation):
oVariationNumberSpinBox.modulate = Color(1.4, 1.4, 1.7)
else:
oVariationNumberSpinBox.modulate = Color(1, 1, 1)


func _on_VariationNumberSpinBox_value_changed(value):

update_column_spinboxes()

func update_column_spinboxes():
Expand Down Expand Up @@ -358,6 +374,10 @@ func adjust_column_color_if_different(variation):
else:
spinbox.modulate = Color(1,1,1)
shortcut.modulate = Color(1,1,1)

update_modified_label_for_slab_id()
update_modified_label_for_variation()


func update_objects_ui():
var variation = get_current_variation()
Expand Down

0 comments on commit be3df46

Please sign in to comment.