mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-20 12:33:14 +00:00
Added guides
- Added horizontal & vertical guides which can be dragged from their respective rulers - Fixed bug when opening and importing files
This commit is contained in:
parent
8b5ee21d01
commit
224316256c
10 changed files with 186 additions and 98 deletions
157
Main.tscn
157
Main.tscn
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=40 format=2]
|
||||
[gd_scene load_steps=39 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,46 +6,41 @@
|
|||
[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://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]
|
||||
[ext_resource path="res://Styles/RulerStyle.tres" type="StyleBox" id=7]
|
||||
[ext_resource path="res://Scripts/HorizontalRuler.gd" type="Script" id=8]
|
||||
[ext_resource path="res://Scripts/VerticalRuler.gd" type="Script" id=9]
|
||||
[ext_resource path="res://Prefabs/Canvas.tscn" type="PackedScene" id=10]
|
||||
[ext_resource path="res://Scripts/CameraMovement.gd" type="Script" id=11]
|
||||
[ext_resource path="res://Scripts/SelectionRectangle.gd" type="Script" id=12]
|
||||
[ext_resource path="res://Scripts/SecondViewport.gd" type="Script" id=13]
|
||||
[ext_resource path="res://Assets/Graphics/Timeline/Go_To_First_Frame.png" type="Texture" id=14]
|
||||
[ext_resource path="res://Assets/Graphics/Timeline/Previous_Frame.png" type="Texture" id=15]
|
||||
[ext_resource path="res://Assets/Graphics/Timeline/Play Backwards.png" type="Texture" id=16]
|
||||
[ext_resource path="res://Assets/Graphics/Timeline/Pause.png" type="Texture" id=17]
|
||||
[ext_resource path="res://Assets/Graphics/Timeline/Play.png" type="Texture" id=18]
|
||||
[ext_resource path="res://Assets/Graphics/Timeline/Next_Frame.png" type="Texture" id=19]
|
||||
[ext_resource path="res://Assets/Graphics/Timeline/Go_To_Last_Frame.png" type="Texture" id=20]
|
||||
[ext_resource path="res://Assets/Graphics/Timeline/Loop_None.png" type="Texture" id=21]
|
||||
[ext_resource path="res://Scripts/TimelineSeconds.gd" type="Script" id=22]
|
||||
[ext_resource path="res://Assets/Graphics/Timeline/New_Frame.png" type="Texture" id=23]
|
||||
[ext_resource path="res://Assets/Graphics/Layers/new_layer.png" type="Texture" id=24]
|
||||
[ext_resource path="res://Assets/Graphics/Layers/delete_layer.png" type="Texture" id=25]
|
||||
[ext_resource path="res://Assets/Graphics/Layers/delete_layer_disabled.png" type="Texture" id=26]
|
||||
[ext_resource path="res://Assets/Graphics/Layers/move_up.png" type="Texture" id=27]
|
||||
[ext_resource path="res://Assets/Graphics/Layers/move_up_disabled.png" type="Texture" id=28]
|
||||
[ext_resource path="res://Assets/Graphics/Layers/move_down.png" type="Texture" id=29]
|
||||
[ext_resource path="res://Assets/Graphics/Layers/move_down_disabled.png" type="Texture" id=30]
|
||||
[ext_resource path="res://Assets/Graphics/Layers/clone_layer.png" type="Texture" id=31]
|
||||
[ext_resource path="res://Assets/Graphics/Layers/merge_down.png" type="Texture" id=32]
|
||||
[ext_resource path="res://Assets/Graphics/Layers/merge_down_disabled.png" type="Texture" id=33]
|
||||
[ext_resource path="res://Prefabs/BrushButton.tscn" type="PackedScene" id=34]
|
||||
[ext_resource path="res://Assets/Graphics/left.png" type="Texture" id=35]
|
||||
[ext_resource path="res://Assets/Graphics/right.png" type="Texture" id=36]
|
||||
[ext_resource path="res://Scripts/AboutDialog.gd" type="Script" id=37]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
bg_color = Color( 0.223529, 0.223529, 0.243137, 1 )
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=2]
|
||||
bg_color = Color( 0.0862745, 0.0862745, 0.0862745, 1 )
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=3]
|
||||
bg_color = Color( 0.0862745, 0.0862745, 0.0862745, 1 )
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
@ -62,7 +57,6 @@ 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 )
|
||||
|
@ -482,7 +476,6 @@ 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
|
||||
|
@ -502,12 +495,18 @@ size_flags_horizontal = 3
|
|||
size_flags_vertical = 3
|
||||
custom_constants/separation = 0
|
||||
|
||||
[node name="HorizontalRuler" type="Panel" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers"]
|
||||
[node name="HorizontalRuler" type="Button" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers"]
|
||||
margin_right = 686.0
|
||||
margin_bottom = 16.0
|
||||
rect_min_size = Vector2( 0, 16 )
|
||||
custom_styles/panel = SubResource( 2 )
|
||||
script = ExtResource( 7 )
|
||||
focus_mode = 0
|
||||
custom_styles/hover = ExtResource( 7 )
|
||||
custom_styles/pressed = ExtResource( 7 )
|
||||
custom_styles/focus = ExtResource( 7 )
|
||||
custom_styles/normal = ExtResource( 7 )
|
||||
action_mode = 0
|
||||
enabled_focus_mode = 0
|
||||
script = ExtResource( 8 )
|
||||
|
||||
[node name="ViewportandVerticalRuler" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers"]
|
||||
margin_top = 16.0
|
||||
|
@ -516,14 +515,20 @@ margin_bottom = 478.0
|
|||
size_flags_vertical = 3
|
||||
custom_constants/separation = 0
|
||||
|
||||
[node name="VerticalRuler" type="Panel" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers/ViewportandVerticalRuler"]
|
||||
[node name="VerticalRuler" type="Button" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers/ViewportandVerticalRuler"]
|
||||
margin_right = 16.0
|
||||
margin_bottom = 462.0
|
||||
rect_min_size = Vector2( 16, 0 )
|
||||
focus_mode = 0
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 3
|
||||
custom_styles/panel = SubResource( 3 )
|
||||
script = ExtResource( 8 )
|
||||
custom_styles/hover = ExtResource( 7 )
|
||||
custom_styles/pressed = ExtResource( 7 )
|
||||
custom_styles/focus = ExtResource( 7 )
|
||||
custom_styles/normal = ExtResource( 7 )
|
||||
action_mode = 0
|
||||
enabled_focus_mode = 0
|
||||
script = ExtResource( 9 )
|
||||
|
||||
[node name="ViewportContainer" type="ViewportContainer" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers/ViewportandVerticalRuler"]
|
||||
margin_left = 16.0
|
||||
|
@ -538,18 +543,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( 9 )]
|
||||
[node name="Canvas" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers/ViewportandVerticalRuler/ViewportContainer/Viewport" instance=ExtResource( 10 )]
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers/ViewportandVerticalRuler/ViewportContainer/Viewport"]
|
||||
current = true
|
||||
zoom = Vector2( 0.15, 0.15 )
|
||||
script = ExtResource( 10 )
|
||||
script = ExtResource( 11 )
|
||||
|
||||
[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( 11 )
|
||||
script = ExtResource( 12 )
|
||||
|
||||
[node name="ViewportSeparator" type="VSeparator" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer"]
|
||||
visible = false
|
||||
|
@ -571,12 +576,12 @@ stretch = true
|
|||
size = Vector2( 315, 464 )
|
||||
handle_input_locally = false
|
||||
render_target_update_mode = 0
|
||||
script = ExtResource( 12 )
|
||||
script = ExtResource( 13 )
|
||||
|
||||
[node name="Camera2D2" type="Camera2D" parent="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportContainer2/Viewport"]
|
||||
current = true
|
||||
zoom = Vector2( 0.15, 0.15 )
|
||||
script = ExtResource( 10 )
|
||||
script = ExtResource( 11 )
|
||||
|
||||
[node name="AnimationTimeline" type="Panel" parent="MenuAndUI/UI/CanvasAndTimeline"]
|
||||
editor/display_folded = true
|
||||
|
@ -634,14 +639,14 @@ size_flags_horizontal = 0
|
|||
margin_right = 20.0
|
||||
margin_bottom = 20.0
|
||||
mouse_default_cursor_shape = 2
|
||||
texture_normal = ExtResource( 13 )
|
||||
texture_normal = ExtResource( 14 )
|
||||
|
||||
[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( 14 )
|
||||
texture_normal = ExtResource( 15 )
|
||||
|
||||
[node name="PlayBackwards" type="TextureButton" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/AnimationButtons/PlaybackButtons"]
|
||||
margin_left = 48.0
|
||||
|
@ -650,8 +655,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( 15 )
|
||||
texture_pressed = ExtResource( 16 )
|
||||
texture_normal = ExtResource( 16 )
|
||||
texture_pressed = ExtResource( 17 )
|
||||
|
||||
[node name="PlayForward" type="TextureButton" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/AnimationButtons/PlaybackButtons"]
|
||||
margin_left = 72.0
|
||||
|
@ -661,22 +666,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( 17 )
|
||||
texture_pressed = ExtResource( 16 )
|
||||
texture_normal = ExtResource( 18 )
|
||||
texture_pressed = ExtResource( 17 )
|
||||
|
||||
[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( 18 )
|
||||
texture_normal = ExtResource( 19 )
|
||||
|
||||
[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( 19 )
|
||||
texture_normal = ExtResource( 20 )
|
||||
|
||||
[node name="LoopButtons" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/AnimationButtons"]
|
||||
anchor_left = 1.0
|
||||
|
@ -706,7 +711,7 @@ 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( 20 )
|
||||
texture_normal = ExtResource( 21 )
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer"]
|
||||
margin_top = 28.0
|
||||
|
@ -718,7 +723,7 @@ margin_top = 36.0
|
|||
margin_right = 525.0
|
||||
margin_bottom = 52.0
|
||||
rect_min_size = Vector2( 0, 16 )
|
||||
script = ExtResource( 21 )
|
||||
script = ExtResource( 22 )
|
||||
|
||||
[node name="HSeparator2" type="HSeparator" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer"]
|
||||
margin_top = 56.0
|
||||
|
@ -736,7 +741,7 @@ margin_bottom = 36.0
|
|||
hint_tooltip = "Add a new frame"
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 0
|
||||
texture_normal = ExtResource( 22 )
|
||||
texture_normal = ExtResource( 23 )
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/FrameAndButtonContainer"]
|
||||
margin_left = 40.0
|
||||
|
@ -836,7 +841,7 @@ margin_right = 32.0
|
|||
margin_bottom = 32.0
|
||||
hint_tooltip = "Create a new layer"
|
||||
mouse_default_cursor_shape = 2
|
||||
texture_normal = ExtResource( 23 )
|
||||
texture_normal = ExtResource( 24 )
|
||||
|
||||
[node name="RemoveLayerButton" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/CenterContainer/LayerButtons"]
|
||||
margin_left = 36.0
|
||||
|
@ -845,8 +850,8 @@ margin_bottom = 32.0
|
|||
hint_tooltip = "Remove current layer"
|
||||
mouse_default_cursor_shape = 8
|
||||
disabled = true
|
||||
texture_normal = ExtResource( 24 )
|
||||
texture_disabled = ExtResource( 25 )
|
||||
texture_normal = ExtResource( 25 )
|
||||
texture_disabled = ExtResource( 26 )
|
||||
|
||||
[node name="MoveUpLayer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/CenterContainer/LayerButtons"]
|
||||
margin_left = 72.0
|
||||
|
@ -855,8 +860,8 @@ margin_bottom = 32.0
|
|||
hint_tooltip = "Move up the current layer"
|
||||
mouse_default_cursor_shape = 8
|
||||
disabled = true
|
||||
texture_normal = ExtResource( 26 )
|
||||
texture_disabled = ExtResource( 27 )
|
||||
texture_normal = ExtResource( 27 )
|
||||
texture_disabled = ExtResource( 28 )
|
||||
|
||||
[node name="MoveDownLayer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/CenterContainer/LayerButtons"]
|
||||
margin_left = 108.0
|
||||
|
@ -865,8 +870,8 @@ margin_bottom = 32.0
|
|||
hint_tooltip = "Move down the current layer"
|
||||
mouse_default_cursor_shape = 8
|
||||
disabled = true
|
||||
texture_normal = ExtResource( 28 )
|
||||
texture_disabled = ExtResource( 29 )
|
||||
texture_normal = ExtResource( 29 )
|
||||
texture_disabled = ExtResource( 30 )
|
||||
|
||||
[node name="CloneLayer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/CenterContainer/LayerButtons"]
|
||||
margin_left = 144.0
|
||||
|
@ -874,7 +879,7 @@ margin_right = 176.0
|
|||
margin_bottom = 32.0
|
||||
hint_tooltip = "Clone current layer"
|
||||
mouse_default_cursor_shape = 2
|
||||
texture_normal = ExtResource( 30 )
|
||||
texture_normal = ExtResource( 31 )
|
||||
|
||||
[node name="MergeDownLayer" type="TextureButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/CenterContainer/LayerButtons"]
|
||||
margin_left = 180.0
|
||||
|
@ -883,8 +888,8 @@ margin_bottom = 32.0
|
|||
hint_tooltip = "Merge down current layer"
|
||||
mouse_default_cursor_shape = 8
|
||||
disabled = true
|
||||
texture_normal = ExtResource( 31 )
|
||||
texture_disabled = ExtResource( 32 )
|
||||
texture_normal = ExtResource( 32 )
|
||||
texture_disabled = ExtResource( 33 )
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc"]
|
||||
editor/display_folded = true
|
||||
|
@ -927,18 +932,18 @@ margin_right = 36.0
|
|||
margin_bottom = 36.0
|
||||
columns = 5
|
||||
|
||||
[node name="PixelBrushButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/TabContainer/File/FileBrushContainer" instance=ExtResource( 33 )]
|
||||
[node name="PixelBrushButton" parent="MenuAndUI/UI/LayerPanel/LayersAndMisc/TabContainer/File/FileBrushContainer" instance=ExtResource( 34 )]
|
||||
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 )
|
||||
texture = ExtResource( 35 )
|
||||
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 )
|
||||
texture = ExtResource( 36 )
|
||||
centered = false
|
||||
offset = Vector2( 28, 0 )
|
||||
|
||||
|
@ -1183,7 +1188,7 @@ editor/display_folded = true
|
|||
margin_right = 284.0
|
||||
margin_bottom = 186.0
|
||||
window_title = "About Pixelorama"
|
||||
script = ExtResource( 36 )
|
||||
script = ExtResource( 37 )
|
||||
|
||||
[node name="AboutUI" type="VBoxContainer" parent="AboutDialog"]
|
||||
margin_left = 8.0
|
||||
|
@ -1259,6 +1264,8 @@ align = 1
|
|||
[connection signal="value_changed" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions/InterpolateColor/RightInterpolateFactor" to="." method="_on_RightInterpolateFactor_value_changed"]
|
||||
[connection signal="toggled" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions/RightHorizontalMirroring" to="." method="_on_RightHorizontalMirroring_toggled"]
|
||||
[connection signal="toggled" from="MenuAndUI/UI/ToolPanel/Tools/ToolOptions/RightToolOptions/RightVerticalMirroring" to="." method="_on_RightVerticalMirroring_toggled"]
|
||||
[connection signal="pressed" from="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HorizontalRuler" to="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers/HorizontalRuler" method="_on_HorizontalRuler_pressed"]
|
||||
[connection signal="pressed" from="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers/ViewportandVerticalRuler/VerticalRuler" to="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers/ViewportandVerticalRuler/VerticalRuler" method="_on_VerticalRuler_pressed"]
|
||||
[connection signal="mouse_entered" from="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers/ViewportandVerticalRuler/ViewportContainer" to="." method="_on_ViewportContainer_mouse_entered"]
|
||||
[connection signal="mouse_exited" from="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportAndRulers/ViewportandVerticalRuler/ViewportContainer" to="." method="_on_ViewportContainer_mouse_exited"]
|
||||
[connection signal="mouse_entered" from="MenuAndUI/UI/CanvasAndTimeline/HViewportContainer/ViewportContainer2" to="." method="_on_ViewportContainer_mouse_entered"]
|
||||
|
|
|
@ -10,6 +10,7 @@ var frame := 0 setget frame_changed
|
|||
var frame_button : VBoxContainer
|
||||
var frame_texture_rect : TextureRect
|
||||
|
||||
var current_pixel := Vector2.ZERO #pretty much same as mouse_pos, but can be accessed externally
|
||||
var previous_mouse_pos := Vector2.ZERO
|
||||
var previous_action := "None"
|
||||
var mouse_inside_canvas := false #used for undo
|
||||
|
@ -75,7 +76,8 @@ func camera_zoom() -> void:
|
|||
func _process(delta) -> void:
|
||||
sprite_changed_this_frame = false
|
||||
update()
|
||||
var mouse_pos := get_local_mouse_position() - location
|
||||
current_pixel = get_local_mouse_position() - location
|
||||
var mouse_pos := current_pixel
|
||||
var mouse_pos_floored := mouse_pos.floor()
|
||||
var mouse_pos_ceiled := mouse_pos.ceil()
|
||||
var mouse_in_canvas := point_in_rectangle(mouse_pos, location, location + size)
|
||||
|
|
|
@ -34,6 +34,7 @@ var right_square_indicator_visible := false
|
|||
var camera : Camera2D
|
||||
var camera2 : Camera2D
|
||||
var selection_rectangle : Polygon2D
|
||||
var vertical_ruler : BaseButton
|
||||
# warning-ignore:unused_class_variable
|
||||
var selected_pixels := []
|
||||
var image_clipboard : Image
|
||||
|
@ -119,8 +120,8 @@ func _ready() -> void:
|
|||
split_screen_button = find_node_by_name(root, "SplitScreenButton")
|
||||
camera = find_node_by_name(canvas_parent, "Camera2D")
|
||||
camera2 = find_node_by_name(root, "Camera2D2")
|
||||
|
||||
selection_rectangle = find_node_by_name(root, "SelectionRectangle")
|
||||
vertical_ruler = find_node_by_name(root, "VerticalRuler")
|
||||
image_clipboard = Image.new()
|
||||
|
||||
file_menu = find_node_by_name(root, "FileMenu")
|
||||
|
|
62
Scripts/Guides.gd
Normal file
62
Scripts/Guides.gd
Normal file
|
@ -0,0 +1,62 @@
|
|||
extends Line2D
|
||||
class_name Guide
|
||||
|
||||
enum TYPE {HORIZONTAL, VERTICAL}
|
||||
|
||||
var font := preload("res://Assets/Fonts/Roboto-Regular.tres")
|
||||
var has_focus := true
|
||||
var mouse_pos := Vector2.ZERO
|
||||
var type = TYPE.HORIZONTAL
|
||||
|
||||
func _ready() -> void:
|
||||
width = 0.1
|
||||
|
||||
# warning-ignore:unused_argument
|
||||
func _process(delta) -> void:
|
||||
width = Global.camera.zoom.x
|
||||
mouse_pos = get_local_mouse_position()
|
||||
var point0 := points[0]
|
||||
var point1 := points[1]
|
||||
if type == TYPE.HORIZONTAL:
|
||||
point0.y -= width * 3
|
||||
point1.y += width * 3
|
||||
else:
|
||||
point0.x -= width * 3
|
||||
point1.x += width * 3
|
||||
if point_in_rectangle(mouse_pos, point0, point1) && Input.is_action_just_pressed("left_mouse"):
|
||||
if !point_in_rectangle(Global.canvas.current_pixel, Global.canvas.location, Global.canvas.location + Global.canvas.size):
|
||||
has_focus = true
|
||||
Global.has_focus = false
|
||||
update()
|
||||
if has_focus && Input.is_action_pressed("left_mouse"):
|
||||
if type == TYPE.HORIZONTAL:
|
||||
points[0].y = round(mouse_pos.y)
|
||||
points[1].y = round(mouse_pos.y)
|
||||
else:
|
||||
points[0].x = round(mouse_pos.x)
|
||||
points[1].x = round(mouse_pos.x)
|
||||
if Input.is_action_just_released("left_mouse"):
|
||||
if has_focus:
|
||||
Global.has_focus = true
|
||||
has_focus = false
|
||||
update()
|
||||
if type == TYPE.HORIZONTAL:
|
||||
if points[0].y < 0 || points[0].y > Global.canvas.size.y:
|
||||
queue_free()
|
||||
else:
|
||||
if points[0].x < 0 || points[0].x > Global.canvas.size.x:
|
||||
queue_free()
|
||||
|
||||
func _draw() -> void:
|
||||
if has_focus:
|
||||
var viewport_size := Global.main_viewport.rect_size
|
||||
var zoom := Global.camera.zoom
|
||||
if type == TYPE.HORIZONTAL:
|
||||
draw_set_transform(Vector2(Global.camera.offset.x - (viewport_size.x / 2) * zoom.x, points[0].y + font.get_height() * zoom.x * 2), rotation, zoom * 2)
|
||||
draw_string(font, Vector2.ZERO, "%spx" % str(round(mouse_pos.y)))
|
||||
else:
|
||||
draw_set_transform(Vector2(points[0].x + font.get_height() * zoom.y, Global.camera.offset.y - (viewport_size.y / 2.25) * zoom.y), rotation, zoom * 2)
|
||||
draw_string(font, Vector2.ZERO, "%spx" % str(round(mouse_pos.x)))
|
||||
|
||||
func point_in_rectangle(p : Vector2, coord1 : Vector2, coord2 : Vector2) -> bool:
|
||||
return p.x > coord1.x && p.y > coord1.y && p.x < coord2.x && p.y < coord2.y
|
|
@ -1,4 +1,4 @@
|
|||
extends Panel
|
||||
extends Button
|
||||
|
||||
const RULER_WIDTH := 16
|
||||
|
||||
|
@ -22,7 +22,7 @@ func _draw() -> void:
|
|||
var zoom := 1 / Global.camera.zoom.x
|
||||
transform.x = Vector2(zoom, zoom)
|
||||
|
||||
transform.origin = Global.main_viewport.rect_size / 2 + (Global.camera.offset) * -zoom
|
||||
transform.origin = Global.main_viewport.rect_size / 2 + Global.camera.offset * -zoom
|
||||
|
||||
var basic_rule := 100.0
|
||||
var i := 0
|
||||
|
@ -53,3 +53,15 @@ func _draw() -> void:
|
|||
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)
|
||||
|
||||
func _on_HorizontalRuler_pressed() -> void:
|
||||
var mouse_pos := get_local_mouse_position()
|
||||
if mouse_pos.x < RULER_WIDTH: #For double guides
|
||||
Global.vertical_ruler._on_VerticalRuler_pressed()
|
||||
var line_2d := Guide.new()
|
||||
line_2d.type = line_2d.TYPE.HORIZONTAL
|
||||
line_2d.default_color = Color.purple
|
||||
line_2d.add_point(Vector2(-99999, Global.canvas.current_pixel.y))
|
||||
line_2d.add_point(Vector2(99999, Global.canvas.current_pixel.y))
|
||||
Global.canvas.add_child(line_2d)
|
||||
Global.has_focus = false
|
||||
|
|
|
@ -279,8 +279,6 @@ func _on_CreateNewImage_confirmed() -> void:
|
|||
Global.canvas.layers[0][0].fill(fill_color)
|
||||
Global.canvas.layers[0][0].lock()
|
||||
Global.canvas.update_texture(0)
|
||||
Global.remove_frame_button.disabled = true
|
||||
Global.remove_frame_button.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN
|
||||
Global.undo_redo.clear_history(false)
|
||||
|
||||
func _on_OpenSprite_file_selected(path) -> void:
|
||||
|
@ -354,15 +352,8 @@ func _on_OpenSprite_file_selected(path) -> void:
|
|||
Global.create_brush_button(image)
|
||||
brush_line = file.get_line()
|
||||
|
||||
Global.undo_redo.clear_history(false)
|
||||
file.close()
|
||||
|
||||
if frame > 1:
|
||||
Global.remove_frame_button.disabled = false
|
||||
Global.remove_frame_button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
|
||||
else:
|
||||
Global.remove_frame_button.disabled = true
|
||||
Global.remove_frame_button.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN
|
||||
Global.undo_redo.clear_history(false)
|
||||
|
||||
func _on_SaveSprite_file_selected(path) -> void:
|
||||
current_save_path = path
|
||||
|
@ -445,12 +436,6 @@ func _on_ImportSprites_files_selected(paths) -> void:
|
|||
Global.canvas = Global.canvases[Global.canvases.size() - 1]
|
||||
Global.canvas.visible = true
|
||||
biggest_canvas.camera_zoom()
|
||||
if i > 1:
|
||||
Global.remove_frame_button.disabled = false
|
||||
Global.remove_frame_button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
|
||||
else:
|
||||
Global.remove_frame_button.disabled = true
|
||||
Global.remove_frame_button.mouse_default_cursor_shape = Control.CURSOR_FORBIDDEN
|
||||
|
||||
Global.undo_redo.clear_history(false)
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ func _draw() -> void:
|
|||
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))
|
||||
draw_string(font, Vector2(position.x + RULER_WIDTH + 2, font.get_height() - 6), "%ss" % 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)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
extends Panel
|
||||
extends Button
|
||||
|
||||
const RULER_WIDTH := 16
|
||||
|
||||
|
@ -22,7 +22,7 @@ func _draw() -> void:
|
|||
var zoom := 1 / Global.camera.zoom.x
|
||||
transform.y = Vector2(zoom, zoom)
|
||||
|
||||
transform.origin = Global.main_viewport.rect_size / 2 + (Global.camera.offset) * -zoom
|
||||
transform.origin = Global.main_viewport.rect_size / 2 + Global.camera.offset * -zoom
|
||||
|
||||
var basic_rule := 100.0
|
||||
var i := 0
|
||||
|
@ -53,3 +53,12 @@ func _draw() -> void:
|
|||
draw_line(Vector2(RULER_WIDTH * 0.33, position.y), Vector2(RULER_WIDTH, position.y), Color.white)
|
||||
else:
|
||||
draw_line(Vector2(RULER_WIDTH * 0.66, position.y), Vector2(RULER_WIDTH, position.y), Color.white)
|
||||
|
||||
func _on_VerticalRuler_pressed() -> void:
|
||||
var line_2d := Guide.new()
|
||||
line_2d.type = line_2d.TYPE.VERTICAL
|
||||
line_2d.default_color = Color.purple
|
||||
line_2d.add_point(Vector2(Global.canvas.current_pixel.x, -99999))
|
||||
line_2d.add_point(Vector2(Global.canvas.current_pixel.x, 99999))
|
||||
Global.canvas.add_child(line_2d)
|
||||
Global.has_focus = false
|
||||
|
|
4
Styles/RulerStyle.tres
Normal file
4
Styles/RulerStyle.tres
Normal file
|
@ -0,0 +1,4 @@
|
|||
[gd_resource type="StyleBoxFlat" format=2]
|
||||
|
||||
[resource]
|
||||
bg_color = Color( 0.0862745, 0.0862745, 0.0862745, 1 )
|
|
@ -14,6 +14,11 @@ _global_script_classes=[ {
|
|||
"language": "GDScript",
|
||||
"path": "res://Scripts/Canvas.gd"
|
||||
}, {
|
||||
"base": "Line2D",
|
||||
"class": "Guide",
|
||||
"language": "GDScript",
|
||||
"path": "res://Scripts/Guides.gd"
|
||||
}, {
|
||||
"base": "Button",
|
||||
"class": "LayerContainer",
|
||||
"language": "GDScript",
|
||||
|
@ -21,6 +26,7 @@ _global_script_classes=[ {
|
|||
} ]
|
||||
_global_script_class_icons={
|
||||
"Canvas": "",
|
||||
"Guide": "",
|
||||
"LayerContainer": ""
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue