added blend modes

This commit is contained in:
2025-07-20 22:14:42 +10:00
parent ef8ecb3732
commit 43dfc410dc
10 changed files with 242 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ extends Node2D
@onready var coverCollider = $Area2D/CollisionShape2D
@onready var wobbleSyncControl = null # Will be assigned in _ready()
@onready var blendModeDropdown = $Opacity/blendModeDropdown
func _ready():
Global.spriteEdit = self
@@ -19,6 +20,9 @@ func _ready():
if wobbleSyncControl == null:
print("Warning: WobbleSyncControl node not found in sprite viewer")
# Set up blend mode dropdown
setupBlendModeDropdown()
func setImage():
if Global.heldSprite == null:
return
@@ -81,6 +85,7 @@ func setImage():
$Opacity/opacityLabel.text = "opacity: " + str(int(Global.heldSprite.spriteOpacity * 100)) + "%"
$Opacity/opacitySlider.value = Global.heldSprite.spriteOpacity
$Opacity/affectChildrenCheck.button_pressed = Global.heldSprite.affectChildrenOpacity
$Opacity/blendModeDropdown.selected = Global.heldSprite.blendMode
$VisToggle/setToggle/Label.text = "toggle: \"" + Global.heldSprite.toggle + "\""
@@ -449,3 +454,16 @@ func _on_opacity_slider_value_changed(value):
func _on_affect_children_check_toggled(button_pressed):
Global.heldSprite.affectChildrenOpacity = button_pressed
Global.heldSprite.updateOpacity()
## Set up the blend mode dropdown with all available blend modes
func setupBlendModeDropdown():
blendModeDropdown.clear()
var blendModeNames = BlendModeManager.get_blend_mode_names()
for mode_name in blendModeNames:
blendModeDropdown.add_item(mode_name)
## Handle blend mode dropdown selection
func _on_blend_mode_dropdown_item_selected(index: int):
if Global.heldSprite != null:
Global.heldSprite.updateBlendMode(index)
Global.pushUpdate("Blend mode set to: " + BlendModeManager.get_blend_mode_name(index))