diff --git a/src/Classes/Layers/AudioLayer.gd b/src/Classes/Layers/AudioLayer.gd index 2bf49607d..0a6100bf4 100644 --- a/src/Classes/Layers/AudioLayer.gd +++ b/src/Classes/Layers/AudioLayer.gd @@ -2,6 +2,7 @@ class_name AudioLayer extends BaseLayer signal audio_changed +signal playback_frame_changed var audio: AudioStream: set(value): @@ -11,7 +12,10 @@ var playback_position := 0.0: ## Measured in seconds. get(): var frame := project.frames[playback_frame] return frame.position_in_seconds(project) -var playback_frame := 0 +var playback_frame := 0: + set(value): + playback_frame = value + playback_frame_changed.emit() func _init(_project: Project, _name := "") -> void: diff --git a/src/UI/Timeline/CelButton.gd b/src/UI/Timeline/CelButton.gd index 03edb4053..35ec7853b 100644 --- a/src/UI/Timeline/CelButton.gd +++ b/src/UI/Timeline/CelButton.gd @@ -32,9 +32,11 @@ func _ready() -> void: elif cel is GroupCel: transparent_checker.visible = false elif cel is AudioCel: + popup_menu.add_item("Play audio here") _is_playing_audio() Global.cel_switched.connect(_is_playing_audio) Global.current_project.fps_changed.connect(_is_playing_audio) + Global.current_project.layers[layer].playback_frame_changed.connect(_is_playing_audio) func _notification(what: int) -> void: @@ -134,7 +136,11 @@ func _on_PopupMenu_id_pressed(id: int) -> void: properties.cel_indices = _get_cel_indices() properties.popup_centered() MenuOptions.DELETE: - _delete_cel_content() + var layer_class := Global.current_project.layers[layer] + if layer_class is AudioLayer: + layer_class.playback_frame = frame + else: + _delete_cel_content() MenuOptions.LINK, MenuOptions.UNLINK: var project := Global.current_project