1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-20 12:33:14 +00:00

Animation only plays on frames of the same tag

If there are no tags, the animation plays on all frames, as before. Currently no front-end way of toggling this behavior.
This commit is contained in:
OverloadedOrama 2020-04-11 20:10:07 +03:00
parent d0c4fbc6eb
commit 4c9a58a333
3 changed files with 14 additions and 5 deletions

View file

@ -132,8 +132,16 @@ func _on_FirstFrame_pressed() -> void:
Global.current_frame = 0
func _on_AnimationTimer_timeout() -> void:
var first_frame := 0
var last_frame := Global.canvases.size() - 1
if Global.play_only_tags:
for tag in Global.animation_tags:
if Global.current_frame + 1 >= tag[2] && Global.current_frame + 1 <= tag[3]:
first_frame = tag[2] - 1
last_frame = min(Global.canvases.size() - 1, tag[3] - 1)
if animation_forward:
if Global.current_frame < Global.canvases.size() - 1:
if Global.current_frame < last_frame:
Global.current_frame += 1
else:
match animation_loop:
@ -142,13 +150,13 @@ func _on_AnimationTimer_timeout() -> void:
Global.play_backwards.pressed = false
Global.animation_timer.stop()
1: # Cycle loop
Global.current_frame = 0
Global.current_frame = first_frame
2: # Ping pong loop
animation_forward = false
_on_AnimationTimer_timeout()
else:
if Global.current_frame > 0:
if Global.current_frame > first_frame:
Global.current_frame -= 1
else:
match animation_loop:
@ -157,7 +165,7 @@ func _on_AnimationTimer_timeout() -> void:
Global.play_forward.pressed = false
Global.animation_timer.stop()
1: # Cycle loop
Global.current_frame = Global.canvases.size() - 1
Global.current_frame = last_frame
2: # Ping pong loop
animation_forward = true
_on_AnimationTimer_timeout()

View file

@ -6,7 +6,7 @@ var layer := 0
onready var popup_menu := $PopupMenu
func _ready() -> void:
hint_tooltip = "Frame: %s, Layer: %s" % [frame, layer]
hint_tooltip = "Frame: %s, Layer: %s" % [frame + 1, layer]
if Global.canvases[frame] in Global.layers[layer][5]:
get_node("LinkedIndicator").visible = true
popup_menu.set_item_disabled(4, false) # Unlink cel

View file

@ -35,6 +35,7 @@ var transparent_background : ImageTexture
var selected_pixels := []
var image_clipboard : Image
var animation_tags := [] setget animation_tags_changed # [Name, Color, From, To]
var play_only_tags := true
# warning-ignore:unused_class_variable
var theme_type := "Dark"