diff --git a/Brushes/circle_blended.png b/Brushes/circle_blended.png new file mode 100644 index 000000000..7a6f59723 Binary files /dev/null and b/Brushes/circle_blended.png differ diff --git a/Main.tscn b/Main.tscn index 932b0a3e0..b932bc710 100644 --- a/Main.tscn +++ b/Main.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=39 format=2] +[gd_scene load_steps=40 format=2] [ext_resource path="res://Scripts/Main.gd" type="Script" id=1] [ext_resource path="res://Assets/Graphics/Tools/RectSelect.png" type="Texture" id=2] @@ -6,35 +6,36 @@ [ext_resource path="res://Assets/Graphics/Tools/Eraser_r.png" type="Texture" id=4] [ext_resource path="res://Assets/Graphics/Tools/Bucket.png" type="Texture" id=5] [ext_resource path="res://Assets/Graphics/Tools/LightenDarken.png" type="Texture" id=6] -[ext_resource path="res://Prefabs/BrushButton.tscn" type="PackedScene" id=7] -[ext_resource path="res://Assets/Graphics/left.png" type="Texture" id=8] -[ext_resource path="res://Assets/Graphics/right.png" type="Texture" id=9] -[ext_resource path="res://Scripts/HorizontalRuler.gd" type="Script" id=10] -[ext_resource path="res://Scripts/VerticalRuler.gd" type="Script" id=11] -[ext_resource path="res://Prefabs/Canvas.tscn" type="PackedScene" id=12] -[ext_resource path="res://Scripts/CameraMovement.gd" type="Script" id=13] -[ext_resource path="res://Scripts/SelectionRectangle.gd" type="Script" id=14] -[ext_resource path="res://Scripts/SecondViewport.gd" type="Script" id=15] -[ext_resource path="res://Assets/Graphics/Timeline/Go_To_First_Frame.png" type="Texture" id=16] -[ext_resource path="res://Assets/Graphics/Timeline/Previous_Frame.png" type="Texture" id=17] -[ext_resource path="res://Assets/Graphics/Timeline/Play Backwards.png" type="Texture" id=18] -[ext_resource path="res://Assets/Graphics/Timeline/Pause.png" type="Texture" id=19] -[ext_resource path="res://Assets/Graphics/Timeline/Play.png" type="Texture" id=20] -[ext_resource path="res://Assets/Graphics/Timeline/Next_Frame.png" type="Texture" id=21] -[ext_resource path="res://Assets/Graphics/Timeline/Go_To_Last_Frame.png" type="Texture" id=22] -[ext_resource path="res://Assets/Graphics/Timeline/Loop_None.png" type="Texture" id=23] -[ext_resource path="res://Assets/Graphics/Timeline/New_Frame.png" type="Texture" id=24] -[ext_resource path="res://Assets/Graphics/Layers/new_layer.png" type="Texture" id=25] -[ext_resource path="res://Assets/Graphics/Layers/delete_layer.png" type="Texture" id=26] -[ext_resource path="res://Assets/Graphics/Layers/delete_layer_disabled.png" type="Texture" id=27] -[ext_resource path="res://Assets/Graphics/Layers/move_up.png" type="Texture" id=28] -[ext_resource path="res://Assets/Graphics/Layers/move_up_disabled.png" type="Texture" id=29] -[ext_resource path="res://Assets/Graphics/Layers/move_down.png" type="Texture" id=30] -[ext_resource path="res://Assets/Graphics/Layers/move_down_disabled.png" type="Texture" id=31] -[ext_resource path="res://Assets/Graphics/Layers/clone_layer.png" type="Texture" id=32] -[ext_resource path="res://Assets/Graphics/Layers/merge_down.png" type="Texture" id=33] -[ext_resource path="res://Assets/Graphics/Layers/merge_down_disabled.png" type="Texture" id=34] -[ext_resource path="res://Scripts/AboutDialog.gd" type="Script" id=35] +[ext_resource path="res://Scripts/HorizontalRuler.gd" type="Script" id=7] +[ext_resource path="res://Scripts/VerticalRuler.gd" type="Script" id=8] +[ext_resource path="res://Prefabs/Canvas.tscn" type="PackedScene" id=9] +[ext_resource path="res://Scripts/CameraMovement.gd" type="Script" id=10] +[ext_resource path="res://Scripts/SelectionRectangle.gd" type="Script" id=11] +[ext_resource path="res://Scripts/SecondViewport.gd" type="Script" id=12] +[ext_resource path="res://Assets/Graphics/Timeline/Go_To_First_Frame.png" type="Texture" id=13] +[ext_resource path="res://Assets/Graphics/Timeline/Previous_Frame.png" type="Texture" id=14] +[ext_resource path="res://Assets/Graphics/Timeline/Play Backwards.png" type="Texture" id=15] +[ext_resource path="res://Assets/Graphics/Timeline/Pause.png" type="Texture" id=16] +[ext_resource path="res://Assets/Graphics/Timeline/Play.png" type="Texture" id=17] +[ext_resource path="res://Assets/Graphics/Timeline/Next_Frame.png" type="Texture" id=18] +[ext_resource path="res://Assets/Graphics/Timeline/Go_To_Last_Frame.png" type="Texture" id=19] +[ext_resource path="res://Assets/Graphics/Timeline/Loop_None.png" type="Texture" id=20] +[ext_resource path="res://Scripts/TimelineSeconds.gd" type="Script" id=21] +[ext_resource path="res://Assets/Graphics/Timeline/New_Frame.png" type="Texture" id=22] +[ext_resource path="res://Assets/Graphics/Layers/new_layer.png" type="Texture" id=23] +[ext_resource path="res://Assets/Graphics/Layers/delete_layer.png" type="Texture" id=24] +[ext_resource path="res://Assets/Graphics/Layers/delete_layer_disabled.png" type="Texture" id=25] +[ext_resource path="res://Assets/Graphics/Layers/move_up.png" type="Texture" id=26] +[ext_resource path="res://Assets/Graphics/Layers/move_up_disabled.png" type="Texture" id=27] +[ext_resource path="res://Assets/Graphics/Layers/move_down.png" type="Texture" id=28] +[ext_resource path="res://Assets/Graphics/Layers/move_down_disabled.png" type="Texture" id=29] +[ext_resource path="res://Assets/Graphics/Layers/clone_layer.png" type="Texture" id=30] +[ext_resource path="res://Assets/Graphics/Layers/merge_down.png" type="Texture" id=31] +[ext_resource path="res://Assets/Graphics/Layers/merge_down_disabled.png" type="Texture" id=32] +[ext_resource path="res://Prefabs/BrushButton.tscn" type="PackedScene" id=33] +[ext_resource path="res://Assets/Graphics/left.png" type="Texture" id=34] +[ext_resource path="res://Assets/Graphics/right.png" type="Texture" id=35] +[ext_resource path="res://Scripts/AboutDialog.gd" type="Script" id=36] [sub_resource type="StyleBoxFlat" id=1] bg_color = Color( 0.223529, 0.223529, 0.243137, 1 ) @@ -56,12 +57,12 @@ __meta__ = { } [node name="MenuAndUI" type="VBoxContainer" parent="."] -editor/display_folded = true anchor_right = 1.0 anchor_bottom = 1.0 custom_constants/separation = 0 [node name="MenuContainer" type="Panel" parent="MenuAndUI"] +editor/display_folded = true margin_right = 1152.0 margin_bottom = 28.0 rect_min_size = Vector2( 0, 28 ) @@ -123,7 +124,6 @@ text = "[64x64]" align = 2 [node name="UI" type="HBoxContainer" parent="MenuAndUI"] -editor/display_folded = true margin_top = 28.0 margin_right = 1152.0 margin_bottom = 648.0 @@ -138,7 +138,6 @@ rect_min_size = Vector2( 242, 0 ) size_flags_vertical = 3 [node name="Tools" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel"] -editor/display_folded = true anchor_right = 1.0 anchor_bottom = 1.0 margin_left = 8.0 @@ -149,7 +148,7 @@ size_flags_vertical = 3 [node name="MenusAndTools" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools"] margin_right = 226.0 -margin_bottom = 230.0 +margin_bottom = 300.0 size_flags_vertical = 3 custom_constants/separation = 17 @@ -271,21 +270,21 @@ button_mask = 3 text = "PaintSameColor" [node name="HSeparator" type="HSeparator" parent="MenuAndUI/UI/ToolPanel/Tools"] -margin_top = 234.0 +margin_top = 304.0 margin_right = 226.0 -margin_bottom = 238.0 +margin_bottom = 308.0 [node name="ToolOptions" type="HBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools"] editor/display_folded = true -margin_top = 242.0 +margin_top = 312.0 margin_right = 226.0 -margin_bottom = 472.0 +margin_bottom = 612.0 size_flags_vertical = 3 custom_constants/separation = 0 [node name="LeftToolOptions" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions"] margin_right = 109.0 -margin_bottom = 230.0 +margin_bottom = 300.0 size_flags_horizontal = 3 [node name="LeftLabel" type="Label" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/LeftToolOptions"] @@ -383,12 +382,12 @@ text = "Vert. Mirror" [node name="VSeparator" type="VSeparator" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions"] margin_left = 109.0 margin_right = 113.0 -margin_bottom = 230.0 +margin_bottom = 300.0 [node name="RightToolOptions" type="VBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions"] margin_left = 113.0 margin_right = 226.0 -margin_bottom = 230.0 +margin_bottom = 300.0 size_flags_horizontal = 3 [node name="RightLabel" type="Label" parent="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions"] @@ -482,69 +481,6 @@ hint_tooltip = "Enable vertical mirrored drawing for the right tool" mouse_default_cursor_shape = 2 text = "Vert. Mirror" -[node name="HSeparator2" type="HSeparator" parent="MenuAndUI/UI/ToolPanel/Tools"] -margin_top = 476.0 -margin_right = 226.0 -margin_bottom = 480.0 - -[node name="FileBrushes" type="Label" parent="MenuAndUI/UI/ToolPanel/Tools"] -margin_top = 484.0 -margin_right = 226.0 -margin_bottom = 498.0 -text = "Brushes From Files" - -[node name="BrushesContainer" type="ScrollContainer" parent="MenuAndUI/UI/ToolPanel/Tools"] -margin_top = 502.0 -margin_right = 226.0 -margin_bottom = 538.0 -size_flags_horizontal = 3 -scroll_vertical_enabled = false - -[node name="BrushHBoxContainer" type="HBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/BrushesContainer"] -editor/display_folded = true -margin_right = 36.0 -margin_bottom = 36.0 - -[node name="PixelBrushButton" parent="MenuAndUI/UI/ToolPanel/Tools/BrushesContainer/BrushHBoxContainer" instance=ExtResource( 7 )] -hint_tooltip = "Pixel brush" - -[node name="LeftBrushIndicator" type="Sprite" parent="MenuAndUI/UI/ToolPanel/Tools/BrushesContainer/BrushHBoxContainer/PixelBrushButton"] -scale = Vector2( 0.8, 0.8 ) -texture = ExtResource( 8 ) -centered = false - -[node name="RightBrushIndicator" type="Sprite" parent="MenuAndUI/UI/ToolPanel/Tools/BrushesContainer/BrushHBoxContainer/PixelBrushButton"] -scale = Vector2( 0.8, 0.8 ) -texture = ExtResource( 9 ) -centered = false -offset = Vector2( 28, 0 ) - -[node name="HSeparator3" type="HSeparator" parent="MenuAndUI/UI/ToolPanel/Tools"] -margin_top = 542.0 -margin_right = 226.0 -margin_bottom = 546.0 - -[node name="ProjectBrushes" type="Label" parent="MenuAndUI/UI/ToolPanel/Tools"] -margin_top = 550.0 -margin_right = 226.0 -margin_bottom = 564.0 -text = "Custom Project Brushes" - -[node name="CustomBrushesContainer" type="ScrollContainer" parent="MenuAndUI/UI/ToolPanel/Tools"] -margin_top = 568.0 -margin_right = 226.0 -margin_bottom = 604.0 -rect_min_size = Vector2( 0, 36 ) -size_flags_horizontal = 3 -scroll_vertical_enabled = false - -[node name="CustomBrushHBoxContainer" type="HBoxContainer" parent="MenuAndUI/UI/ToolPanel/Tools/CustomBrushesContainer"] - -[node name="HSeparator4" type="HSeparator" parent="MenuAndUI/UI/ToolPanel/Tools"] -margin_top = 608.0 -margin_right = 226.0 -margin_bottom = 612.0 - [node name="CanvasAndTimeline" type="VBoxContainer" parent="MenuAndUI/UI"] editor/display_folded = true margin_left = 242.0 @@ -571,7 +507,7 @@ margin_right = 686.0 margin_bottom = 16.0 rect_min_size = Vector2( 0, 16 ) custom_styles/panel = SubResource( 2 ) -script = ExtResource( 10 ) +script = ExtResource( 7 ) [node name="ViewportandVerticalRuler" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers"] margin_top = 16.0 @@ -587,7 +523,7 @@ rect_min_size = Vector2( 16, 0 ) size_flags_horizontal = 0 size_flags_vertical = 3 custom_styles/panel = SubResource( 3 ) -script = ExtResource( 11 ) +script = ExtResource( 8 ) [node name="ViewportContainer" type="ViewportContainer" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers/ViewportandVerticalRuler"] margin_left = 16.0 @@ -602,18 +538,18 @@ size = Vector2( 670, 462 ) handle_input_locally = false render_target_update_mode = 3 -[node name="Canvas" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers/ViewportandVerticalRuler/ViewportContainer/Viewport" instance=ExtResource( 12 )] +[node name="Canvas" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers/ViewportandVerticalRuler/ViewportContainer/Viewport" instance=ExtResource( 9 )] [node name="Camera2D" type="Camera2D" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers/ViewportandVerticalRuler/ViewportContainer/Viewport"] current = true zoom = Vector2( 0.15, 0.15 ) -script = ExtResource( 13 ) +script = ExtResource( 10 ) [node name="SelectionRectangle" type="Polygon2D" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers/ViewportandVerticalRuler/ViewportContainer/Viewport"] z_index = 1 color = Color( 0.0823529, 0.694118, 0.623529, 0.592157 ) polygon = PoolVector2Array( 0, 0, 0, 0, 0, 0, 0, 0 ) -script = ExtResource( 14 ) +script = ExtResource( 11 ) [node name="ViewportSeparator" type="VSeparator" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer"] visible = false @@ -635,12 +571,12 @@ stretch = true size = Vector2( 315, 464 ) handle_input_locally = false render_target_update_mode = 0 -script = ExtResource( 15 ) +script = ExtResource( 12 ) [node name="Camera2D2" type="Camera2D" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportContainer2/Viewport"] current = true zoom = Vector2( 0.15, 0.15 ) -script = ExtResource( 13 ) +script = ExtResource( 10 ) [node name="AnimationTimeline" type="Panel" parent="MenuAndUI/UI/CanvasAndTimeline"] editor/display_folded = true @@ -658,7 +594,6 @@ 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 @@ -670,6 +605,7 @@ 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 ) @@ -683,6 +619,7 @@ margin_bottom = 7.0 text = "Current frame: 1/1" [node name="PlaybackButtons" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/AnimationButtons"] +editor/display_folded = true anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 @@ -697,14 +634,14 @@ size_flags_horizontal = 0 margin_right = 20.0 margin_bottom = 20.0 mouse_default_cursor_shape = 2 -texture_normal = ExtResource( 16 ) +texture_normal = ExtResource( 13 ) [node name="PreviousFrame" type="TextureButton" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/AnimationButtons/PlaybackButtons"] margin_left = 24.0 margin_right = 44.0 margin_bottom = 20.0 mouse_default_cursor_shape = 2 -texture_normal = ExtResource( 17 ) +texture_normal = ExtResource( 14 ) [node name="PlayBackwards" type="TextureButton" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/AnimationButtons/PlaybackButtons"] margin_left = 48.0 @@ -713,8 +650,8 @@ margin_bottom = 20.0 hint_tooltip = "Play the animation backwards (from end to beggining)" mouse_default_cursor_shape = 2 toggle_mode = true -texture_normal = ExtResource( 18 ) -texture_pressed = ExtResource( 19 ) +texture_normal = ExtResource( 15 ) +texture_pressed = ExtResource( 16 ) [node name="PlayForward" type="TextureButton" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/AnimationButtons/PlaybackButtons"] margin_left = 72.0 @@ -724,22 +661,22 @@ hint_tooltip = "Play the animation forward (from beggining to end)" mouse_default_cursor_shape = 2 size_flags_horizontal = 0 toggle_mode = true -texture_normal = ExtResource( 20 ) -texture_pressed = ExtResource( 19 ) +texture_normal = ExtResource( 17 ) +texture_pressed = ExtResource( 16 ) [node name="NextFrame" type="TextureButton" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/AnimationButtons/PlaybackButtons"] margin_left = 96.0 margin_right = 116.0 margin_bottom = 20.0 mouse_default_cursor_shape = 2 -texture_normal = ExtResource( 21 ) +texture_normal = ExtResource( 18 ) [node name="LastFrame" type="TextureButton" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/AnimationButtons/PlaybackButtons"] margin_left = 120.0 margin_right = 140.0 margin_bottom = 20.0 mouse_default_cursor_shape = 2 -texture_normal = ExtResource( 22 ) +texture_normal = ExtResource( 19 ) [node name="LoopButtons" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/AnimationButtons"] anchor_left = 1.0 @@ -769,51 +706,47 @@ 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" mouse_default_cursor_shape = 2 -texture_normal = ExtResource( 23 ) +texture_normal = ExtResource( 20 ) [node name="HSeparator" type="HSeparator" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer"] margin_top = 28.0 margin_right = 525.0 margin_bottom = 32.0 -[node name="CenterContainer" type="CenterContainer" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer"] +[node name="TimelineSeconds" type="Control" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer"] margin_top = 36.0 margin_right = 525.0 -margin_bottom = 36.0 - -[node name="FrameButtons" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/CenterContainer"] -margin_left = 262.0 -margin_right = 262.0 +margin_bottom = 52.0 +rect_min_size = Vector2( 0, 16 ) +script = ExtResource( 21 ) [node name="HSeparator2" type="HSeparator" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer"] -margin_top = 40.0 +margin_top = 56.0 margin_right = 525.0 -margin_bottom = 44.0 +margin_bottom = 60.0 -[node name="ScrollContainer" type="ScrollContainer" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer"] -margin_top = 48.0 +[node name="FrameAndButtonContainer" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer"] +margin_top = 64.0 margin_right = 525.0 -margin_bottom = 138.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -scroll_vertical_enabled = false +margin_bottom = 100.0 -[node name="FrameAndButtonContainer" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/ScrollContainer"] -margin_right = 40.0 -margin_bottom = 36.0 - -[node name="AddFrame" type="TextureButton" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/ScrollContainer/FrameAndButtonContainer"] +[node name="AddFrame" type="TextureButton" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/FrameAndButtonContainer"] margin_right = 36.0 margin_bottom = 36.0 hint_tooltip = "Add a new frame" mouse_default_cursor_shape = 2 size_flags_horizontal = 0 -texture_normal = ExtResource( 24 ) +texture_normal = ExtResource( 22 ) -[node name="FrameContainer" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/ScrollContainer/FrameAndButtonContainer"] +[node name="ScrollContainer" type="ScrollContainer" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/FrameAndButtonContainer"] margin_left = 40.0 -margin_right = 40.0 +margin_right = 525.0 margin_bottom = 36.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +scroll_vertical_enabled = false + +[node name="FrameContainer" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/FrameAndButtonContainer/ScrollContainer"] [node name="VSeparator" type="VSeparator" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer"] margin_left = 529.0 @@ -862,31 +795,18 @@ 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 rect_min_size = Vector2( 224, 0 ) [node name="LayersAndMisc" type="VBoxContainer" parent="MenuAndUI/UI/LayerPanel"] -editor/display_folded = true anchor_right = 1.0 anchor_bottom = 1.0 margin_top = 8.0 custom_constants/separation = 3 -[node name="ScrollContainer" type="ScrollContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc"] -margin_right = 224.0 -margin_bottom = 612.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 - -[node name="VBoxLayerContainer" type="VBoxContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/ScrollContainer"] -margin_right = 224.0 -margin_bottom = 58.0 -size_flags_horizontal = 3 - -[node name="LayerLabel" type="Label" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/ScrollContainer/VBoxLayerContainer"] +[node name="LayerLabel" type="Label" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc"] margin_right = 224.0 margin_bottom = 14.0 size_flags_horizontal = 3 @@ -894,77 +814,152 @@ size_flags_vertical = 0 text = "Layers" align = 1 -[node name="HSeparator" type="HSeparator" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/ScrollContainer/VBoxLayerContainer"] -margin_top = 18.0 +[node name="HSeparator" type="HSeparator" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc"] +margin_top = 17.0 margin_right = 224.0 -margin_bottom = 22.0 +margin_bottom = 21.0 -[node name="CenterContainer" type="CenterContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/ScrollContainer/VBoxLayerContainer"] +[node name="CenterContainer" type="CenterContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc"] editor/display_folded = true -margin_top = 26.0 +margin_top = 24.0 margin_right = 224.0 -margin_bottom = 58.0 +margin_bottom = 56.0 -[node name="LayerButtons" type="HBoxContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/ScrollContainer/VBoxLayerContainer/CenterContainer"] +[node name="LayerButtons" type="HBoxContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/CenterContainer"] editor/display_folded = true margin_left = 6.0 margin_right = 218.0 margin_bottom = 32.0 -[node name="AddLayerButton" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/ScrollContainer/VBoxLayerContainer/CenterContainer/LayerButtons"] +[node name="AddLayerButton" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/CenterContainer/LayerButtons"] margin_right = 32.0 margin_bottom = 32.0 hint_tooltip = "Create a new layer" mouse_default_cursor_shape = 2 -texture_normal = ExtResource( 25 ) +texture_normal = ExtResource( 23 ) -[node name="RemoveLayerButton" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/ScrollContainer/VBoxLayerContainer/CenterContainer/LayerButtons"] +[node name="RemoveLayerButton" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/CenterContainer/LayerButtons"] margin_left = 36.0 margin_right = 68.0 margin_bottom = 32.0 hint_tooltip = "Remove current layer" mouse_default_cursor_shape = 8 disabled = true -texture_normal = ExtResource( 26 ) -texture_disabled = ExtResource( 27 ) +texture_normal = ExtResource( 24 ) +texture_disabled = ExtResource( 25 ) -[node name="MoveUpLayer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/ScrollContainer/VBoxLayerContainer/CenterContainer/LayerButtons"] +[node name="MoveUpLayer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/CenterContainer/LayerButtons"] margin_left = 72.0 margin_right = 104.0 margin_bottom = 32.0 hint_tooltip = "Move up the current layer" mouse_default_cursor_shape = 8 disabled = true -texture_normal = ExtResource( 28 ) -texture_disabled = ExtResource( 29 ) +texture_normal = ExtResource( 26 ) +texture_disabled = ExtResource( 27 ) -[node name="MoveDownLayer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/ScrollContainer/VBoxLayerContainer/CenterContainer/LayerButtons"] +[node name="MoveDownLayer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/CenterContainer/LayerButtons"] margin_left = 108.0 margin_right = 140.0 margin_bottom = 32.0 hint_tooltip = "Move down the current layer" mouse_default_cursor_shape = 8 disabled = true -texture_normal = ExtResource( 30 ) -texture_disabled = ExtResource( 31 ) +texture_normal = ExtResource( 28 ) +texture_disabled = ExtResource( 29 ) -[node name="CloneLayer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/ScrollContainer/VBoxLayerContainer/CenterContainer/LayerButtons"] +[node name="CloneLayer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/CenterContainer/LayerButtons"] margin_left = 144.0 margin_right = 176.0 margin_bottom = 32.0 hint_tooltip = "Clone current layer" mouse_default_cursor_shape = 2 -texture_normal = ExtResource( 32 ) +texture_normal = ExtResource( 30 ) -[node name="MergeDownLayer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/ScrollContainer/VBoxLayerContainer/CenterContainer/LayerButtons"] +[node name="MergeDownLayer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/CenterContainer/LayerButtons"] margin_left = 180.0 margin_right = 212.0 margin_bottom = 32.0 hint_tooltip = "Merge down current layer" mouse_default_cursor_shape = 8 disabled = true -texture_normal = ExtResource( 33 ) -texture_disabled = ExtResource( 34 ) +texture_normal = ExtResource( 31 ) +texture_disabled = ExtResource( 32 ) + +[node name="ScrollContainer" type="ScrollContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc"] +editor/display_folded = true +margin_top = 59.0 +margin_right = 224.0 +margin_bottom = 523.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="VBoxLayerContainer" type="VBoxContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/ScrollContainer"] +margin_right = 224.0 +size_flags_horizontal = 3 + +[node name="HSeparator2" type="HSeparator" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc"] +margin_top = 526.0 +margin_right = 224.0 +margin_bottom = 530.0 + +[node name="TabContainer" type="TabContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc"] +margin_top = 533.0 +margin_right = 224.0 +margin_bottom = 605.0 +drag_to_rearrange_enabled = true + +[node name="File" type="ScrollContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/TabContainer"] +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 4.0 +margin_top = 32.0 +margin_right = -4.0 +margin_bottom = -4.0 +rect_min_size = Vector2( 0, 36 ) +size_flags_horizontal = 3 +scroll_horizontal_enabled = false + +[node name="FileBrushContainer" type="GridContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/TabContainer/File"] +editor/display_folded = true +margin_right = 36.0 +margin_bottom = 36.0 +columns = 5 + +[node name="PixelBrushButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/TabContainer/File/FileBrushContainer" instance=ExtResource( 33 )] +editor/display_folded = true +hint_tooltip = "Pixel brush" + +[node name="LeftBrushIndicator" type="Sprite" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/TabContainer/File/FileBrushContainer/PixelBrushButton"] +scale = Vector2( 0.8, 0.8 ) +texture = ExtResource( 34 ) +centered = false + +[node name="RightBrushIndicator" type="Sprite" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/TabContainer/File/FileBrushContainer/PixelBrushButton"] +scale = Vector2( 0.8, 0.8 ) +texture = ExtResource( 35 ) +centered = false +offset = Vector2( 28, 0 ) + +[node name="Project" type="ScrollContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/TabContainer"] +visible = false +anchor_right = 1.0 +anchor_bottom = 1.0 +margin_left = 4.0 +margin_top = 32.0 +margin_right = -4.0 +margin_bottom = -4.0 +rect_min_size = Vector2( 0, 36 ) +size_flags_horizontal = 3 +scroll_horizontal_enabled = false + +[node name="ProjectBrushContainer" type="GridContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/TabContainer/Project"] +columns = 5 + +[node name="HSeparator3" type="HSeparator" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc"] +margin_top = 608.0 +margin_right = 224.0 +margin_bottom = 612.0 [node name="SplitScreenButton" type="Button" parent="."] anchor_left = 1.0 @@ -1187,7 +1182,7 @@ editor/display_folded = true margin_right = 284.0 margin_bottom = 186.0 window_title = "About Pixelorama" -script = ExtResource( 35 ) +script = ExtResource( 36 ) [node name="AboutUI" type="VBoxContainer" parent="AboutDialog"] margin_left = 8.0 @@ -1217,7 +1212,8 @@ margin_right = 268.0 margin_bottom = 107.0 [node name="LinkButtons" type="HBoxContainer" parent="AboutDialog/AboutUI/Links"] -margin_right = 268.0 +margin_left = 22.0 +margin_right = 246.0 margin_bottom = 20.0 [node name="Website" type="Button" parent="AboutDialog/AboutUI/Links/LinkButtons"] @@ -1237,12 +1233,6 @@ margin_right = 224.0 margin_bottom = 20.0 text = "Donate" -[node name="Blog" type="Button" parent="AboutDialog/AboutUI/Links/LinkButtons"] -margin_left = 228.0 -margin_right = 268.0 -margin_bottom = 20.0 -text = "Blog" - [node name="Copyright" type="Label" parent="AboutDialog/AboutUI"] margin_top = 111.0 margin_right = 268.0 @@ -1280,16 +1270,16 @@ align = 1 [connection signal="pressed" from="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/AnimationButtons/PlaybackButtons/LastFrame" to="." method="_on_LastFrame_pressed"] [connection signal="value_changed" from="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/AnimationButtons/LoopButtons/FPSValue" to="." method="_on_FPSValue_value_changed"] [connection signal="pressed" from="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/AnimationButtons/LoopButtons/LoopAnim" to="." method="_on_LoopAnim_pressed"] -[connection signal="pressed" from="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/ScrollContainer/FrameAndButtonContainer/AddFrame" to="." method="add_frame"] +[connection signal="pressed" from="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/FrameAndButtonContainer/AddFrame" to="." method="add_frame"] [connection signal="value_changed" from="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/OnionSkinningButtons/PastOnionSkinning" to="." method="_on_PastOnionSkinning_value_changed"] [connection signal="value_changed" from="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/OnionSkinningButtons/FutureOnionSkinning" to="." method="_on_FutureOnionSkinning_value_changed"] [connection signal="toggled" from="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/OnionSkinningButtons/BlueRedMode" to="." method="_on_BlueRedMode_toggled"] -[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/ScrollContainer/VBoxLayerContainer/CenterContainer/LayerButtons/AddLayerButton" to="." method="add_layer"] -[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/ScrollContainer/VBoxLayerContainer/CenterContainer/LayerButtons/RemoveLayerButton" to="." method="_on_RemoveLayerButton_pressed"] -[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/ScrollContainer/VBoxLayerContainer/CenterContainer/LayerButtons/MoveUpLayer" to="." method="change_layer_order" binds= [ 1 ]] -[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/ScrollContainer/VBoxLayerContainer/CenterContainer/LayerButtons/MoveDownLayer" to="." method="change_layer_order" binds= [ -1 ]] -[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/ScrollContainer/VBoxLayerContainer/CenterContainer/LayerButtons/CloneLayer" to="." method="add_layer" binds= [ false ]] -[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/ScrollContainer/VBoxLayerContainer/CenterContainer/LayerButtons/MergeDownLayer" to="." method="_on_MergeLayer_pressed"] +[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/CenterContainer/LayerButtons/AddLayerButton" to="." method="add_layer"] +[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/CenterContainer/LayerButtons/RemoveLayerButton" to="." method="_on_RemoveLayerButton_pressed"] +[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/CenterContainer/LayerButtons/MoveUpLayer" to="." method="change_layer_order" binds= [ 1 ]] +[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/CenterContainer/LayerButtons/MoveDownLayer" to="." method="change_layer_order" binds= [ -1 ]] +[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/CenterContainer/LayerButtons/CloneLayer" to="." method="add_layer" binds= [ false ]] +[connection signal="pressed" from="MenuAndUI/UI/LayerPanel/LayersAndMisc/CenterContainer/LayerButtons/MergeDownLayer" to="." method="_on_MergeLayer_pressed"] [connection signal="toggled" from="SplitScreenButton" to="." method="_on_SplitScreenButton_toggled"] [connection signal="confirmed" from="CreateNewImage" to="." method="_on_CreateNewImage_confirmed"] [connection signal="popup_hide" from="CreateNewImage" to="." method="_can_draw_true"] @@ -1307,5 +1297,4 @@ align = 1 [connection signal="pressed" from="AboutDialog/AboutUI/Links/LinkButtons/Website" to="AboutDialog" method="_on_Website_pressed"] [connection signal="pressed" from="AboutDialog/AboutUI/Links/LinkButtons/GitHub" to="AboutDialog" method="_on_GitHub_pressed"] [connection signal="pressed" from="AboutDialog/AboutUI/Links/LinkButtons/Donate" to="AboutDialog" method="_on_Donate_pressed"] -[connection signal="pressed" from="AboutDialog/AboutUI/Links/LinkButtons/Blog" to="AboutDialog" method="_on_Blog_pressed"] [connection signal="timeout" from="AnimationTimer" to="." method="_on_AnimationTimer_timeout"] diff --git a/README.md b/README.md index f677ce6ad..9ae06cc7d 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Pixelorama - your free and open-source sprite editor! - Your free & open-source 2D sprite editor, made in the Godot Engine, using GDScript! + Your free & open-source 2D sprite editor, made by Orama Interactive in the Godot Engine, using GDScript! [![Pixelorama's horrible UI](https://functionoverload590613498.files.wordpress.com/2019/11/screenshot_268.png)](https://www.youtube.com/watch?v=h3OJROgAR-A&list=PLVEP1Zz6BUpBiQC0CB6eNBhhLF4tEwBB-) @@ -23,7 +23,7 @@ Current features as of version v0.4: - Just like onions, Pixelorama has a multiple layer system! You can add, remove, move up and down, clone and merge as many layers as you like! You can also rename them! - Scale, crop and flip your images! -Make sure to read my blog post on Function(Overload) for more information! https://functionoverload590613498.wordpress.com/2019/08/18/i-made-my-own-sprite-editor-in-godot/ +Make sure to visit our website for more information! https://www.orama-interactive.com/pixelorama Download it as a stand-alone on itch.io: https://orama-interactive.itch.io/pixelorama diff --git a/Scripts/AboutDialog.gd b/Scripts/AboutDialog.gd index 0e9a09825..63d53d083 100644 --- a/Scripts/AboutDialog.gd +++ b/Scripts/AboutDialog.gd @@ -6,7 +6,7 @@ func _ready() -> void: $AboutUI/Pixelorama.text = "Pixelorama %s\n" % current_version func _on_Website_pressed() -> void: - OS.shell_open("http://oramagamestudios.com/") + OS.shell_open("https://www.orama-interactive.com/") func _on_GitHub_pressed() -> void: OS.shell_open("https://github.com/OverloadedOrama/Pixelorama") @@ -14,6 +14,3 @@ func _on_GitHub_pressed() -> void: func _on_Donate_pressed() -> void: OS.shell_open("https://www.paypal.com/paypalme2/OverloadedOrama") OS.shell_open("https://ko-fi.com/overloadedorama") - -func _on_Blog_pressed() -> void: - OS.shell_open("https://functionoverload590613498.wordpress.com/") diff --git a/Scripts/BrushButton.gd b/Scripts/BrushButton.gd index d658aca52..f5c0196bd 100644 --- a/Scripts/BrushButton.gd +++ b/Scripts/BrushButton.gd @@ -21,24 +21,22 @@ func _on_BrushButton_pressed() -> void: Global.update_right_custom_brush() func _on_DeleteButton_pressed() -> void: - var file_hbox_container := Global.find_node_by_name(get_tree().get_root(), "BrushHBoxContainer") - var custom_hbox_container := Global.find_node_by_name(get_tree().get_root(), "CustomBrushHBoxContainer") if brush_type == Global.BRUSH_TYPES.CUSTOM: if Global.custom_left_brush_index == custom_brush_index: Global.custom_left_brush_index = -1 Global.current_left_brush_type = Global.BRUSH_TYPES.PIXEL remove_child(Global.left_brush_indicator) - file_hbox_container.get_child(0).add_child(Global.left_brush_indicator) + Global.file_brush_container.get_child(0).add_child(Global.left_brush_indicator) if Global.custom_right_brush_index == custom_brush_index: Global.custom_right_brush_index = -1 Global.current_right_brush_type = Global.BRUSH_TYPES.PIXEL remove_child(Global.right_brush_indicator) - file_hbox_container.get_child(0).add_child(Global.right_brush_indicator) + Global.file_brush_container.get_child(0).add_child(Global.right_brush_indicator) Global.undos += 1 Global.undo_redo.create_action("Delete Custom Brush") - for i in range(custom_brush_index - 1, custom_hbox_container.get_child_count()): - var bb = custom_hbox_container.get_child(i) + for i in range(custom_brush_index - 1, Global.project_brush_container.get_child_count()): + var bb = Global.project_brush_container.get_child(i) if Global.custom_left_brush_index == bb.custom_brush_index: Global.custom_left_brush_index -= 1 if Global.custom_right_brush_index == bb.custom_brush_index: diff --git a/Scripts/Canvas.gd b/Scripts/Canvas.gd index fae9f743b..e62b75166 100644 --- a/Scripts/Canvas.gd +++ b/Scripts/Canvas.gd @@ -69,8 +69,6 @@ func camera_zoom() -> void: #Set camera offset to the center of canvas Global.camera.offset = size / 2 - #Global.camera.offset.x = size.x / 2 + Global.main_viewport.rect_size.x / 2 * -Global.camera.zoom.x - #Global.camera.offset.y = size.y / 2 + Global.main_viewport.rect_size.y / 2 * -Global.camera.zoom.y Global.camera2.offset = size / 2 # warning-ignore:unused_argument diff --git a/Scripts/Global.gd b/Scripts/Global.gd index 42213d69f..6aab89c95 100644 --- a/Scripts/Global.gd +++ b/Scripts/Global.gd @@ -79,6 +79,8 @@ var right_brush_size := 1 var current_left_brush_type = BRUSH_TYPES.PIXEL # warning-ignore:unused_class_variable var current_right_brush_type = BRUSH_TYPES.PIXEL +var file_brush_container +var project_brush_container # warning-ignore:unused_class_variable var left_horizontal_mirror := false # warning-ignore:unused_class_variable @@ -148,6 +150,8 @@ func _ready() -> void: cursor_position_label = find_node_by_name(root, "CursorPosition") zoom_level_label = find_node_by_name(root, "ZoomLevel") current_frame_label = find_node_by_name(root, "CurrentFrame") + file_brush_container = find_node_by_name(root, "FileBrushContainer") + project_brush_container = find_node_by_name(root, "ProjectBrushContainer") #Thanks to https://godotengine.org/qa/17524/how-to-find-an-instanced-scene-by-its-name func find_node_by_name(root, node_name) -> Node: @@ -257,33 +261,31 @@ func frame_changed(value : int) -> void: func create_brush_button(brush_img : Image, brush_type := BRUSH_TYPES.CUSTOM) -> void: - var hbox_container : HBoxContainer + var brush_container var brush_button = load("res://Prefabs/BrushButton.tscn").instance() brush_button.brush_type = brush_type brush_button.custom_brush_index = custom_brushes.size() - 1 if brush_type == BRUSH_TYPES.FILE: - hbox_container = find_node_by_name(get_tree().get_root(), "BrushHBoxContainer") + brush_container = file_brush_container else: - hbox_container = find_node_by_name(get_tree().get_root(), "CustomBrushHBoxContainer") + brush_container = project_brush_container var brush_tex := ImageTexture.new() brush_tex.create_from_image(brush_img, 0) brush_button.get_child(0).texture = brush_tex - hbox_container.add_child(brush_button) + brush_container.add_child(brush_button) func remove_brush_buttons() -> void: current_left_brush_type = BRUSH_TYPES.PIXEL current_right_brush_type = BRUSH_TYPES.PIXEL - var hbox_container := find_node_by_name(get_tree().get_root(), "CustomBrushHBoxContainer") - for child in hbox_container.get_children(): + for child in project_brush_container.get_children(): child.queue_free() func undo_custom_brush(_brush_button : Button = null) -> void: undos -= 1 var action_name := undo_redo.get_current_action_name() - var hbox_container := find_node_by_name(get_tree().get_root(), "CustomBrushHBoxContainer") if action_name == "Delete Custom Brush": - hbox_container.add_child(_brush_button) - hbox_container.move_child(_brush_button, _brush_button.custom_brush_index - brushes_from_files) + project_brush_container.add_child(_brush_button) + project_brush_container.move_child(_brush_button, _brush_button.custom_brush_index - brushes_from_files) _brush_button.get_node("DeleteButton").visible = false notification_label("Undo: %s" % action_name) @@ -291,9 +293,8 @@ func redo_custom_brush(_brush_button : Button = null) -> void: if undos < undo_redo.get_version(): #If we did undo and then redo undos = undo_redo.get_version() var action_name := undo_redo.get_current_action_name() - var hbox_container := find_node_by_name(get_tree().get_root(), "CustomBrushHBoxContainer") if action_name == "Delete Custom Brush": - hbox_container.remove_child(_brush_button) + project_brush_container.remove_child(_brush_button) if control.redone: notification_label("Redo: %s" % action_name) diff --git a/Scripts/HorizontalRuler.gd b/Scripts/HorizontalRuler.gd index 854b8c0b9..4aa4ec2ca 100644 --- a/Scripts/HorizontalRuler.gd +++ b/Scripts/HorizontalRuler.gd @@ -13,6 +13,7 @@ var last : Vector2 func _process(delta) -> void: update() +#Code taken and modified from Godot's source code func _draw() -> void: var transform := Transform2D() var ruler_transform := Transform2D() @@ -38,15 +39,15 @@ func _draw() -> void: major_subdivide = major_subdivide.scaled(Vector2(1.0 / major_subdivision, 1.0 / major_subdivision)) minor_subdivide = minor_subdivide.scaled(Vector2(1.0 / minor_subdivision, 1.0 / minor_subdivision)) - first = (transform * ruler_transform * major_subdivide * minor_subdivide).affine_inverse().xform(Vector2.ZERO); - last = (transform * ruler_transform * major_subdivide * minor_subdivide).affine_inverse().xform(Global.main_viewport.rect_size); + first = (transform * ruler_transform * major_subdivide * minor_subdivide).affine_inverse().xform(Vector2.ZERO) + last = (transform * ruler_transform * major_subdivide * minor_subdivide).affine_inverse().xform(Global.main_viewport.rect_size) for i in range(ceil(first.x), last.x): var position : Vector2 = (transform * ruler_transform * major_subdivide * minor_subdivide).xform(Vector2(i, 0)) if i % (major_subdivision * minor_subdivision) == 0: draw_line(Vector2(position.x + RULER_WIDTH, 0), Vector2(position.x + RULER_WIDTH, RULER_WIDTH), Color.white) var val = (ruler_transform * major_subdivide * minor_subdivide).xform(Vector2(i, 0)).x - draw_string(font, Vector2(position.x + RULER_WIDTH + 2, font.get_height()), str(int(val))) + draw_string(font, Vector2(position.x + RULER_WIDTH + 2, font.get_height() - 4), str(int(val))) else: if i % minor_subdivision == 0: draw_line(Vector2(position.x + RULER_WIDTH, RULER_WIDTH * 0.33), Vector2(position.x + RULER_WIDTH, RULER_WIDTH), Color.white) diff --git a/Scripts/TimelineSeconds.gd b/Scripts/TimelineSeconds.gd new file mode 100644 index 000000000..1cc8ca696 --- /dev/null +++ b/Scripts/TimelineSeconds.gd @@ -0,0 +1,54 @@ +extends Control + +const RULER_WIDTH := 16 + +var font := preload("res://Assets/Fonts/Roboto-Small.tres") +var major_subdivision := 2 +var minor_subdivision := 3 + +var first : Vector2 +var last : Vector2 + +# warning-ignore:unused_argument +func _process(delta) -> void: + update() + +#Code taken and modified from Godot's source code +func _draw() -> void: + var transform := Transform2D() + var ruler_transform := Transform2D() + var major_subdivide := Transform2D() + var minor_subdivide := Transform2D() + var fps = Global.control.fps + var horizontal_scroll = get_parent().get_node("FrameAndButtonContainer").get_node("ScrollContainer").scroll_horizontal + var starting_pos := Vector2(26, 26) + transform.x = Vector2(fps, fps) / 2.52 + + transform.origin = starting_pos - Vector2(horizontal_scroll, horizontal_scroll) + + var basic_rule := 100.0 + while(basic_rule * fps > 100): + basic_rule /= 2.0 + while(basic_rule * fps < 100): + basic_rule *= 2.0 + + ruler_transform = ruler_transform.scaled(Vector2(basic_rule, basic_rule)) + + major_subdivide = major_subdivide.scaled(Vector2(1.0 / major_subdivision, 1.0 / major_subdivision)) + minor_subdivide = minor_subdivide.scaled(Vector2(1.0 / minor_subdivision, 1.0 / minor_subdivision)) + + first = (transform * ruler_transform * major_subdivide * minor_subdivide).affine_inverse().xform(starting_pos) + last = (transform * ruler_transform * major_subdivide * minor_subdivide).affine_inverse().xform(rect_size - starting_pos) + + for i in range(ceil(first.x), last.x): + var position : Vector2 = (transform * ruler_transform * major_subdivide * minor_subdivide).xform(Vector2(i, 0)) + if i % (major_subdivision * minor_subdivision) == 0: + draw_line(Vector2(position.x + RULER_WIDTH, 0), Vector2(position.x + RULER_WIDTH, RULER_WIDTH), Color.white) + var val = (ruler_transform * major_subdivide * minor_subdivide).xform(Vector2(i, 0)).x / 100 + val = stepify(val, 0.01) + draw_string(font, Vector2(position.x + RULER_WIDTH + 2, font.get_height() - 6), str(val)) + else: + if i % minor_subdivision == 0: + draw_line(Vector2(position.x + RULER_WIDTH, RULER_WIDTH * 0.33), Vector2(position.x + RULER_WIDTH, RULER_WIDTH), Color.white) + else: + draw_line(Vector2(position.x + RULER_WIDTH, RULER_WIDTH * 0.66), Vector2(position.x + RULER_WIDTH, RULER_WIDTH), Color.white) \ No newline at end of file diff --git a/Scripts/VerticalRuler.gd b/Scripts/VerticalRuler.gd index 1cc924eb2..cc2f5b60b 100644 --- a/Scripts/VerticalRuler.gd +++ b/Scripts/VerticalRuler.gd @@ -13,6 +13,7 @@ var last : Vector2 func _process(delta) -> void: update() +#Code taken and modified from Godot's source code func _draw() -> void: var transform := Transform2D() var ruler_transform := Transform2D() @@ -38,15 +39,15 @@ func _draw() -> void: major_subdivide = major_subdivide.scaled(Vector2(1.0 / major_subdivision, 1.0 / major_subdivision)) minor_subdivide = minor_subdivide.scaled(Vector2(1.0 / minor_subdivision, 1.0 / minor_subdivision)) - first = (transform * ruler_transform * major_subdivide * minor_subdivide).affine_inverse().xform(Vector2.ZERO); - last = (transform * ruler_transform * major_subdivide * minor_subdivide).affine_inverse().xform(Global.main_viewport.rect_size); + first = (transform * ruler_transform * major_subdivide * minor_subdivide).affine_inverse().xform(Vector2.ZERO) + last = (transform * ruler_transform * major_subdivide * minor_subdivide).affine_inverse().xform(Global.main_viewport.rect_size) for i in range(ceil(first.y), last.y): var position : Vector2 = (transform * ruler_transform * major_subdivide * minor_subdivide).xform(Vector2(0, i)) if i % (major_subdivision * minor_subdivision) == 0: draw_line(Vector2(0, position.y), Vector2(RULER_WIDTH, position.y), Color.white) - var val = (ruler_transform * major_subdivide * minor_subdivide).xform(Vector2(i, 0)).x - draw_string(font, Vector2(0, position.y), str(int(val))) + var val = (ruler_transform * major_subdivide * minor_subdivide).xform(Vector2(0, i)).y + draw_string(font, Vector2(0, position.y - 2), str(int(val))) else: if i % minor_subdivision == 0: draw_line(Vector2(RULER_WIDTH * 0.33, position.y), Vector2(RULER_WIDTH, position.y), Color.white)