1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-30 23:19:49 +00:00

Change audio cel textures for the cels where audio is playing

This commit is contained in:
Emmanouil Papadeas 2024-12-08 03:53:58 +02:00
parent f398a6159c
commit a7efc3eb03
3 changed files with 20 additions and 3 deletions

View file

@ -8,6 +8,7 @@ signal serialized(dict: Dictionary)
signal about_to_deserialize(dict: Dictionary)
signal resized
signal timeline_updated
signal fps_changed
const INDEXED_MODE := Image.FORMAT_MAX + 1
@ -65,7 +66,10 @@ var brushes: Array[Image] = []
var reference_images: Array[ReferenceImage] = []
var reference_index: int = -1 # The currently selected index ReferenceImage
var vanishing_points := [] ## Array of Vanishing Points
var fps := 6.0
var fps := 6.0:
set(value):
fps = value
fps_changed.emit()
var user_data := "" ## User defined data, set in the project properties.
var x_symmetry_point: float

View file

@ -31,6 +31,9 @@ func _ready() -> void:
popup_menu.add_item("Unlink Cels")
elif cel is GroupCel:
transparent_checker.visible = false
elif cel is AudioCel:
_is_playing_audio()
Global.current_project.fps_changed.connect(_is_playing_audio)
func _notification(what: int) -> void:
@ -66,7 +69,8 @@ func button_setup() -> void:
var base_layer := Global.current_project.layers[layer]
tooltip_text = tr("Frame: %s, Layer: %s") % [frame + 1, base_layer.name]
cel_texture.texture = cel.image_texture
if cel is not AudioCel:
cel_texture.texture = cel.image_texture
if is_instance_valid(linked):
linked.visible = cel.link_set != null
if cel.link_set != null:
@ -396,3 +400,13 @@ func _sort_cel_indices_by_frame(a: Array, b: Array) -> bool:
if frame_a < frame_b:
return true
return false
func _is_playing_audio() -> void:
var layer := Global.current_project.layers[layer] as AudioLayer
var audio_length := layer.audio.get_length()
var final_frame := audio_length * Global.current_project.fps
if frame < final_frame:
cel_texture.texture = preload("res://assets/graphics/icons/icon.png")
else:
cel_texture.texture = null

View file

@ -74,7 +74,6 @@ grow_vertical = 2
[node name="PopupMenu" type="PopupMenu" parent="."]
item_count = 1
item_0/text = "Properties"
item_0/id = 0
[connection signal="pressed" from="." to="." method="_on_CelButton_pressed"]
[connection signal="id_pressed" from="PopupMenu" to="." method="_on_PopupMenu_id_pressed"]