Add animation loop config, workaround for stupid Godot bug
This commit is contained in:
parent
aefd361bc9
commit
e7c98195c5
5 changed files with 49 additions and 6 deletions
|
@ -31,6 +31,7 @@ size_flags_horizontal = 3
|
|||
size_flags_vertical = 3
|
||||
theme_override_styles/panel = ExtResource("1_kscu5")
|
||||
follow_focus = true
|
||||
scroll_vertical = 400
|
||||
horizontal_scroll_mode = 0
|
||||
script = ExtResource("1_3y2tp")
|
||||
|
||||
|
@ -523,7 +524,6 @@ layout_mode = 2
|
|||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
tooltip_text = "How big the sprite is compared to its default size."
|
||||
mouse_filter = 0
|
||||
text = "Flip Sprite"
|
||||
label_settings = ExtResource("3_gn7vd")
|
||||
|
@ -534,6 +534,25 @@ layout_mode = 2
|
|||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 4
|
||||
|
||||
[node name="sprite_hold" type="HBoxContainer" parent="MarginContainer/Form/Sprites/Controls/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 32)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="MarginContainer/Form/Sprites/Controls/VBoxContainer/sprite_hold"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 1
|
||||
tooltip_text = "If you hold an animation, it will loop on every beat."
|
||||
mouse_filter = 0
|
||||
text = "Loop Holds"
|
||||
label_settings = ExtResource("3_gn7vd")
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="input" type="CheckButton" parent="MarginContainer/Form/Sprites/Controls/VBoxContainer/sprite_hold"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 8
|
||||
size_flags_vertical = 4
|
||||
|
||||
[node name="spritesheet_default_opacity" type="HBoxContainer" parent="MarginContainer/Form/Sprites/Controls/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 32)
|
||||
layout_mode = 2
|
||||
|
|
|
@ -75,6 +75,7 @@ var spritesheet_anims = {
|
|||
var spritesheet_anchor = SpritesheetAnchor.BOTTOM
|
||||
var sprite_scale = 1.0
|
||||
var sprite_flip = false
|
||||
var sprite_hold = false
|
||||
var spritesheet_default_opacity = 1.0
|
||||
|
||||
# Keybinds
|
||||
|
@ -137,6 +138,7 @@ func clone_config(config) -> void:
|
|||
self.spritesheet_anchor = config.spritesheet_anchor
|
||||
self.sprite_scale = config.sprite_scale
|
||||
self.sprite_flip = config.sprite_flip
|
||||
self.sprite_hold = config.sprite_hold
|
||||
self.spritesheet_default_opacity = config.spritesheet_default_opacity
|
||||
self.bpm_is_global = config.bpm_is_global
|
||||
self.bpm_needs_enable = config.bpm_needs_enable
|
||||
|
@ -170,6 +172,7 @@ func format_config() -> Dictionary:
|
|||
dict.spritesheet_anims = self.spritesheet_anims.duplicate(true)
|
||||
dict.sprite_scale = self.sprite_scale
|
||||
dict.sprite_flip = self.sprite_flip
|
||||
dict.sprite_hold = self.sprite_hold
|
||||
dict.spritesheet_anchor = self.spritesheet_anchor
|
||||
dict.spritesheet_default_opacity = self.spritesheet_default_opacity
|
||||
dict.bpm_is_global = self.bpm_is_global
|
||||
|
|
|
@ -43,6 +43,9 @@ func _process(delta: float) -> void:
|
|||
var beat_percentage = Tempo.beat_at_time(time - current_animation.tstamp, bpm)
|
||||
|
||||
if beat_percentage >= 1 and current_animation.active:
|
||||
if GlobalConfig.sprite_hold and current_animation.keydown:
|
||||
current_animation.tstamp = time
|
||||
beat_percentage = 0
|
||||
if current_animation.type == Config.SpritesheetAnimType.IDLE:
|
||||
current_animation.tstamp = time
|
||||
beat_percentage = 0
|
||||
|
|
|
@ -15,6 +15,7 @@ extends VBoxContainer
|
|||
@onready var spritesheet_anchor = $"Sprites/Controls/VBoxContainer/spritesheet_anchor"
|
||||
@onready var sprite_scale = $"Sprites/Controls/VBoxContainer/sprite_scale"
|
||||
@onready var sprite_flip = $"Sprites/Controls/VBoxContainer/sprite_flip"
|
||||
@onready var sprite_hold = $"Sprites/Controls/VBoxContainer/sprite_hold"
|
||||
@onready var spritesheet_default_opacity = $"Sprites/Controls/VBoxContainer/spritesheet_default_opacity"
|
||||
|
||||
@onready var anims = $"Binds/Controls/VBoxContainer"
|
||||
|
@ -48,6 +49,7 @@ func _ready() -> void:
|
|||
link_optionbutton_to_property(spritesheet_anchor, "spritesheet_anchor", Config.SpritesheetAnchor)
|
||||
link_range_to_property(sprite_scale, "sprite_scale")
|
||||
link_toggleable_to_property(sprite_flip, "sprite_flip")
|
||||
link_toggleable_to_property(sprite_hold, "sprite_hold")
|
||||
link_value_to_slider(spritesheet_default_opacity)
|
||||
link_range_to_property(spritesheet_default_opacity, "spritesheet_default_opacity")
|
||||
fuckwith_anims()
|
||||
|
|
|
@ -36,6 +36,8 @@ var selected_frame:int = 0
|
|||
var image_path = GlobalConfig.spritesheet_image
|
||||
var data_path = GlobalConfig.spritesheet_data
|
||||
|
||||
var fuck_you_godot_signals = 0
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
var frame:ReferenceRect = region_viewport.get_node("ReferenceRect")
|
||||
|
@ -56,18 +58,25 @@ func _ready() -> void:
|
|||
set_region_view()
|
||||
)
|
||||
link_pos_to_callable_e(region_pos, func(_val: int):
|
||||
if ts_dont_change_internal: return
|
||||
if ts_dont_change_internal or fuck_you_godot_signals:
|
||||
fuck_you_godot_signals -= 1
|
||||
return
|
||||
set_property_on_current_frame("pos", get_vector(region_pos))
|
||||
set_region_view()
|
||||
)
|
||||
link_pos_to_callable_e(region_size, func(_val: int):
|
||||
if ts_dont_change_internal: return
|
||||
if ts_dont_change_internal or fuck_you_godot_signals:
|
||||
fuck_you_godot_signals -= 1
|
||||
return
|
||||
print("test size", ts_dont_change_internal)
|
||||
set_property_on_current_frame("size", get_vector(region_size))
|
||||
set_region_view()
|
||||
update_current_frame_child()
|
||||
)
|
||||
link_pos_to_callable_e(sprite_offset, func(_val: int):
|
||||
if ts_dont_change_internal: return
|
||||
if ts_dont_change_internal or fuck_you_godot_signals:
|
||||
fuck_you_godot_signals -= 1
|
||||
return
|
||||
set_property_on_current_frame("frame_pos", get_vector(sprite_offset))
|
||||
set_region_view()
|
||||
)
|
||||
|
@ -208,8 +217,11 @@ func link_range_to_callable(obj:BoxContainer, callable:Callable, value) -> void:
|
|||
func set_vector(obj:BoxContainer, vector:Vector2) -> void:
|
||||
var x:Range = obj.get_node("value_w")
|
||||
var y:Range = obj.get_node("value_h")
|
||||
x.value = vector.x
|
||||
y.value = vector.y
|
||||
fuck_you_godot_signals = 3
|
||||
x.set_value_no_signal(vector.x)
|
||||
y.set_value_no_signal(vector.y)
|
||||
x.set_value_no_signal(vector.x)
|
||||
y.set_value_no_signal(vector.y)
|
||||
|
||||
func get_vector(obj:BoxContainer) -> Vector2:
|
||||
var x:Range = obj.get_node("value_w")
|
||||
|
@ -478,6 +490,10 @@ func set_three_stooges() -> void:
|
|||
|
||||
ts_dont_change_internal = true
|
||||
|
||||
region_pos.release_focus()
|
||||
region_size.release_focus()
|
||||
sprite_offset.release_focus()
|
||||
|
||||
set_vector(region_pos, atlas.region.position)
|
||||
set_vector(region_size, atlas.region.size)
|
||||
set_vector(sprite_offset, character.position)
|
||||
|
|
Loading…
Reference in a new issue