diff --git a/src/UI/CanvasPreviewContainer/CanvasPreviewContainer.gd b/src/UI/CanvasPreviewContainer/CanvasPreviewContainer.gd index 26c355a49..408c2a561 100644 --- a/src/UI/CanvasPreviewContainer/CanvasPreviewContainer.gd +++ b/src/UI/CanvasPreviewContainer/CanvasPreviewContainer.gd @@ -6,6 +6,7 @@ extends PanelContainer @onready var play_button := $"%PlayButton" as Button @onready var start_frame := $"%StartFrame" as ValueSlider @onready var end_frame := $"%EndFrame" as ValueSlider +@onready var options := $VBox/Animation/Options as VBoxContainer func _ready() -> void: @@ -43,12 +44,12 @@ func _on_OptionButton_item_selected(index: int) -> void: play_button.button_pressed = false canvas_preview.mode = index if index == 0: - $VBox/Animation/VBoxContainer/Options.visible = false + options.visible = false canvas_preview.transparent_checker.fit_rect( Rect2(Vector2.ZERO, Global.current_project.size) ) else: - $VBox/Animation/VBoxContainer/Options.visible = true + options.visible = true canvas_preview.queue_redraw() diff --git a/src/UI/CanvasPreviewContainer/CanvasPreviewContainer.tscn b/src/UI/CanvasPreviewContainer/CanvasPreviewContainer.tscn index a84b1fed5..9edaafaa2 100644 --- a/src/UI/CanvasPreviewContainer/CanvasPreviewContainer.tscn +++ b/src/UI/CanvasPreviewContainer/CanvasPreviewContainer.tscn @@ -67,7 +67,7 @@ stretch = true transparent_bg = true handle_input_locally = false canvas_item_default_texture_filter = 0 -size = Vector2i(308, 139) +size = Vector2i(308, 135) render_target_update_mode = 4 [node name="TransparentChecker" parent="VBox/HBox/PreviewViewportContainer/SubViewport" instance=ExtResource("1")] @@ -84,9 +84,9 @@ zoom = Vector2(0.15, 0.15) script = ExtResource("3") index = 2 -[node name="Animation" type="HBoxContainer" parent="VBox"] +[node name="Animation" type="GridContainer" parent="VBox"] layout_mode = 2 -alignment = 1 +columns = 2 [node name="PlayButton" type="Button" parent="VBox/Animation" groups=["UIButtons"]] unique_name_in_owner = true @@ -109,19 +109,16 @@ offset_bottom = 6.0 mouse_default_cursor_shape = 2 texture = ExtResource("6") -[node name="VBoxContainer" type="VBoxContainer" parent="VBox/Animation"] +[node name="Mode" type="HBoxContainer" parent="VBox/Animation"] layout_mode = 2 size_flags_horizontal = 3 -[node name="Mode" type="HBoxContainer" parent="VBox/Animation/VBoxContainer"] -layout_mode = 2 - -[node name="Label" type="Label" parent="VBox/Animation/VBoxContainer/Mode"] +[node name="Label" type="Label" parent="VBox/Animation/Mode"] layout_mode = 2 text = "Animation mode:" vertical_alignment = 1 -[node name="OptionButton" type="OptionButton" parent="VBox/Animation/VBoxContainer/Mode"] +[node name="OptionButton" type="OptionButton" parent="VBox/Animation/Mode"] layout_mode = 2 size_flags_horizontal = 3 mouse_default_cursor_shape = 2 @@ -133,17 +130,20 @@ popup/item_0/id = 0 popup/item_1/text = "Current frame as spritesheet" popup/item_1/id = 1 -[node name="Options" parent="VBox/Animation/VBoxContainer" instance=ExtResource("7")] +[node name="Spacer" type="Control" parent="VBox/Animation"] +layout_mode = 2 + +[node name="Options" parent="VBox/Animation" instance=ExtResource("7")] visible = false layout_mode = 2 text = "Spritesheet options" -[node name="GridContainer" type="GridContainer" parent="VBox/Animation/VBoxContainer/Options"] +[node name="GridContainer" type="GridContainer" parent="VBox/Animation/Options"] visible = false layout_mode = 2 columns = 2 -[node name="HFrames" type="TextureProgressBar" parent="VBox/Animation/VBoxContainer/Options/GridContainer"] +[node name="HFrames" type="TextureProgressBar" parent="VBox/Animation/Options/GridContainer"] custom_minimum_size = Vector2(0, 24) layout_mode = 2 size_flags_horizontal = 3 @@ -161,7 +161,7 @@ stretch_margin_bottom = 3 script = ExtResource("8") prefix = "Horizontal frames:" -[node name="VFrames" type="TextureProgressBar" parent="VBox/Animation/VBoxContainer/Options/GridContainer"] +[node name="VFrames" type="TextureProgressBar" parent="VBox/Animation/Options/GridContainer"] custom_minimum_size = Vector2(0, 24) layout_mode = 2 size_flags_horizontal = 3 @@ -179,7 +179,7 @@ stretch_margin_bottom = 3 script = ExtResource("8") prefix = "Vertical frames:" -[node name="StartFrame" type="TextureProgressBar" parent="VBox/Animation/VBoxContainer/Options/GridContainer"] +[node name="StartFrame" type="TextureProgressBar" parent="VBox/Animation/Options/GridContainer"] unique_name_in_owner = true custom_minimum_size = Vector2(0, 24) layout_mode = 2 @@ -198,7 +198,7 @@ stretch_margin_bottom = 3 script = ExtResource("8") prefix = "Start frame:" -[node name="EndFrame" type="TextureProgressBar" parent="VBox/Animation/VBoxContainer/Options/GridContainer"] +[node name="EndFrame" type="TextureProgressBar" parent="VBox/Animation/Options/GridContainer"] unique_name_in_owner = true custom_minimum_size = Vector2(0, 24) layout_mode = 2 @@ -221,8 +221,8 @@ prefix = "End frame:" [connection signal="mouse_entered" from="VBox/HBox/PreviewViewportContainer" to="." method="_on_PreviewViewportContainer_mouse_entered"] [connection signal="mouse_exited" from="VBox/HBox/PreviewViewportContainer" to="." method="_on_PreviewViewportContainer_mouse_exited"] [connection signal="toggled" from="VBox/Animation/PlayButton" to="." method="_on_PlayButton_toggled"] -[connection signal="item_selected" from="VBox/Animation/VBoxContainer/Mode/OptionButton" to="." method="_on_OptionButton_item_selected"] -[connection signal="value_changed" from="VBox/Animation/VBoxContainer/Options/GridContainer/HFrames" to="." method="_on_HFrames_value_changed"] -[connection signal="value_changed" from="VBox/Animation/VBoxContainer/Options/GridContainer/VFrames" to="." method="_on_VFrames_value_changed"] -[connection signal="value_changed" from="VBox/Animation/VBoxContainer/Options/GridContainer/StartFrame" to="." method="_on_StartFrame_value_changed"] -[connection signal="value_changed" from="VBox/Animation/VBoxContainer/Options/GridContainer/EndFrame" to="." method="_on_EndFrame_value_changed"] +[connection signal="item_selected" from="VBox/Animation/Mode/OptionButton" to="." method="_on_OptionButton_item_selected"] +[connection signal="value_changed" from="VBox/Animation/Options/GridContainer/HFrames" to="." method="_on_HFrames_value_changed"] +[connection signal="value_changed" from="VBox/Animation/Options/GridContainer/VFrames" to="." method="_on_VFrames_value_changed"] +[connection signal="value_changed" from="VBox/Animation/Options/GridContainer/StartFrame" to="." method="_on_StartFrame_value_changed"] +[connection signal="value_changed" from="VBox/Animation/Options/GridContainer/EndFrame" to="." method="_on_EndFrame_value_changed"]