diff --git a/src/UI/Timeline/AnimationTimeline.gd b/src/UI/Timeline/AnimationTimeline.gd index 7519100e7..a8b1e832d 100644 --- a/src/UI/Timeline/AnimationTimeline.gd +++ b/src/UI/Timeline/AnimationTimeline.gd @@ -24,7 +24,7 @@ onready var frame_scroll_container: Control = find_node("FrameScrollContainer") onready var frame_scroll_bar: HScrollBar = find_node("FrameScrollBar") onready var tag_scroll_container: ScrollContainer = find_node("TagScroll") onready var layer_frame_h_split: HSplitContainer = find_node("LayerFrameHSplit") -onready var fps_spinbox: SpinBox = find_node("FPSValue") +onready var fps_spinbox: ValueSlider = find_node("FPSValue") onready var onion_skinning_button: BaseButton = find_node("OnionSkinning") onready var loop_animation_button: BaseButton = find_node("LoopAnim") onready var drag_highlight: ColorRect = find_node("DragHighlight") @@ -35,8 +35,33 @@ func _ready() -> void: frame_scroll_bar.connect("value_changed", self, "_frame_scroll_changed") Global.animation_timer.wait_time = 1 / Global.current_project.fps fps_spinbox.value = Global.current_project.fps + + # config loading layer_frame_h_split.split_offset = Global.config_cache.get_value("timeline", "layer_size", 0) self.cel_size = Global.config_cache.get_value("timeline", "cel_size", cel_size) # Call setter + var past_rate = Global.config_cache.get_value( + "timeline", "past_rate", Global.onion_skinning_past_rate + ) + var future_rate = Global.config_cache.get_value( + "timeline", "future_rate", Global.onion_skinning_future_rate + ) + var blue_red = Global.config_cache.get_value( + "timeline", "blue_red", Global.onion_skinning_blue_red + ) + var past_above = Global.config_cache.get_value( + "timeline", "past_above_canvas", past_above_canvas + ) + var future_above = Global.config_cache.get_value( + "timeline", "future_above_canvas", future_above_canvas + ) + $"%PastOnionSkinning".value = past_rate + $"%FutureOnionSkinning".value = future_rate + $"%BlueRedMode".pressed = blue_red + $"%PastPlacement".select(0 if past_above else 1) + $"%FuturePlacement".select(0 if future_above else 1) + # emit signals that were supposed to be emitted (Check if it's still required in godot 4) + $"%PastPlacement".emit_signal("item_selected", 0 if past_above else 1) + $"%FuturePlacement".emit_signal("item_selected", 0 if future_above else 1) # Makes sure that the frame and tag scroll bars are in the right place: Global.layer_vbox.call_deferred("emit_signal", "resized") @@ -542,26 +567,31 @@ func _on_FPSValue_value_changed(value: float) -> void: func _on_PastOnionSkinning_value_changed(value: float) -> void: Global.onion_skinning_past_rate = int(value) + Global.config_cache.set_value("timeline", "past_rate", Global.onion_skinning_past_rate) Global.canvas.update() func _on_FutureOnionSkinning_value_changed(value: float) -> void: Global.onion_skinning_future_rate = int(value) + Global.config_cache.set_value("timeline", "future_rate", Global.onion_skinning_future_rate) Global.canvas.update() func _on_BlueRedMode_toggled(button_pressed: bool) -> void: Global.onion_skinning_blue_red = button_pressed + Global.config_cache.set_value("timeline", "blue_red", Global.onion_skinning_blue_red) Global.canvas.update() func _on_PastPlacement_item_selected(index: int) -> void: past_above_canvas = (index == 0) + Global.config_cache.set_value("timeline", "past_above_canvas", past_above_canvas) Global.canvas.get_node("OnionPast").set("show_behind_parent", !past_above_canvas) func _on_FuturePlacement_item_selected(index: int) -> void: future_above_canvas = (index == 0) + Global.config_cache.set_value("timeline", "future_above_canvas", future_above_canvas) Global.canvas.get_node("OnionFuture").set("show_behind_parent", !future_above_canvas) diff --git a/src/UI/Timeline/AnimationTimeline.tscn b/src/UI/Timeline/AnimationTimeline.tscn index 6e5dcf9d8..089afddac 100644 --- a/src/UI/Timeline/AnimationTimeline.tscn +++ b/src/UI/Timeline/AnimationTimeline.tscn @@ -313,7 +313,7 @@ theme = SubResource( 20 ) scroll_vertical_enabled = false [node name="AnimationTools" type="PanelContainer" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer"] -margin_left = 157.0 +margin_left = 159.0 margin_right = 677.0 margin_bottom = 38.0 size_flags_horizontal = 10 @@ -321,7 +321,7 @@ size_flags_horizontal = 10 [node name="AnimationButtons" type="HBoxContainer" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools"] margin_left = 7.0 margin_top = 7.0 -margin_right = 513.0 +margin_right = 511.0 margin_bottom = 31.0 rect_min_size = Vector2( 0, 24 ) size_flags_horizontal = 3 @@ -664,7 +664,7 @@ __meta__ = { [node name="LoopButtons" type="HBoxContainer" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons"] margin_left = 360.0 -margin_right = 506.0 +margin_right = 504.0 margin_bottom = 24.0 [node name="OnionSkinningSettings" type="Button" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons" groups=["UIButtons"]] @@ -739,22 +739,18 @@ margin_top = -7.0 margin_right = 7.0 margin_bottom = 7.0 texture = ExtResource( 31 ) -__meta__ = { -"_edit_use_anchors_": false -} -[node name="FPSValue" type="SpinBox" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons"] +[node name="FPSValue" parent="TimelineContainer/TimelineButtons/VBoxContainer/AnimationToolsScrollContainer/AnimationTools/AnimationButtons/LoopButtons" instance=ExtResource( 9 )] margin_left = 72.0 -margin_right = 146.0 -margin_bottom = 24.0 +margin_right = 144.0 +rect_min_size = Vector2( 72, 24 ) hint_tooltip = "How many frames per second should the animation preview be? The more FPS, the faster the animation plays." -mouse_default_cursor_shape = 2 +size_flags_horizontal = 1 size_flags_vertical = 4 min_value = 0.1 step = 0.1 value = 6.0 -align = 1 suffix = "FPS" [node name="TagScroll" type="ScrollContainer" parent="TimelineContainer/TimelineButtons/VBoxContainer"] @@ -885,13 +881,13 @@ margin_right = 292.0 margin_bottom = 14.0 text = "Past Frames" -[node name="PastOnionSkinning" type="SpinBox" parent="OnionSkinningSettings/OnionSkinningButtons"] -margin_top = 18.0 -margin_right = 292.0 -margin_bottom = 42.0 -mouse_default_cursor_shape = 2 +[node name="PastOnionSkinning" parent="OnionSkinningSettings/OnionSkinningButtons" instance=ExtResource( 9 )] +unique_name_in_owner = true +margin_left = 819.0 +margin_right = 891.0 +size_flags_horizontal = 1 value = 1.0 -align = 1 +suffix = "Frames" [node name="OnionSkinningFuture" type="Label" parent="OnionSkinningSettings/OnionSkinningButtons"] margin_top = 46.0 @@ -899,15 +895,16 @@ margin_right = 292.0 margin_bottom = 60.0 text = "Future Frames" -[node name="FutureOnionSkinning" type="SpinBox" parent="OnionSkinningSettings/OnionSkinningButtons"] -margin_top = 64.0 -margin_right = 292.0 -margin_bottom = 88.0 -mouse_default_cursor_shape = 2 +[node name="FutureOnionSkinning" parent="OnionSkinningSettings/OnionSkinningButtons" instance=ExtResource( 9 )] +unique_name_in_owner = true +margin_left = 819.0 +margin_right = 891.0 +size_flags_horizontal = 1 value = 1.0 -align = 1 +suffix = "Frames" [node name="BlueRedMode" type="CheckBox" parent="OnionSkinningSettings/OnionSkinningButtons"] +unique_name_in_owner = true margin_top = 92.0 margin_right = 126.0 margin_bottom = 116.0 @@ -930,6 +927,7 @@ text = "Show past frames:" valign = 1 [node name="PastPlacement" type="OptionButton" parent="OnionSkinningSettings/OnionSkinningButtons/GridContainer"] +unique_name_in_owner = true margin_left = 135.0 margin_right = 292.0 margin_bottom = 20.0 @@ -951,6 +949,7 @@ align = 2 valign = 1 [node name="FuturePlacement" type="OptionButton" parent="OnionSkinningSettings/OnionSkinningButtons/GridContainer"] +unique_name_in_owner = true margin_left = 135.0 margin_top = 24.0 margin_right = 292.0