diff --git a/Main.tscn b/Main.tscn index 7c4a125d4..d1e9e6eb4 100644 --- a/Main.tscn +++ b/Main.tscn @@ -482,6 +482,7 @@ mouse_default_cursor_shape = 2 text = "Vert. Mirror" [node name="CanvasAndTimeline" type="VBoxContainer" parent="MenuAndUI/UI"] +editor/display_folded = true margin_left = 242.0 margin_right = 928.0 margin_bottom = 620.0 @@ -605,6 +606,7 @@ margin_right = 4.0 margin_bottom = 71.0 [node name="AnimationContainer" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline"] +editor/display_folded = true anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 15.0 @@ -616,7 +618,6 @@ margin_bottom = 138.0 size_flags_horizontal = 3 [node name="AnimationButtons" type="Control" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer"] -editor/display_folded = true margin_right = 525.0 margin_bottom = 24.0 rect_min_size = Vector2( 0, 24 ) @@ -690,6 +691,7 @@ mouse_default_cursor_shape = 2 texture_normal = ExtResource( 20 ) [node name="LoopButtons" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/AnimationButtons"] +editor/display_folded = true anchor_left = 1.0 anchor_top = 0.5 anchor_right = 1.0 @@ -713,9 +715,7 @@ suffix = "FPS" margin_left = 78.0 margin_right = 98.0 margin_bottom = 24.0 -hint_tooltip = "No: Animation doesn't loop -Cycle: Animation plays again when it reaches the last frame -Ping-pong: Animation plays again but backwards when it reaches the last frame" +hint_tooltip = "No loop" mouse_default_cursor_shape = 2 texture_normal = ExtResource( 21 ) @@ -806,6 +806,7 @@ margin_right = 671.0 margin_bottom = 138.0 [node name="LayerPanel" type="Panel" parent="MenuAndUI/UI"] +editor/display_folded = true margin_left = 928.0 margin_right = 1152.0 margin_bottom = 620.0 diff --git a/Scripts/Global.gd b/Scripts/Global.gd index c6e65b23b..59d0b64a4 100644 --- a/Scripts/Global.gd +++ b/Scripts/Global.gd @@ -195,9 +195,11 @@ func undo(_canvases : Array, layer_index : int = -1) -> void: if action_name == "Add Frame": canvas_parent.remove_child(_canvases[0]) frame_container.remove_child(_canvases[0].frame_button) - if len(canvases) == 1: - Global.remove_frame_button.disabled = true - Global.remove_frame_button.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN + #This actually means that canvases.size is one, but it hasn't been updated yet + if canvases.size() == 2: #Stop animating + play_forward.pressed = false + play_backwards.pressed = false + animation_timer.stop() elif action_name == "Remove Frame": canvas_parent.add_child(_canvases[0]) canvas_parent.move_child(_canvases[0], _canvases[0].frame) @@ -238,6 +240,10 @@ func redo(_canvases : Array, layer_index : int = -1) -> void: elif action_name == "Remove Frame": canvas_parent.remove_child(_canvases[0]) frame_container.remove_child(_canvases[0].frame_button) + if canvases.size() == 1: #Stop animating + play_forward.pressed = false + play_backwards.pressed = false + animation_timer.stop() elif action_name == "Change Frame Order": frame_container.move_child(_canvases[0].frame_button, _canvases[0].frame) canvas_parent.move_child(_canvases[0], _canvases[0].frame) diff --git a/Scripts/Main.gd b/Scripts/Main.gd index 0b5c1e4e0..a73a46628 100644 --- a/Scripts/Main.gd +++ b/Scripts/Main.gd @@ -314,7 +314,7 @@ func _on_OpenSprite_file_selected(path : String) -> void: canvas.layers.append([image, tex, layer_name, true]) layer_line = file.get_line() - var guide_line := file.get_line() + var guide_line := file.get_line() #"guideline" no pun intended while guide_line == "|": #Load guides var guide := Guide.new() guide.default_color = Color.purple @@ -723,34 +723,43 @@ func _on_LoopAnim_pressed() -> void: #Make it loop animation_loop = 1 Global.loop_animation_button.texture_normal = preload("res://Assets/Graphics/Timeline/Loop.png") + Global.loop_animation_button.hint_tooltip = "Cycle loop" "res://Assets/Graphics/Timeline/Loop.png": #Make it ping-pong animation_loop = 2 Global.loop_animation_button.texture_normal = preload("res://Assets/Graphics/Timeline/Loop_PingPong.png") + Global.loop_animation_button.hint_tooltip = "Ping-pong loop" "res://Assets/Graphics/Timeline/Loop_PingPong.png": #Make it stop animation_loop = 0 Global.loop_animation_button.texture_normal = preload("res://Assets/Graphics/Timeline/Loop_None.png") + Global.loop_animation_button.hint_tooltip = "No loop" func _on_PlayForward_toggled(button_pressed) -> void: Global.play_backwards.pressed = false + if Global.canvases.size() == 1: + Global.play_forward.pressed = !button_pressed + return if button_pressed: - $AnimationTimer.wait_time = 1 / fps - $AnimationTimer.start() + Global.animation_timer.wait_time = 1 / fps + Global.animation_timer.start() animation_forward = true else: - $AnimationTimer.stop() + Global.animation_timer.stop() func _on_PlayBackwards_toggled(button_pressed) -> void: Global.play_forward.pressed = false + if Global.canvases.size() == 1: + Global.play_backwards.pressed = !button_pressed + return if button_pressed: - $AnimationTimer.wait_time = 1 / fps - $AnimationTimer.start() + Global.animation_timer.wait_time = 1 / fps + Global.animation_timer.start() animation_forward = false else: - $AnimationTimer.stop() + Global.animation_timer.stop() func _on_NextFrame_pressed() -> void: if Global.current_frame < Global.canvases.size() - 1: @@ -775,7 +784,7 @@ func _on_AnimationTimer_timeout() -> void: 0: #No loop Global.play_forward.pressed = false Global.play_backwards.pressed = false - $AnimationTimer.stop() + Global.animation_timer.stop() 1: #Cycle loop Global.current_frame = 0 2: #Ping pong loop @@ -790,7 +799,7 @@ func _on_AnimationTimer_timeout() -> void: 0: #No loop Global.play_backwards.pressed = false Global.play_forward.pressed = false - $AnimationTimer.stop() + Global.animation_timer.stop() 1: #Cycle loop Global.current_frame = Global.canvases.size() - 1 2: #Ping pong loop @@ -799,7 +808,7 @@ func _on_AnimationTimer_timeout() -> void: func _on_FPSValue_value_changed(value) -> void: fps = float(value) - $AnimationTimer.wait_time = 1 / fps + Global.animation_timer.wait_time = 1 / fps func _on_PastOnionSkinning_value_changed(value) -> void: Global.onion_skinning_past_rate = int(value)