1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Compare commits

...

7 commits

Author SHA1 Message Date
Variable c9451580d8
Merge 5a8c79339d into 206773c4e7 2024-12-14 21:08:42 +02:00
Emmanouil Papadeas 206773c4e7 Play audio at the correct frame when switching frames while the animation is running 2024-12-14 21:08:31 +02:00
Emmanouil Papadeas b5d5c44c4b Use the linked cel rectangle for audio cels 2024-12-14 18:01:46 +02:00
Emmanouil Papadeas 8e55b91a39 Unmute audio layes when making them visible while the animation is playing 2024-12-14 17:18:52 +02:00
Emmanouil Papadeas 0fad406967 Fix extension entry enlarged thumbnail dialog not being on top 2024-12-14 16:58:43 +02:00
Emmanouil Papadeas 4b12f764b5 Add a MarginContainer in the timeline's animation buttons 2024-12-14 16:10:05 +02:00
Emmanouil Papadeas 02d1900dc2 Make brush size in draw tools not affect the draw tiles mode
We could change it again if we implement it in a non-confusing way
2024-12-14 16:05:51 +02:00
6 changed files with 106 additions and 70 deletions

View file

@ -212,8 +212,7 @@ func update_brush() -> void:
$DensityValueSlider.visible = _brush.type not in IMAGE_BRUSHES
$ColorInterpolation.visible = _brush.type in IMAGE_BRUSHES
$RotationOptions.visible = _brush.type in IMAGE_BRUSHES
var canvas_indicators := Global.canvas.indicators
canvas_indicators.queue_redraw()
Global.canvas.indicators.queue_redraw()
func update_random_image() -> void:
@ -378,6 +377,8 @@ func _prepare_tool() -> void:
func _draw_tool(pos: Vector2) -> PackedVector2Array:
if !Global.current_project.layers[Global.current_project.current_layer].can_layer_get_drawn():
return PackedVector2Array() # empty fallback
if Tools.is_placing_tiles():
return _compute_draw_tool_pixel(pos)
match _brush.type:
Brushes.PIXEL:
return _compute_draw_tool_pixel(pos)
@ -428,9 +429,12 @@ func draw_fill_gap(start: Vector2i, end: Vector2i) -> void:
## Compute the array of coordinates that should be drawn
func _compute_draw_tool_pixel(pos: Vector2) -> PackedVector2Array:
var brush_size := _brush_size_dynamics
if Tools.is_placing_tiles():
brush_size = 1
var result := PackedVector2Array()
var start := pos - Vector2.ONE * (_brush_size_dynamics >> 1)
var end := start + Vector2.ONE * _brush_size_dynamics
var start := pos - Vector2.ONE * (brush_size >> 1)
var end := start + Vector2.ONE * brush_size
for y in range(start.y, end.y):
for x in range(start.x, end.x):
result.append(Vector2(x, y))

View file

@ -194,7 +194,7 @@ func _on_ProgressTimer_timeout() -> void:
update_progress()
func _manage_enlarded_thumbnail_close() -> void:
func _manage_enlarged_thumbnail_close() -> void:
enlarged_picture.get_parent().hide()

View file

@ -93,6 +93,7 @@ unique_name_in_owner = true
[node name="Alert" type="AcceptDialog" parent="."]
unique_name_in_owner = true
size = Vector2i(421, 106)
always_on_top = true
[node name="Text" type="Label" parent="Alert"]
anchors_preset = 15
@ -104,15 +105,16 @@ offset_right = -8.0
offset_bottom = -49.0
horizontal_alignment = 1
[node name="EnlardedThumbnail" type="Window" parent="."]
[node name="EnlargedThumbnail" type="Window" parent="."]
title = "Image"
position = Vector2i(0, 36)
size = Vector2i(440, 360)
visible = false
transient = true
exclusive = true
always_on_top = true
[node name="Enlarged" type="TextureRect" parent="EnlardedThumbnail"]
[node name="Enlarged" type="TextureRect" parent="EnlargedThumbnail"]
unique_name_in_owner = true
anchors_preset = 15
anchor_right = 1.0
@ -131,5 +133,5 @@ stretch_mode = 5
[connection signal="request_completed" from="DownloadRequest" to="." method="_on_DownloadRequest_request_completed"]
[connection signal="close_requested" from="Alert" to="." method="_manage_alert_close"]
[connection signal="focus_exited" from="Alert" to="." method="_manage_alert_close"]
[connection signal="close_requested" from="EnlardedThumbnail" to="." method="_manage_enlarded_thumbnail_close"]
[connection signal="focus_exited" from="EnlardedThumbnail" to="." method="_manage_enlarded_thumbnail_close"]
[connection signal="close_requested" from="EnlargedThumbnail" to="." method="_manage_enlarged_thumbnail_close"]
[connection signal="focus_exited" from="EnlargedThumbnail" to="." method="_manage_enlarged_thumbnail_close"]

View file

@ -427,17 +427,20 @@ vertical_scroll_mode = 0
layout_mode = 2
size_flags_horizontal = 10
[node name="AnimationButtons" type="HBoxContainer" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools"]
[node name="MarginContainer" type="MarginContainer" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools"]
layout_mode = 2
[node name="AnimationButtons" type="HBoxContainer" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer"]
custom_minimum_size = Vector2(0, 24)
layout_mode = 2
size_flags_horizontal = 3
theme_override_constants/separation = 24
alignment = 2
[node name="FrameButtons" type="HBoxContainer" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons"]
[node name="FrameButtons" type="HBoxContainer" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons"]
layout_mode = 2
[node name="AddFrame" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons" groups=["UIButtons"]]
[node name="AddFrame" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/FrameButtons" groups=["UIButtons"]]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
size_flags_horizontal = 0
@ -446,7 +449,7 @@ focus_mode = 0
mouse_default_cursor_shape = 2
shortcut = SubResource("Shortcut_mvoxm")
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/AddFrame"]
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/FrameButtons/AddFrame"]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
@ -458,7 +461,7 @@ offset_right = 6.0
offset_bottom = 6.0
texture = ExtResource("19")
[node name="DeleteFrame" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons" groups=["UIButtons"]]
[node name="DeleteFrame" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/FrameButtons" groups=["UIButtons"]]
unique_name_in_owner = true
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
@ -468,7 +471,7 @@ focus_mode = 0
mouse_default_cursor_shape = 2
shortcut = SubResource("Shortcut_o40ql")
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/DeleteFrame"]
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/FrameButtons/DeleteFrame"]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
@ -482,7 +485,7 @@ size_flags_horizontal = 0
size_flags_vertical = 0
texture = ExtResource("20")
[node name="CopyFrame" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons" groups=["UIButtons"]]
[node name="CopyFrame" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/FrameButtons" groups=["UIButtons"]]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
size_flags_horizontal = 0
@ -491,7 +494,7 @@ focus_mode = 0
mouse_default_cursor_shape = 2
shortcut = SubResource("Shortcut_5g7t7")
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/CopyFrame"]
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/FrameButtons/CopyFrame"]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
@ -503,7 +506,7 @@ offset_right = 5.0
offset_bottom = 7.0
texture = ExtResource("27")
[node name="MoveFrameLeft" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons" groups=["UIButtons"]]
[node name="MoveFrameLeft" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/FrameButtons" groups=["UIButtons"]]
unique_name_in_owner = true
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
@ -513,7 +516,7 @@ focus_mode = 0
mouse_default_cursor_shape = 2
shortcut = SubResource("Shortcut_kwn1u")
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/MoveFrameLeft"]
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/FrameButtons/MoveFrameLeft"]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
@ -526,7 +529,7 @@ offset_bottom = 5.5
texture = ExtResource("8")
flip_h = true
[node name="MoveFrameRight" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons" groups=["UIButtons"]]
[node name="MoveFrameRight" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/FrameButtons" groups=["UIButtons"]]
unique_name_in_owner = true
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
@ -536,7 +539,7 @@ focus_mode = 0
mouse_default_cursor_shape = 2
shortcut = SubResource("Shortcut_m2mvi")
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/MoveFrameRight"]
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/FrameButtons/MoveFrameRight"]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
@ -548,10 +551,10 @@ offset_right = 7.5
offset_bottom = 5.5
texture = ExtResource("8")
[node name="PlaybackButtons" type="HBoxContainer" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons"]
[node name="PlaybackButtons" type="HBoxContainer" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons"]
layout_mode = 2
[node name="FirstFrame" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons" groups=["UIButtons"]]
[node name="FirstFrame" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/PlaybackButtons" groups=["UIButtons"]]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
tooltip_text = "Jump to the first frame"
@ -559,7 +562,7 @@ focus_mode = 0
mouse_default_cursor_shape = 2
shortcut = SubResource("4")
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons/FirstFrame"]
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/PlaybackButtons/FirstFrame"]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
@ -571,7 +574,7 @@ offset_right = 5.5
offset_bottom = 6.0
texture = ExtResource("21")
[node name="PreviousFrame" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons" groups=["UIButtons"]]
[node name="PreviousFrame" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/PlaybackButtons" groups=["UIButtons"]]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
tooltip_text = "Go to the previous frame"
@ -579,7 +582,7 @@ focus_mode = 0
mouse_default_cursor_shape = 2
shortcut = SubResource("6")
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons/PreviousFrame"]
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/PlaybackButtons/PreviousFrame"]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
@ -591,7 +594,7 @@ offset_right = 5.5
offset_bottom = 6.0
texture = ExtResource("23")
[node name="PlayBackwards" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons" groups=["UIButtons"]]
[node name="PlayBackwards" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/PlaybackButtons" groups=["UIButtons"]]
unique_name_in_owner = true
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
@ -601,7 +604,7 @@ mouse_default_cursor_shape = 2
toggle_mode = true
shortcut = SubResource("8")
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons/PlayBackwards"]
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/PlaybackButtons/PlayBackwards"]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
@ -613,7 +616,7 @@ offset_right = 3.0
offset_bottom = 6.0
texture = ExtResource("24")
[node name="PlayForward" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons" groups=["UIButtons"]]
[node name="PlayForward" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/PlaybackButtons" groups=["UIButtons"]]
unique_name_in_owner = true
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
@ -624,7 +627,7 @@ mouse_default_cursor_shape = 2
toggle_mode = true
shortcut = SubResource("10")
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons/PlayForward"]
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/PlaybackButtons/PlayForward"]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
@ -636,7 +639,7 @@ offset_right = 3.5
offset_bottom = 6.0
texture = ExtResource("22")
[node name="NextFrame" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons" groups=["UIButtons"]]
[node name="NextFrame" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/PlaybackButtons" groups=["UIButtons"]]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
tooltip_text = "Go to the next frame"
@ -644,7 +647,7 @@ focus_mode = 0
mouse_default_cursor_shape = 2
shortcut = SubResource("12")
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons/NextFrame"]
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/PlaybackButtons/NextFrame"]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
@ -656,7 +659,7 @@ offset_right = 5.5
offset_bottom = 6.0
texture = ExtResource("26")
[node name="LastFrame" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons" groups=["UIButtons"]]
[node name="LastFrame" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/PlaybackButtons" groups=["UIButtons"]]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
tooltip_text = "Jump to the last frame"
@ -664,7 +667,7 @@ focus_mode = 0
mouse_default_cursor_shape = 2
shortcut = SubResource("14")
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons/LastFrame"]
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/PlaybackButtons/LastFrame"]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
@ -676,10 +679,10 @@ offset_right = 5.5
offset_bottom = 6.0
texture = ExtResource("25")
[node name="LoopButtons" type="HBoxContainer" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons"]
[node name="LoopButtons" type="HBoxContainer" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons"]
layout_mode = 2
[node name="TimelineSettingsButton" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons" groups=["UIButtons"]]
[node name="TimelineSettingsButton" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/LoopButtons" groups=["UIButtons"]]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
size_flags_horizontal = 0
@ -688,7 +691,7 @@ focus_mode = 0
mouse_default_cursor_shape = 2
shortcut = SubResource("Shortcut_tke6v")
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons/TimelineSettingsButton"]
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/LoopButtons/TimelineSettingsButton"]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
@ -702,7 +705,7 @@ size_flags_horizontal = 0
size_flags_vertical = 0
texture = ExtResource("30")
[node name="OnionSkinning" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons" groups=["UIButtons"]]
[node name="OnionSkinning" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/LoopButtons" groups=["UIButtons"]]
unique_name_in_owner = true
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
@ -711,7 +714,7 @@ focus_mode = 0
mouse_default_cursor_shape = 2
shortcut = SubResource("Shortcut_pouu1")
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons/OnionSkinning"]
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/LoopButtons/OnionSkinning"]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
@ -725,7 +728,7 @@ size_flags_horizontal = 0
size_flags_vertical = 0
texture = ExtResource("29")
[node name="LoopAnim" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons" groups=["UIButtons"]]
[node name="LoopAnim" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/LoopButtons" groups=["UIButtons"]]
unique_name_in_owner = true
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
@ -734,7 +737,7 @@ focus_mode = 0
mouse_default_cursor_shape = 2
shortcut = SubResource("Shortcut_1onr8")
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons/LoopAnim"]
[node name="TextureRect" type="TextureRect" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/LoopButtons/LoopAnim"]
layout_mode = 0
anchor_left = 0.5
anchor_top = 0.5
@ -746,7 +749,7 @@ offset_right = 7.0
offset_bottom = 7.0
texture = ExtResource("31")
[node name="FPSValue" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons" instance=ExtResource("9")]
[node name="FPSValue" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/LoopButtons" instance=ExtResource("9")]
unique_name_in_owner = true
custom_minimum_size = Vector2(72, 24)
layout_mode = 2
@ -1139,21 +1142,21 @@ color = Color(0, 0.741176, 1, 0.501961)
[connection signal="pressed" from="TimelineContainer/TimelineButtons/LayerTools/MarginContainer/LayerSettingsContainer/LayerButtons/MergeDownLayer" to="." method="_on_MergeDownLayer_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/LayerTools/MarginContainer/LayerSettingsContainer/LayerButtons/LayerFX" to="." method="_on_layer_fx_pressed"]
[connection signal="item_selected" from="TimelineContainer/TimelineButtons/LayerTools/MarginContainer/LayerSettingsContainer/BlendContainer/BlendModes" to="." method="_on_blend_modes_item_selected"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/AddFrame" to="." method="add_frame"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/DeleteFrame" to="." method="_on_DeleteFrame_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/CopyFrame" to="." method="_on_CopyFrame_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/MoveFrameLeft" to="." method="_on_MoveLeft_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/FrameButtons/MoveFrameRight" to="." method="_on_MoveRight_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons/FirstFrame" to="." method="_on_FirstFrame_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons/PreviousFrame" to="." method="_on_PreviousFrame_pressed"]
[connection signal="toggled" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons/PlayBackwards" to="." method="_on_PlayBackwards_toggled"]
[connection signal="toggled" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons/PlayForward" to="." method="_on_PlayForward_toggled"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons/NextFrame" to="." method="_on_NextFrame_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/PlaybackButtons/LastFrame" to="." method="_on_LastFrame_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons/TimelineSettingsButton" to="." method="_on_timeline_settings_button_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons/OnionSkinning" to="." method="_on_OnionSkinning_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons/LoopAnim" to="." method="_on_LoopAnim_pressed"]
[connection signal="value_changed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons/FPSValue" to="." method="_on_FPSValue_value_changed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/FrameButtons/AddFrame" to="." method="add_frame"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/FrameButtons/DeleteFrame" to="." method="_on_DeleteFrame_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/FrameButtons/CopyFrame" to="." method="_on_CopyFrame_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/FrameButtons/MoveFrameLeft" to="." method="_on_MoveLeft_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/FrameButtons/MoveFrameRight" to="." method="_on_MoveRight_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/PlaybackButtons/FirstFrame" to="." method="_on_FirstFrame_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/PlaybackButtons/PreviousFrame" to="." method="_on_PreviousFrame_pressed"]
[connection signal="toggled" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/PlaybackButtons/PlayBackwards" to="." method="_on_PlayBackwards_toggled"]
[connection signal="toggled" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/PlaybackButtons/PlayForward" to="." method="_on_PlayForward_toggled"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/PlaybackButtons/NextFrame" to="." method="_on_NextFrame_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/PlaybackButtons/LastFrame" to="." method="_on_LastFrame_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/LoopButtons/TimelineSettingsButton" to="." method="_on_timeline_settings_button_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/LoopButtons/OnionSkinning" to="." method="_on_OnionSkinning_pressed"]
[connection signal="pressed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/LoopButtons/LoopAnim" to="." method="_on_LoopAnim_pressed"]
[connection signal="value_changed" from="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/MarginContainer/AnimationButtons/LoopButtons/FPSValue" to="." method="_on_FPSValue_value_changed"]
[connection signal="dragged" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit" to="." method="_on_layer_frame_h_split_dragged"]
[connection signal="gui_input" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit" to="." method="_on_LayerFrameSplitContainer_gui_input"]
[connection signal="pressed" from="TimelineContainer/MainBodyPanel/MainBodyVBoxContainer/MarginContainer/LayerFrameHeaderHSplit/LayerHeaderContainer/GlobalVisibilityButton" to="." method="_on_global_visibility_button_pressed"]

View file

@ -9,7 +9,7 @@ var cel: BaseCel
var _is_guide_stylebox := false
@onready var popup_menu: PopupMenu = get_node_or_null("PopupMenu")
@onready var linked: ColorRect = $Linked
@onready var linked_rect: ColorRect = $Linked
@onready var cel_texture: TextureRect = $CelTexture
@onready var transparent_checker: ColorRect = $CelTexture/TransparentChecker
@onready var properties: AcceptDialog = Global.control.find_child("CelProperties")
@ -35,6 +35,7 @@ func _ready() -> void:
popup_menu.add_item("Play audio here")
_is_playing_audio()
Global.cel_switched.connect(_is_playing_audio)
Themes.theme_switched.connect(_is_playing_audio)
Global.current_project.fps_changed.connect(_is_playing_audio)
Global.current_project.layers[layer].audio_changed.connect(_is_playing_audio)
Global.current_project.layers[layer].playback_frame_changed.connect(_is_playing_audio)
@ -75,10 +76,10 @@ func button_setup() -> void:
tooltip_text = tr("Frame: %s, Layer: %s") % [frame + 1, base_layer.name]
if cel is not AudioCel:
cel_texture.texture = cel.image_texture
if is_instance_valid(linked):
linked.visible = cel.link_set != null
if is_instance_valid(linked_rect):
linked_rect.visible = cel.link_set != null
if cel.link_set != null:
linked.color.h = cel.link_set["hue"]
linked_rect.color.h = cel.link_set["hue"]
func _on_CelButton_pressed() -> void:
@ -411,13 +412,26 @@ func _sort_cel_indices_by_frame(a: Array, b: Array) -> bool:
func _is_playing_audio() -> void:
var frame_class := Global.current_project.frames[frame]
var layer_class := Global.current_project.layers[layer] as AudioLayer
var project := Global.current_project
var frame_class := project.frames[frame]
var layer_class := project.layers[layer] as AudioLayer
var audio_length := layer_class.get_audio_length()
var frame_pos := frame_class.position_in_seconds(
Global.current_project, layer_class.playback_frame
var frame_pos := frame_class.position_in_seconds(project, layer_class.playback_frame)
var audio_color := Color.LIGHT_GRAY
var pressed_stylebox := Global.control.theme.get_stylebox(&"pressed", &"CelButton")
if pressed_stylebox is StyleBoxFlat:
audio_color = pressed_stylebox.border_color
var is_last_frame := frame + 1 >= project.frames.size()
if not is_last_frame:
is_last_frame = (
project.frames[frame + 1].position_in_seconds(project, layer_class.playback_frame)
>= audio_length
)
if frame_pos >= 0 and frame_pos < audio_length:
if frame_pos == 0 or (is_last_frame and frame_pos < audio_length):
cel_texture.texture = preload("res://assets/graphics/misc/musical_note.png")
cel_texture.self_modulate = audio_color
linked_rect.visible = false
else:
linked_rect.visible = frame_pos < audio_length and frame_pos > 0
linked_rect.color = audio_color
cel_texture.texture = null

View file

@ -15,6 +15,7 @@ var button_pressed := false:
get:
return main_button.button_pressed
var animation_running := false
var audio_playing_at_frame := 0
var audio_player: AudioStreamPlayer
@onready var properties: AcceptDialog = Global.control.find_child("LayerProperties")
@ -36,7 +37,7 @@ func _ready() -> void:
Global.cel_switched.connect(_on_cel_switched)
var layer := Global.current_project.layers[layer_index]
layer.name_changed.connect(func(): label.text = layer.name)
layer.visibility_changed.connect(update_buttons)
layer.visibility_changed.connect(_on_layer_visibility_changed)
if layer is PixelLayer:
linked_button.visible = true
elif layer is GroupLayer:
@ -68,7 +69,8 @@ func _ready() -> void:
func _on_cel_switched() -> void:
z_index = 1 if button_pressed else 0
var layer := Global.current_project.layers[layer_index]
var project := Global.current_project
var layer := project.layers[layer_index]
if layer is AudioLayer:
if not is_instance_valid(audio_player):
return
@ -76,16 +78,26 @@ func _on_cel_switched() -> void:
audio_player.stop()
return
if animation_running:
var current_frame := Global.current_project.current_frame
var current_frame := project.current_frame
if (
current_frame == layer.playback_frame
or (current_frame == 0 and layer.playback_frame < 0)
## True when switching cels while the animation is running
or current_frame != audio_playing_at_frame + 1
):
_play_audio(false)
audio_playing_at_frame = current_frame
else:
_play_audio(true)
func _on_layer_visibility_changed() -> void:
update_buttons()
var layer := Global.current_project.layers[layer_index]
if layer is AudioLayer:
_play_audio(not animation_running)
func _on_animation_started(_dir: bool) -> void:
animation_running = true
_play_audio(false)
@ -117,6 +129,7 @@ func _play_audio(single_frame: bool) -> void:
var frame_pos := frame.position_in_seconds(project, layer.playback_frame)
if frame_pos >= 0 and frame_pos < audio_length:
audio_player.play(frame_pos)
audio_playing_at_frame = project.current_frame
if single_frame:
var timer := get_tree().create_timer(frame.get_duration_in_seconds(project.fps))
timer.timeout.connect(func(): audio_player.stop())