From be3df469b0d4747942a2960693c896c142ff7384 Mon Sep 17 00:00:00 2001 From: rainlizard <15337628+rainlizard@users.noreply.github.com> Date: Sun, 2 Jun 2024 12:48:50 +1000 Subject: [PATCH] Add blue highlight to spinboxes for SlabID and Variation that have been edited --- Scenes/Main.tscn | 11 +++++++---- Scenes/SlabsetWindow.gd | 24 ++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/Scenes/Main.tscn b/Scenes/Main.tscn index 8c263322..bf093606 100644 --- a/Scenes/Main.tscn +++ b/Scenes/Main.tscn @@ -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 @@ -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 @@ -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 diff --git a/Scenes/SlabsetWindow.gd b/Scenes/SlabsetWindow.gd index 29a09921..9fa258af 100644 --- a/Scenes/SlabsetWindow.gd +++ b/Scenes/SlabsetWindow.gd @@ -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"] @@ -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, @@ -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(): @@ -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()