mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Fixed crash where the animation was playing in the mini canvas preview and then the user switched to a project with less frames
This commit is contained in:
parent
4f1c19563b
commit
da24133a4d
|
@ -6,8 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
|
|
||||||
## [v0.8.1] - Unreleased
|
## [v0.8.1] - Unreleased
|
||||||
### Fixed
|
### Fixed
|
||||||
- Crash where Pixelorama could not load a cached sub-resource - [Issue #339](https://github.com/Orama-Interactive/Pixelorama/issues/339)
|
- Fixed crash where Pixelorama could not load a cached sub-resource - [Issue #339](https://github.com/Orama-Interactive/Pixelorama/issues/339)
|
||||||
- When moving tabs, the projects now move along with their respective tabs.
|
- When moving tabs, the projects now move along with their respective tabs.
|
||||||
|
- Fixed crash where the animation was playing in the mini canvas preview and then the user switched to a project with less frames.
|
||||||
<br><br>
|
<br><br>
|
||||||
|
|
||||||
## [v0.8] - 2020-09-23
|
## [v0.8] - 2020-09-23
|
||||||
|
|
|
@ -6,6 +6,9 @@ onready var animation_timer : Timer = $AnimationTimer
|
||||||
|
|
||||||
func _draw() -> void:
|
func _draw() -> void:
|
||||||
var current_project : Project = Global.current_project
|
var current_project : Project = Global.current_project
|
||||||
|
if frame >= current_project.frames.size():
|
||||||
|
frame = current_project.current_frame
|
||||||
|
|
||||||
$AnimationTimer.wait_time = Global.animation_timer.wait_time
|
$AnimationTimer.wait_time = Global.animation_timer.wait_time
|
||||||
|
|
||||||
if animation_timer.is_stopped():
|
if animation_timer.is_stopped():
|
||||||
|
|
|
@ -1,39 +1,9 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
[gd_scene load_steps=2 format=2]
|
||||||
|
|
||||||
[sub_resource type="GDScript" id=1]
|
[ext_resource path="res://src/UI/Canvas/CanvasPreview.gd" type="Script" id=1]
|
||||||
script/source = "extends Node2D
|
|
||||||
|
|
||||||
|
|
||||||
var frame : int = 0
|
|
||||||
onready var animation_timer : Timer = $AnimationTimer
|
|
||||||
|
|
||||||
func _draw() -> void:
|
|
||||||
var current_project : Project = Global.current_project
|
|
||||||
$AnimationTimer.wait_time = Global.animation_timer.wait_time
|
|
||||||
|
|
||||||
if animation_timer.is_stopped():
|
|
||||||
frame = current_project.current_frame
|
|
||||||
var current_cels : Array = current_project.frames[frame].cels
|
|
||||||
|
|
||||||
# Draw current frame layers
|
|
||||||
for i in range(current_cels.size()):
|
|
||||||
var modulate_color := Color(1, 1, 1, current_cels[i].opacity)
|
|
||||||
if i < current_project.layers.size() and current_project.layers[i].visible:
|
|
||||||
draw_texture(current_cels[i].image_texture, Vector2.ZERO, modulate_color)
|
|
||||||
|
|
||||||
|
|
||||||
func _on_AnimationTimer_timeout() -> void:
|
|
||||||
var current_project : Project = Global.current_project
|
|
||||||
|
|
||||||
if frame < current_project.frames.size() - 1:
|
|
||||||
frame += 1
|
|
||||||
else:
|
|
||||||
frame = 0
|
|
||||||
update()
|
|
||||||
"
|
|
||||||
|
|
||||||
[node name="CanvasPreview" type="Node2D"]
|
[node name="CanvasPreview" type="Node2D"]
|
||||||
script = SubResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="AnimationTimer" type="Timer" parent="."]
|
[node name="AnimationTimer" type="Timer" parent="."]
|
||||||
[connection signal="timeout" from="AnimationTimer" to="." method="_on_AnimationTimer_timeout"]
|
[connection signal="timeout" from="AnimationTimer" to="." method="_on_AnimationTimer_timeout"]
|
||||||
|
|
Loading…
Reference in a new issue