From 6157fd335526079b1fcfa0a2c1913be4df8c8294 Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Tue, 15 Sep 2020 00:01:21 +0300 Subject: [PATCH] Improve canvas preview UI --- src/Palette/PalettePanelContainer.tscn | 2 - src/UI/CanvasPreviewContainer.gd | 8 +-- src/UI/CanvasPreviewContainer.tscn | 69 ++++++++++++-------------- src/UI/UI.tscn | 11 ++-- 4 files changed, 40 insertions(+), 50 deletions(-) diff --git a/src/Palette/PalettePanelContainer.tscn b/src/Palette/PalettePanelContainer.tscn index 179420b15..15aeadbc3 100644 --- a/src/Palette/PalettePanelContainer.tscn +++ b/src/Palette/PalettePanelContainer.tscn @@ -184,8 +184,6 @@ margin_left = 7.0 margin_top = 7.0 margin_right = 507.0 margin_bottom = 307.0 -current_dir = "/home/luiq/data/libDev/git/Pixelorama" -current_path = "/home/luiq/data/libDev/git/Pixelorama/" [node name="EditPalettePopup" parent="." instance=ExtResource( 7 )] margin_left = 7.0 diff --git a/src/UI/CanvasPreviewContainer.gd b/src/UI/CanvasPreviewContainer.gd index 28a74c453..947443c5b 100644 --- a/src/UI/CanvasPreviewContainer.gd +++ b/src/UI/CanvasPreviewContainer.gd @@ -1,9 +1,9 @@ -extends HBoxContainer +extends PanelContainer -onready var canvas_preview = $PreviewContainer/PreviewViewportContainer/Viewport/CanvasPreview -onready var camera : Camera2D = $PreviewContainer/PreviewViewportContainer/Viewport/CameraPreview -onready var play_button : Button = $SettingsContainer/VBoxContainer/PlayButton +onready var canvas_preview = $HBoxContainer/PreviewViewportContainer/Viewport/CanvasPreview +onready var camera : Camera2D = $HBoxContainer/PreviewViewportContainer/Viewport/CameraPreview +onready var play_button : Button = $HBoxContainer/VBoxContainer/PlayButton func _on_PreviewZoomSlider_value_changed(value : float) -> void: diff --git a/src/UI/CanvasPreviewContainer.tscn b/src/UI/CanvasPreviewContainer.tscn index 9cc1d9dc3..4094b5859 100644 --- a/src/UI/CanvasPreviewContainer.tscn +++ b/src/UI/CanvasPreviewContainer.tscn @@ -18,47 +18,54 @@ shader_param/rect_size = Vector2( 0, 0 ) shader_param/follow_movement = false shader_param/follow_scale = false -[node name="CanvasPreviewContainer" type="HBoxContainer"] -margin_right = 332.0 +[node name="CanvasPreviewContainer" type="PanelContainer"] +margin_right = 278.0 margin_bottom = 164.0 +rect_min_size = Vector2( 300, 0 ) size_flags_horizontal = 4 script = ExtResource( 3 ) __meta__ = { "_edit_use_anchors_": false } -[node name="SettingsContainer" type="PanelContainer" parent="."] -margin_right = 34.0 -margin_bottom = 164.0 - -[node name="VBoxContainer" type="VBoxContainer" parent="SettingsContainer"] +[node name="HBoxContainer" type="HBoxContainer" parent="."] margin_left = 7.0 margin_top = 7.0 -margin_right = 27.0 +margin_right = 293.0 margin_bottom = 157.0 -[node name="Label" type="Label" parent="SettingsContainer/VBoxContainer"] +[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"] margin_right = 20.0 +margin_bottom = 150.0 + +[node name="Label" type="Label" parent="HBoxContainer/VBoxContainer"] +margin_left = 6.0 +margin_right = 14.0 margin_bottom = 14.0 +size_flags_horizontal = 4 text = "+" align = 1 -[node name="PreviewZoomSlider" type="VSlider" parent="SettingsContainer/VBoxContainer"] +[node name="PreviewZoomSlider" type="VSlider" parent="HBoxContainer/VBoxContainer"] +margin_left = 2.0 margin_top = 18.0 -margin_right = 16.0 +margin_right = 18.0 margin_bottom = 108.0 mouse_default_cursor_shape = 2 +size_flags_horizontal = 4 size_flags_vertical = 3 step = 0.01 -[node name="Label2" type="Label" parent="SettingsContainer/VBoxContainer"] +[node name="Label2" type="Label" parent="HBoxContainer/VBoxContainer"] +margin_left = 7.0 margin_top = 112.0 -margin_right = 20.0 +margin_right = 12.0 margin_bottom = 126.0 +size_flags_horizontal = 4 text = "-" align = 1 -[node name="PlayButton" type="Button" parent="SettingsContainer/VBoxContainer" groups=[ +[node name="PlayButton" type="Button" parent="HBoxContainer/VBoxContainer" groups=[ "UIButtons", ]] margin_top = 130.0 @@ -68,7 +75,7 @@ rect_min_size = Vector2( 20, 0 ) mouse_default_cursor_shape = 2 toggle_mode = true -[node name="TextureRect" type="TextureRect" parent="SettingsContainer/VBoxContainer/PlayButton"] +[node name="TextureRect" type="TextureRect" parent="HBoxContainer/VBoxContainer/PlayButton"] anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 @@ -83,39 +90,25 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="PreviewContainer" type="PanelContainer" parent="."] -margin_left = 38.0 -margin_right = 332.0 -margin_bottom = 164.0 -size_flags_horizontal = 4 - -[node name="PreviewViewportContainer" type="ViewportContainer" parent="PreviewContainer"] -margin_left = 7.0 -margin_top = 7.0 -margin_right = 287.0 -margin_bottom = 157.0 +[node name="PreviewViewportContainer" type="ViewportContainer" parent="HBoxContainer"] +margin_left = 24.0 +margin_right = 284.0 +margin_bottom = 150.0 rect_min_size = Vector2( 0, 150 ) -[node name="Viewport" type="Viewport" parent="PreviewContainer/PreviewViewportContainer"] -size = Vector2( 280, 150 ) +[node name="Viewport" type="Viewport" parent="HBoxContainer/PreviewViewportContainer"] +size = Vector2( 260, 150 ) transparent_bg = true handle_input_locally = false render_target_update_mode = 3 -[node name="TransparentChecker" parent="PreviewContainer/PreviewViewportContainer/Viewport" instance=ExtResource( 2 )] +[node name="TransparentChecker" parent="HBoxContainer/PreviewViewportContainer/Viewport" instance=ExtResource( 2 )] material = SubResource( 1 ) -[node name="CanvasPreview" parent="PreviewContainer/PreviewViewportContainer/Viewport" instance=ExtResource( 1 )] +[node name="CanvasPreview" parent="HBoxContainer/PreviewViewportContainer/Viewport" instance=ExtResource( 1 )] -[node name="CameraPreview" type="Camera2D" parent="PreviewContainer/PreviewViewportContainer/Viewport"] +[node name="CameraPreview" type="Camera2D" parent="HBoxContainer/PreviewViewportContainer/Viewport"] offset = Vector2( 32, 32 ) current = true zoom = Vector2( 0.15, 0.15 ) script = ExtResource( 4 ) - -[node name="Panel" type="Panel" parent="."] -margin_left = 336.0 -margin_right = 336.0 -margin_bottom = 164.0 -[connection signal="value_changed" from="SettingsContainer/VBoxContainer/PreviewZoomSlider" to="." method="_on_PreviewZoomSlider_value_changed"] -[connection signal="toggled" from="SettingsContainer/VBoxContainer/PlayButton" to="." method="_on_PlayButton_toggled"] diff --git a/src/UI/UI.tscn b/src/UI/UI.tscn index 78df2bc70..3705fd582 100644 --- a/src/UI/UI.tscn +++ b/src/UI/UI.tscn @@ -34,7 +34,8 @@ size_flags_horizontal = 3 size_flags_vertical = 3 custom_constants/separation = 0 __meta__ = { -"_edit_use_anchors_": false +"_edit_use_anchors_": false, +"_edit_vertical_guides_": [ ] } [node name="ToolPanel" type="Panel" parent="."] @@ -332,23 +333,21 @@ __meta__ = { } [node name="CanvasPreviewContainer" parent="RightPanel/PreviewAndPalettes" instance=ExtResource( 16 )] -margin_right = 336.0 +margin_left = 15.0 +margin_right = 315.0 [node name="ToolAndPaletteVSplit" type="VSplitContainer" parent="RightPanel/PreviewAndPalettes"] margin_top = 168.0 -margin_right = 336.0 +margin_right = 330.0 margin_bottom = 676.0 size_flags_vertical = 3 custom_constants/autohide = 0 [node name="ColorAndToolOptions" parent="RightPanel/PreviewAndPalettes/ToolAndPaletteVSplit" instance=ExtResource( 17 )] -margin_right = 336.0 margin_bottom = 248.0 [node name="PalettePanelContainer" parent="RightPanel/PreviewAndPalettes/ToolAndPaletteVSplit" instance=ExtResource( 20 )] -margin_left = 18.0 margin_top = 260.0 -margin_right = 318.0 margin_bottom = 508.0 [connection signal="reposition_active_tab_request" from="CanvasAndTimeline/ViewportAndRulers/TabsContainer/Tabs" to="CanvasAndTimeline/ViewportAndRulers/TabsContainer/Tabs" method="_on_Tabs_reposition_active_tab_request"] [connection signal="tab_changed" from="CanvasAndTimeline/ViewportAndRulers/TabsContainer/Tabs" to="CanvasAndTimeline/ViewportAndRulers/TabsContainer/Tabs" method="_on_Tabs_tab_changed"]