mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-07 10:59:49 +00:00
Change audio cel textures for the cels where audio is playing
This commit is contained in:
parent
f398a6159c
commit
a7efc3eb03
|
@ -8,6 +8,7 @@ signal serialized(dict: Dictionary)
|
||||||
signal about_to_deserialize(dict: Dictionary)
|
signal about_to_deserialize(dict: Dictionary)
|
||||||
signal resized
|
signal resized
|
||||||
signal timeline_updated
|
signal timeline_updated
|
||||||
|
signal fps_changed
|
||||||
|
|
||||||
const INDEXED_MODE := Image.FORMAT_MAX + 1
|
const INDEXED_MODE := Image.FORMAT_MAX + 1
|
||||||
|
|
||||||
|
@ -65,7 +66,10 @@ var brushes: Array[Image] = []
|
||||||
var reference_images: Array[ReferenceImage] = []
|
var reference_images: Array[ReferenceImage] = []
|
||||||
var reference_index: int = -1 # The currently selected index ReferenceImage
|
var reference_index: int = -1 # The currently selected index ReferenceImage
|
||||||
var vanishing_points := [] ## Array of Vanishing Points
|
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 user_data := "" ## User defined data, set in the project properties.
|
||||||
|
|
||||||
var x_symmetry_point: float
|
var x_symmetry_point: float
|
||||||
|
|
|
@ -31,6 +31,9 @@ func _ready() -> void:
|
||||||
popup_menu.add_item("Unlink Cels")
|
popup_menu.add_item("Unlink Cels")
|
||||||
elif cel is GroupCel:
|
elif cel is GroupCel:
|
||||||
transparent_checker.visible = false
|
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:
|
func _notification(what: int) -> void:
|
||||||
|
@ -66,7 +69,8 @@ func button_setup() -> void:
|
||||||
|
|
||||||
var base_layer := Global.current_project.layers[layer]
|
var base_layer := Global.current_project.layers[layer]
|
||||||
tooltip_text = tr("Frame: %s, Layer: %s") % [frame + 1, base_layer.name]
|
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):
|
if is_instance_valid(linked):
|
||||||
linked.visible = cel.link_set != null
|
linked.visible = cel.link_set != null
|
||||||
if 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:
|
if frame_a < frame_b:
|
||||||
return true
|
return true
|
||||||
return false
|
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
|
||||||
|
|
|
@ -74,7 +74,6 @@ grow_vertical = 2
|
||||||
[node name="PopupMenu" type="PopupMenu" parent="."]
|
[node name="PopupMenu" type="PopupMenu" parent="."]
|
||||||
item_count = 1
|
item_count = 1
|
||||||
item_0/text = "Properties"
|
item_0/text = "Properties"
|
||||||
item_0/id = 0
|
|
||||||
|
|
||||||
[connection signal="pressed" from="." to="." method="_on_CelButton_pressed"]
|
[connection signal="pressed" from="." to="." method="_on_CelButton_pressed"]
|
||||||
[connection signal="id_pressed" from="PopupMenu" to="." method="_on_PopupMenu_id_pressed"]
|
[connection signal="id_pressed" from="PopupMenu" to="." method="_on_PopupMenu_id_pressed"]
|
||||||
|
|
Loading…
Reference in a new issue