Made costumes work again !build

This commit is contained in:
2025-07-22 05:42:26 +10:00
parent e8620611df
commit 722fed9b94
6 changed files with 169 additions and 13 deletions

View File

@@ -477,8 +477,8 @@ func _on_load_dialog_file_selected(path):
if data[item].has("costumeLayers"): if data[item].has("costumeLayers"):
sprite.costumeLayers = str_to_var(data[item]["costumeLayers"]).duplicate() sprite.costumeLayers = str_to_var(data[item]["costumeLayers"]).duplicate()
if sprite.costumeLayers.size() < 8: # Ensure we have exactly 10 costume layers
for i in range(5): while sprite.costumeLayers.size() < 10:
sprite.costumeLayers.append(1) sprite.costumeLayers.append(1)
if data[item].has("stretchAmount"): if data[item].has("stretchAmount"):
@@ -718,8 +718,10 @@ func changeCostumeStreamDeck(id: String):
"9":changeCostume(9) "9":changeCostume(9)
"10":changeCostume(10) "10":changeCostume(10)
func changeCostume(newCostume): func changeCostume(newCostume, preserve_selection: bool = false):
costume = newCostume costume = newCostume
# Only clear heldSprite for actual costume changes, not layer updates
if not preserve_selection:
Global.heldSprite = null Global.heldSprite = null
var nodes = get_tree().get_nodes_in_group("saved") var nodes = get_tree().get_nodes_in_group("saved")
for sprite in nodes: for sprite in nodes:
@@ -743,7 +745,7 @@ func moveSpriteMenu(delta):
var size = get_viewport().get_visible_rect().size var size = get_viewport().get_visible_rect().size
var windowLength = 1800 var windowLength = 2000
$ViewerArrows/Arrows.position.y = size.y - 25 $ViewerArrows/Arrows.position.y = size.y - 25

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://41u8egcau00i"
path="res://.godot/imported/checkmark.png-7bf604eba3017c173b17bad2b166951a.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://ui_scenes/button sprites/checkmark.png"
dest_files=["res://.godot/imported/checkmark.png-7bf604eba3017c173b17bad2b166951a.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -355,6 +355,9 @@ func changeRotLimit():
$VBoxContainer/RotationalLimitsSection/RotBack/RotLineDisplay2.rotation_degrees = Global.heldSprite.rLimitMax $VBoxContainer/RotationalLimitsSection/RotBack/RotLineDisplay2.rotation_degrees = Global.heldSprite.rLimitMax
func setLayerButtons(): func setLayerButtons():
if Global.heldSprite == null:
return
var a = Global.heldSprite.costumeLayers.duplicate() var a = Global.heldSprite.costumeLayers.duplicate()
$VBoxContainer/LayersSection/HBoxContainer/Layer1Container/Layer1.frame = 1-a[0] $VBoxContainer/LayersSection/HBoxContainer/Layer1Container/Layer1.frame = 1-a[0]
@@ -368,6 +371,10 @@ func setLayerButtons():
$VBoxContainer/LayersSection/HBoxContainer2/Layer9Container/Layer9.frame = 1-a[8] $VBoxContainer/LayersSection/HBoxContainer2/Layer9Container/Layer9.frame = 1-a[8]
$VBoxContainer/LayersSection/HBoxContainer2/Layer10Container/Layer10.frame = 1-a[9] $VBoxContainer/LayersSection/HBoxContainer2/Layer10Container/Layer10.frame = 1-a[9]
# Update checkmarks to show current costume layer
updateLayerCheckmarks()
# Update sprite visibility for all sprites based on current costume
var nodes = get_tree().get_nodes_in_group("saved") var nodes = get_tree().get_nodes_in_group("saved")
for sprite in nodes: for sprite in nodes:
if sprite.costumeLayers[Global.main.costume - 1] == 1: if sprite.costumeLayers[Global.main.costume - 1] == 1:
@@ -377,6 +384,44 @@ func setLayerButtons():
sprite.visible = false sprite.visible = false
sprite.changeCollision(false) sprite.changeCollision(false)
# Update the sprite list to reflect visibility changes
Global.spriteList.updateAllVisible()
func updateLayerCheckmarks():
# Hide all checkmarks first
$VBoxContainer/LayersSection/HBoxContainer/Layer1Container/Layer1/Checkmark1.visible = false
$VBoxContainer/LayersSection/HBoxContainer/Layer2Container/Layer2/Checkmark2.visible = false
$VBoxContainer/LayersSection/HBoxContainer/Layer3Container/Layer3/Checkmark3.visible = false
$VBoxContainer/LayersSection/HBoxContainer/Layer4Container/Layer4/Checkmark4.visible = false
$VBoxContainer/LayersSection/HBoxContainer/Layer5Container/Layer5/Checkmark5.visible = false
$VBoxContainer/LayersSection/HBoxContainer2/Layer6Container/Layer6/Checkmark6.visible = false
$VBoxContainer/LayersSection/HBoxContainer2/Layer7Container/Layer7/Checkmark7.visible = false
$VBoxContainer/LayersSection/HBoxContainer2/Layer8Container/Layer8/Checkmark8.visible = false
$VBoxContainer/LayersSection/HBoxContainer2/Layer9Container/Layer9/Checkmark9.visible = false
$VBoxContainer/LayersSection/HBoxContainer2/Layer10Container/Layer10/Checkmark10.visible = false
# Show checkmark for current costume layer
match Global.main.costume:
1:
$VBoxContainer/LayersSection/HBoxContainer/Layer1Container/Layer1/Checkmark1.visible = true
2:
$VBoxContainer/LayersSection/HBoxContainer/Layer2Container/Layer2/Checkmark2.visible = true
3:
$VBoxContainer/LayersSection/HBoxContainer/Layer3Container/Layer3/Checkmark3.visible = true
4:
$VBoxContainer/LayersSection/HBoxContainer/Layer4Container/Layer4/Checkmark4.visible = true
5:
$VBoxContainer/LayersSection/HBoxContainer/Layer5Container/Layer5/Checkmark5.visible = true
6:
$VBoxContainer/LayersSection/HBoxContainer2/Layer6Container/Layer6/Checkmark6.visible = true
7:
$VBoxContainer/LayersSection/HBoxContainer2/Layer7Container/Layer7/Checkmark7.visible = true
8:
$VBoxContainer/LayersSection/HBoxContainer2/Layer8Container/Layer8/Checkmark8.visible = true
9:
$VBoxContainer/LayersSection/HBoxContainer2/Layer9Container/Layer9/Checkmark9.visible = true
10:
$VBoxContainer/LayersSection/HBoxContainer2/Layer10Container/Layer10/Checkmark10.visible = true
func _on_layer_button_1_pressed(): func _on_layer_button_1_pressed():
@@ -477,6 +522,11 @@ func layerSelected():
10: 10:
newPos = $VBoxContainer/LayersSection/HBoxContainer2/Layer10Container/Layer10.position newPos = $VBoxContainer/LayersSection/HBoxContainer2/Layer10Container/Layer10.position
# Update selection indicator position if it exists
var select_node = get_node_or_null("VBoxContainer/LayersSection/Select")
if select_node:
select_node.position = newPos
func _on_clip_linked_toggled(button_pressed): func _on_clip_linked_toggled(button_pressed):
Global.heldSprite.setClip(button_pressed) Global.heldSprite.setClip(button_pressed)
@@ -492,7 +542,7 @@ func _on_delete_pressed():
Global.heldSprite.makeVis() Global.heldSprite.makeVis()
func _on_set_toggle_pressed(): func _on_set_toggle_pressed():
$VBoxContainer/BoxContainer/setToggle/Labelbel.text = "toggle: AWAITING INPUT" $VBoxContainer/BoxContainer/setToggle/Label.text = "toggle: AWAITING INPUT"
await Global.main.fatfuckingballs await Global.main.fatfuckingballs
var keys = await Global.main.spriteVisToggles var keys = await Global.main.spriteVisToggles

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=77 format=4 uid="uid://d3anahesvdgfh"] [gd_scene load_steps=78 format=4 uid="uid://d3anahesvdgfh"]
[ext_resource type="Script" uid="uid://bgoaqt86bc73p" path="res://ui_scenes/spriteEditMenu/sprite_viewer.gd" id="1_hp0e3"] [ext_resource type="Script" uid="uid://bgoaqt86bc73p" path="res://ui_scenes/spriteEditMenu/sprite_viewer.gd" id="1_hp0e3"]
[ext_resource type="FontFile" uid="uid://ukj8gv8ucqsg" path="res://font/goober_pixel.ttf" id="2_da8lk"] [ext_resource type="FontFile" uid="uid://ukj8gv8ucqsg" path="res://font/goober_pixel.ttf" id="2_da8lk"]
@@ -27,11 +27,12 @@
[ext_resource type="Texture2D" uid="uid://drcl08v4k3laj" path="res://ui_scenes/spriteEditMenu/layerButtons/8.png" id="22_041y0"] [ext_resource type="Texture2D" uid="uid://drcl08v4k3laj" path="res://ui_scenes/spriteEditMenu/layerButtons/8.png" id="22_041y0"]
[ext_resource type="Texture2D" uid="uid://byyf5t56u3fq8" path="res://ui_scenes/spriteEditMenu/layerButtons/9.png" id="23_wja1u"] [ext_resource type="Texture2D" uid="uid://byyf5t56u3fq8" path="res://ui_scenes/spriteEditMenu/layerButtons/9.png" id="23_wja1u"]
[ext_resource type="Texture2D" uid="uid://dxxj6jvajo37s" path="res://ui_scenes/spriteEditMenu/layerButtons/10.png" id="24_1m26d"] [ext_resource type="Texture2D" uid="uid://dxxj6jvajo37s" path="res://ui_scenes/spriteEditMenu/layerButtons/10.png" id="24_1m26d"]
[ext_resource type="Texture2D" uid="uid://41u8egcau00i" path="res://ui_scenes/button sprites/checkmark.png" id="25_checkmark"]
[ext_resource type="Texture2D" uid="uid://23rqddatjku3" path="res://ui_scenes/mouse/tooltipBox.png" id="26_8cfad"] [ext_resource type="Texture2D" uid="uid://23rqddatjku3" path="res://ui_scenes/mouse/tooltipBox.png" id="26_8cfad"]
[ext_resource type="Texture2D" uid="uid://gflmeocxfnrq" path="res://ui_scenes/settings/deleteHotkey.png" id="27_fgu6g"] [ext_resource type="Texture2D" uid="uid://gflmeocxfnrq" path="res://ui_scenes/settings/deleteHotkey.png" id="27_fgu6g"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_21kva"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_21kva"]
size = Vector2(245, 1597) size = Vector2(261, 1794)
[sub_resource type="ShaderMaterial" id="ShaderMaterial_hxmah"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_hxmah"]
shader = ExtResource("3_ky0lu") shader = ExtResource("3_ky0lu")
@@ -14290,7 +14291,7 @@ script = ExtResource("1_hp0e3")
z_index = -2 z_index = -2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"] [node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(122.5, 798.5) position = Vector2(130.5, 899)
shape = SubResource("RectangleShape2D_21kva") shape = SubResource("RectangleShape2D_21kva")
[node name="NinePatchRect" type="NinePatchRect" parent="."] [node name="NinePatchRect" type="NinePatchRect" parent="."]
@@ -14783,7 +14784,6 @@ size_flags_horizontal = 0
size_flags_vertical = 0 size_flags_vertical = 0
[node name="Layer1" type="Sprite2D" parent="VBoxContainer/LayersSection/HBoxContainer/Layer1Container"] [node name="Layer1" type="Sprite2D" parent="VBoxContainer/LayersSection/HBoxContainer/Layer1Container"]
z_as_relative = false
position = Vector2(22, 22) position = Vector2(22, 22)
texture = ExtResource("15_scank") texture = ExtResource("15_scank")
hframes = 2 hframes = 2
@@ -14796,6 +14796,11 @@ offset_bottom = 22.0
theme = SubResource("Theme_ig6qj") theme = SubResource("Theme_ig6qj")
flat = true flat = true
[node name="Checkmark1" type="Sprite2D" parent="VBoxContainer/LayersSection/HBoxContainer/Layer1Container/Layer1"]
visible = false
position = Vector2(14, 12)
texture = ExtResource("25_checkmark")
[node name="Layer2Container" type="Control" parent="VBoxContainer/LayersSection/HBoxContainer"] [node name="Layer2Container" type="Control" parent="VBoxContainer/LayersSection/HBoxContainer"]
custom_minimum_size = Vector2(44, 44) custom_minimum_size = Vector2(44, 44)
layout_mode = 2 layout_mode = 2
@@ -14815,6 +14820,11 @@ offset_bottom = 22.0
theme = SubResource("Theme_ig6qj") theme = SubResource("Theme_ig6qj")
flat = true flat = true
[node name="Checkmark2" type="Sprite2D" parent="VBoxContainer/LayersSection/HBoxContainer/Layer2Container/Layer2"]
visible = false
position = Vector2(14, 12)
texture = ExtResource("25_checkmark")
[node name="Layer3Container" type="Control" parent="VBoxContainer/LayersSection/HBoxContainer"] [node name="Layer3Container" type="Control" parent="VBoxContainer/LayersSection/HBoxContainer"]
custom_minimum_size = Vector2(44, 44) custom_minimum_size = Vector2(44, 44)
layout_mode = 2 layout_mode = 2
@@ -14834,6 +14844,11 @@ offset_bottom = 22.0
theme = SubResource("Theme_ig6qj") theme = SubResource("Theme_ig6qj")
flat = true flat = true
[node name="Checkmark3" type="Sprite2D" parent="VBoxContainer/LayersSection/HBoxContainer/Layer3Container/Layer3"]
visible = false
position = Vector2(14, 12)
texture = ExtResource("25_checkmark")
[node name="Layer4Container" type="Control" parent="VBoxContainer/LayersSection/HBoxContainer"] [node name="Layer4Container" type="Control" parent="VBoxContainer/LayersSection/HBoxContainer"]
custom_minimum_size = Vector2(44, 44) custom_minimum_size = Vector2(44, 44)
layout_mode = 2 layout_mode = 2
@@ -14853,6 +14868,11 @@ offset_bottom = 22.0
theme = SubResource("Theme_ig6qj") theme = SubResource("Theme_ig6qj")
flat = true flat = true
[node name="Checkmark4" type="Sprite2D" parent="VBoxContainer/LayersSection/HBoxContainer/Layer4Container/Layer4"]
visible = false
position = Vector2(14, 12)
texture = ExtResource("25_checkmark")
[node name="Layer5Container" type="Control" parent="VBoxContainer/LayersSection/HBoxContainer"] [node name="Layer5Container" type="Control" parent="VBoxContainer/LayersSection/HBoxContainer"]
custom_minimum_size = Vector2(44, 44) custom_minimum_size = Vector2(44, 44)
layout_mode = 2 layout_mode = 2
@@ -14872,6 +14892,11 @@ offset_bottom = 22.0
theme = SubResource("Theme_ig6qj") theme = SubResource("Theme_ig6qj")
flat = true flat = true
[node name="Checkmark5" type="Sprite2D" parent="VBoxContainer/LayersSection/HBoxContainer/Layer5Container/Layer5"]
visible = false
position = Vector2(14, 12)
texture = ExtResource("25_checkmark")
[node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/LayersSection"] [node name="HBoxContainer2" type="HBoxContainer" parent="VBoxContainer/LayersSection"]
layout_mode = 2 layout_mode = 2
theme_override_constants/separation = 5 theme_override_constants/separation = 5
@@ -14895,6 +14920,11 @@ offset_bottom = 22.0
theme = SubResource("Theme_ig6qj") theme = SubResource("Theme_ig6qj")
flat = true flat = true
[node name="Checkmark6" type="Sprite2D" parent="VBoxContainer/LayersSection/HBoxContainer2/Layer6Container/Layer6"]
visible = false
position = Vector2(14, 12)
texture = ExtResource("25_checkmark")
[node name="Layer7Container" type="Control" parent="VBoxContainer/LayersSection/HBoxContainer2"] [node name="Layer7Container" type="Control" parent="VBoxContainer/LayersSection/HBoxContainer2"]
custom_minimum_size = Vector2(44, 44) custom_minimum_size = Vector2(44, 44)
layout_mode = 2 layout_mode = 2
@@ -14914,6 +14944,11 @@ offset_bottom = 22.0
theme = SubResource("Theme_ig6qj") theme = SubResource("Theme_ig6qj")
flat = true flat = true
[node name="Checkmark7" type="Sprite2D" parent="VBoxContainer/LayersSection/HBoxContainer2/Layer7Container/Layer7"]
visible = false
position = Vector2(14, 12)
texture = ExtResource("25_checkmark")
[node name="Layer8Container" type="Control" parent="VBoxContainer/LayersSection/HBoxContainer2"] [node name="Layer8Container" type="Control" parent="VBoxContainer/LayersSection/HBoxContainer2"]
custom_minimum_size = Vector2(44, 44) custom_minimum_size = Vector2(44, 44)
layout_mode = 2 layout_mode = 2
@@ -14933,6 +14968,11 @@ offset_bottom = 22.0
theme = SubResource("Theme_ig6qj") theme = SubResource("Theme_ig6qj")
flat = true flat = true
[node name="Checkmark8" type="Sprite2D" parent="VBoxContainer/LayersSection/HBoxContainer2/Layer8Container/Layer8"]
visible = false
position = Vector2(14, 12)
texture = ExtResource("25_checkmark")
[node name="Layer9Container" type="Control" parent="VBoxContainer/LayersSection/HBoxContainer2"] [node name="Layer9Container" type="Control" parent="VBoxContainer/LayersSection/HBoxContainer2"]
custom_minimum_size = Vector2(44, 44) custom_minimum_size = Vector2(44, 44)
layout_mode = 2 layout_mode = 2
@@ -14952,6 +14992,11 @@ offset_bottom = 22.0
theme = SubResource("Theme_ig6qj") theme = SubResource("Theme_ig6qj")
flat = true flat = true
[node name="Checkmark9" type="Sprite2D" parent="VBoxContainer/LayersSection/HBoxContainer2/Layer9Container/Layer9"]
visible = false
position = Vector2(14, 12)
texture = ExtResource("25_checkmark")
[node name="Layer10Container" type="Control" parent="VBoxContainer/LayersSection/HBoxContainer2"] [node name="Layer10Container" type="Control" parent="VBoxContainer/LayersSection/HBoxContainer2"]
custom_minimum_size = Vector2(44, 44) custom_minimum_size = Vector2(44, 44)
layout_mode = 2 layout_mode = 2
@@ -14971,6 +15016,11 @@ offset_bottom = 22.0
theme = SubResource("Theme_ig6qj") theme = SubResource("Theme_ig6qj")
flat = true flat = true
[node name="Checkmark10" type="Sprite2D" parent="VBoxContainer/LayersSection/HBoxContainer2/Layer10Container/Layer10"]
visible = false
position = Vector2(14, 12)
texture = ExtResource("25_checkmark")
[node name="BoxContainer" type="BoxContainer" parent="VBoxContainer"] [node name="BoxContainer" type="BoxContainer" parent="VBoxContainer"]
layout_mode = 2 layout_mode = 2
@@ -15024,5 +15074,15 @@ centered = false
[connection signal="pressed" from="VBoxContainer/Buttons/TrashWrapper/Trash/trash" to="." method="_on_trash_pressed"] [connection signal="pressed" from="VBoxContainer/Buttons/TrashWrapper/Trash/trash" to="." method="_on_trash_pressed"]
[connection signal="toggled" from="VBoxContainer/RenderingSection/ClipLinked" to="." method="_on_clip_linked_toggled"] [connection signal="toggled" from="VBoxContainer/RenderingSection/ClipLinked" to="." method="_on_clip_linked_toggled"]
[connection signal="toggled" from="VBoxContainer/PhysicsSection/BounceVelocity" to="." method="_on_check_box_toggled"] [connection signal="toggled" from="VBoxContainer/PhysicsSection/BounceVelocity" to="." method="_on_check_box_toggled"]
[connection signal="pressed" from="VBoxContainer/LayersSection/HBoxContainer/Layer1Container/Layer1/layerButton1" to="." method="_on_layer_button_1_pressed"]
[connection signal="pressed" from="VBoxContainer/LayersSection/HBoxContainer/Layer2Container/Layer2/layerButton2" to="." method="_on_layer_button_2_pressed"]
[connection signal="pressed" from="VBoxContainer/LayersSection/HBoxContainer/Layer3Container/Layer3/layerButton3" to="." method="_on_layer_button_3_pressed"]
[connection signal="pressed" from="VBoxContainer/LayersSection/HBoxContainer/Layer4Container/Layer4/layerButton4" to="." method="_on_layer_button_4_pressed"]
[connection signal="pressed" from="VBoxContainer/LayersSection/HBoxContainer/Layer5Container/Layer5/layerButton5" to="." method="_on_layer_button_5_pressed"]
[connection signal="pressed" from="VBoxContainer/LayersSection/HBoxContainer2/Layer6Container/Layer6/layerButton6" to="." method="_on_layer_button_6_pressed"]
[connection signal="pressed" from="VBoxContainer/LayersSection/HBoxContainer2/Layer7Container/Layer7/layerButton7" to="." method="_on_layer_button_7_pressed"]
[connection signal="pressed" from="VBoxContainer/LayersSection/HBoxContainer2/Layer8Container/Layer8/layerButton8" to="." method="_on_layer_button_8_pressed"]
[connection signal="pressed" from="VBoxContainer/LayersSection/HBoxContainer2/Layer9Container/Layer9/layerButton9" to="." method="_on_layer_button_9_pressed"]
[connection signal="pressed" from="VBoxContainer/LayersSection/HBoxContainer2/Layer10Container/Layer10/layerButton10" to="." method="_on_layer_button_10_pressed"]
[connection signal="pressed" from="VBoxContainer/BoxContainer/setToggle" to="." method="_on_set_toggle_pressed"] [connection signal="pressed" from="VBoxContainer/BoxContainer/setToggle" to="." method="_on_set_toggle_pressed"]
[connection signal="pressed" from="VBoxContainer/BoxContainer/setToggle/delete" to="." method="_on_delete_pressed"] [connection signal="pressed" from="VBoxContainer/BoxContainer/setToggle/delete" to="." method="_on_delete_pressed"]

View File

@@ -54,6 +54,16 @@ func _setup_context_menu():
context_menu.add_item("Rename", 0) context_menu.add_item("Rename", 0)
context_menu.id_pressed.connect(_on_context_menu_selected) context_menu.id_pressed.connect(_on_context_menu_selected)
# Wait for menu to be ready, then adjust size
context_menu.ready.connect(_adjust_menu_size)
## Adjust the context menu size to be more compact
func _adjust_menu_size():
if context_menu:
# Let the menu calculate its natural size first
await get_tree().process_frame
context_menu.reset_size() # Reset to content-based size
## Handle GUI input events on the button ## Handle GUI input events on the button
func _on_button_gui_input(event: InputEvent): func _on_button_gui_input(event: InputEvent):
if event is InputEventMouseButton: if event is InputEventMouseButton: