mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
Overall code re-organizing & layer renaming changes
- When renaming a layer, the line edit grabs the focus. If enter is pressed, it gets invisible. Also fixed positioning and size - Re-organized the variables in Global, now they are less messy and randomly placed - Layer, frame & brush textures stretch mode has been changed to Keep Aspect Centered
This commit is contained in:
parent
da61234b13
commit
5613c3d7ef
|
@ -905,6 +905,7 @@ margin_bottom = 138.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
[node name="AnimationButtons" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer"]
|
[node name="AnimationButtons" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer"]
|
||||||
|
editor/display_folded = true
|
||||||
margin_right = 562.0
|
margin_right = 562.0
|
||||||
margin_bottom = 25.0
|
margin_bottom = 25.0
|
||||||
rect_min_size = Vector2( 0, 24 )
|
rect_min_size = Vector2( 0, 24 )
|
||||||
|
@ -972,6 +973,7 @@ mouse_default_cursor_shape = 2
|
||||||
texture_normal = ExtResource( 25 )
|
texture_normal = ExtResource( 25 )
|
||||||
|
|
||||||
[node name="LoopButtons" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/AnimationButtons"]
|
[node name="LoopButtons" type="HBoxContainer" parent="MenuAndUI/UI/CanvasAndTimeline/AnimationTimeline/AnimationContainer/TimelineContainer/AnimationButtons"]
|
||||||
|
editor/display_folded = true
|
||||||
margin_left = 476.0
|
margin_left = 476.0
|
||||||
margin_right = 562.0
|
margin_right = 562.0
|
||||||
margin_bottom = 25.0
|
margin_bottom = 25.0
|
||||||
|
|
|
@ -22,6 +22,7 @@ margin_bottom = 32.0
|
||||||
rect_min_size = Vector2( 3, 0 )
|
rect_min_size = Vector2( 3, 0 )
|
||||||
button_mask = 3
|
button_mask = 3
|
||||||
texture_normal = ExtResource( 1 )
|
texture_normal = ExtResource( 1 )
|
||||||
|
stretch_mode = 5
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
[node name="BrushTexture" type="TextureRect" parent="."]
|
[node name="BrushTexture" type="TextureRect" parent="."]
|
||||||
|
|
|
@ -26,6 +26,7 @@ rect_min_size = Vector2( 32, 32 )
|
||||||
size_flags_horizontal = 0
|
size_flags_horizontal = 0
|
||||||
size_flags_vertical = 0
|
size_flags_vertical = 0
|
||||||
expand = true
|
expand = true
|
||||||
|
stretch_mode = 6
|
||||||
|
|
||||||
[node name="PopupMenu" type="PopupMenu" parent="FrameButton"]
|
[node name="PopupMenu" type="PopupMenu" parent="FrameButton"]
|
||||||
margin_right = 20.0
|
margin_right = 20.0
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
[ext_resource path="res://Scripts/LayerContainer.gd" type="Script" id=1]
|
[ext_resource path="res://Scripts/LayerContainer.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://Assets/Graphics/Layers/layer_visible.png" type="Texture" id=2]
|
[ext_resource path="res://Assets/Graphics/Layers/layer_visible.png" type="Texture" id=2]
|
||||||
|
|
||||||
|
|
||||||
[node name="LayerContainer" type="Button"]
|
[node name="LayerContainer" type="Button"]
|
||||||
margin_left = -0.540344
|
margin_left = -0.540344
|
||||||
margin_right = 11.4597
|
margin_right = 11.4597
|
||||||
|
@ -11,19 +10,25 @@ margin_bottom = 42.0
|
||||||
rect_min_size = Vector2( 160, 42 )
|
rect_min_size = Vector2( 160, 42 )
|
||||||
toggle_mode = true
|
toggle_mode = true
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_horizontal_guides_": [ ]
|
||||||
|
}
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||||
|
anchor_left = 0.5
|
||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
anchor_right = 1.0
|
anchor_right = 0.5
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.5
|
||||||
margin_left = 4.0
|
margin_left = -80.0
|
||||||
margin_top = -16.0
|
margin_top = -21.0
|
||||||
margin_bottom = 16.0
|
margin_right = 80.0
|
||||||
|
margin_bottom = 21.0
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
|
|
||||||
[node name="VisibilityButton" type="TextureButton" parent="HBoxContainer"]
|
[node name="VisibilityButton" type="TextureButton" parent="HBoxContainer"]
|
||||||
|
margin_top = 5.0
|
||||||
margin_right = 32.0
|
margin_right = 32.0
|
||||||
margin_bottom = 32.0
|
margin_bottom = 37.0
|
||||||
hint_tooltip = "Toggle layer's visibility"
|
hint_tooltip = "Toggle layer's visibility"
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
size_flags_horizontal = 0
|
size_flags_horizontal = 0
|
||||||
|
@ -32,24 +37,30 @@ texture_normal = ExtResource( 2 )
|
||||||
|
|
||||||
[node name="TextureRect" type="TextureRect" parent="HBoxContainer"]
|
[node name="TextureRect" type="TextureRect" parent="HBoxContainer"]
|
||||||
margin_left = 36.0
|
margin_left = 36.0
|
||||||
|
margin_top = 5.0
|
||||||
margin_right = 68.0
|
margin_right = 68.0
|
||||||
margin_bottom = 32.0
|
margin_bottom = 37.0
|
||||||
rect_min_size = Vector2( 32, 32 )
|
rect_min_size = Vector2( 32, 32 )
|
||||||
|
size_flags_vertical = 4
|
||||||
expand = true
|
expand = true
|
||||||
|
stretch_mode = 6
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="HBoxContainer"]
|
[node name="Label" type="Label" parent="HBoxContainer"]
|
||||||
margin_left = 72.0
|
margin_left = 72.0
|
||||||
margin_top = 9.0
|
margin_top = 14.0
|
||||||
margin_right = 118.0
|
margin_right = 118.0
|
||||||
margin_bottom = 23.0
|
margin_bottom = 28.0
|
||||||
text = "Layer 0"
|
text = "Layer 0"
|
||||||
align = 1
|
align = 1
|
||||||
|
|
||||||
[node name="LineEdit" type="LineEdit" parent="HBoxContainer"]
|
[node name="LineEdit" type="LineEdit" parent="HBoxContainer"]
|
||||||
visible = false
|
visible = false
|
||||||
margin_left = 110.0
|
margin_left = 122.0
|
||||||
margin_right = 168.0
|
margin_top = 5.0
|
||||||
margin_bottom = 32.0
|
margin_right = 202.0
|
||||||
|
margin_bottom = 37.0
|
||||||
|
rect_min_size = Vector2( 80, 32 )
|
||||||
|
size_flags_vertical = 4
|
||||||
text = "Layer 0"
|
text = "Layer 0"
|
||||||
editable = false
|
editable = false
|
||||||
caret_blink = true
|
caret_blink = true
|
||||||
|
|
|
@ -8,7 +8,7 @@ var drag := false
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
viewport_container = get_parent().get_parent()
|
viewport_container = get_parent().get_parent()
|
||||||
|
|
||||||
func _input(event) -> void:
|
func _input(event : InputEvent) -> void:
|
||||||
var mouse_pos := viewport_container.get_local_mouse_position()
|
var mouse_pos := viewport_container.get_local_mouse_position()
|
||||||
var viewport_size := viewport_container.rect_size
|
var viewport_size := viewport_container.rect_size
|
||||||
if event.is_action_pressed("camera_drag"):
|
if event.is_action_pressed("camera_drag"):
|
||||||
|
|
|
@ -75,7 +75,7 @@ func camera_zoom() -> void:
|
||||||
Global.camera_preview.offset = size / 2
|
Global.camera_preview.offset = size / 2
|
||||||
|
|
||||||
# warning-ignore:unused_argument
|
# warning-ignore:unused_argument
|
||||||
func _process(delta) -> void:
|
func _process(delta : float) -> void:
|
||||||
sprite_changed_this_frame = false
|
sprite_changed_this_frame = false
|
||||||
update()
|
update()
|
||||||
current_pixel = get_local_mouse_position() - location
|
current_pixel = get_local_mouse_position() - location
|
||||||
|
@ -438,10 +438,10 @@ func generate_layer_panels() -> void:
|
||||||
if !layers[i][2]:
|
if !layers[i][2]:
|
||||||
layers[i][2] = "Layer %s" % i
|
layers[i][2] = "Layer %s" % i
|
||||||
layer_container.i = i
|
layer_container.i = i
|
||||||
|
layer_container.get_child(0).get_child(1).texture = layers[i][1]
|
||||||
layer_container.get_child(0).get_child(2).text = layers[i][2]
|
layer_container.get_child(0).get_child(2).text = layers[i][2]
|
||||||
layer_container.get_child(0).get_child(3).text = layers[i][2]
|
layer_container.get_child(0).get_child(3).text = layers[i][2]
|
||||||
layers[i][3] = true #set visible
|
layers[i][3] = true #set visible
|
||||||
layer_container.get_child(0).get_child(1).texture = layers[i][1]
|
|
||||||
Global.vbox_layer_container.add_child(layer_container)
|
Global.vbox_layer_container.add_child(layer_container)
|
||||||
|
|
||||||
func pencil_and_eraser(mouse_pos : Vector2, color : Color, current_mouse_button : String, current_action := "None") -> void:
|
func pencil_and_eraser(mouse_pos : Vector2, color : Color, current_mouse_button : String, current_action := "None") -> void:
|
||||||
|
|
|
@ -2,17 +2,55 @@ extends Node
|
||||||
|
|
||||||
var undo_redo : UndoRedo
|
var undo_redo : UndoRedo
|
||||||
var undos := 0 #The number of times we added undo properties
|
var undos := 0 #The number of times we added undo properties
|
||||||
|
|
||||||
|
#Canvas related stuff
|
||||||
var current_frame := 0 setget frame_changed
|
var current_frame := 0 setget frame_changed
|
||||||
# warning-ignore:unused_class_variable
|
# warning-ignore:unused_class_variable
|
||||||
var can_draw := false
|
var can_draw := false
|
||||||
# warning-ignore:unused_class_variable
|
# warning-ignore:unused_class_variable
|
||||||
var has_focus := false
|
var has_focus := false
|
||||||
|
var canvases := []
|
||||||
# warning-ignore:unused_class_variable
|
# warning-ignore:unused_class_variable
|
||||||
var onion_skinning_past_rate := 0
|
var hidden_canvases := []
|
||||||
# warning-ignore:unused_class_variable
|
# warning-ignore:unused_class_variable
|
||||||
var onion_skinning_future_rate := 0
|
var selected_pixels := []
|
||||||
|
var image_clipboard : Image
|
||||||
|
|
||||||
|
#Tools & options
|
||||||
# warning-ignore:unused_class_variable
|
# warning-ignore:unused_class_variable
|
||||||
var onion_skinning_blue_red := false
|
var current_left_tool := "Pencil"
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var current_right_tool := "Eraser"
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var left_square_indicator_visible := true
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var right_square_indicator_visible := false
|
||||||
|
#0 for area of same color, 1 for all pixels of the same color
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var left_fill_area := 0
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var right_fill_area := 0
|
||||||
|
|
||||||
|
#0 for lighten, 1 for darken
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var left_ld := 0
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var right_ld := 0
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var left_ld_amount := 0.1
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var right_ld_amount := 0.1
|
||||||
|
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var left_horizontal_mirror := false
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var left_vertical_mirror := false
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var right_horizontal_mirror := false
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var right_vertical_mirror := false
|
||||||
|
|
||||||
|
#View menu options
|
||||||
# warning-ignore:unused_class_variable
|
# warning-ignore:unused_class_variable
|
||||||
var tile_mode := false
|
var tile_mode := false
|
||||||
# warning-ignore:unused_class_variable
|
# warning-ignore:unused_class_variable
|
||||||
|
@ -21,9 +59,43 @@ var draw_grid := false
|
||||||
var show_rulers := true
|
var show_rulers := true
|
||||||
# warning-ignore:unused_class_variable
|
# warning-ignore:unused_class_variable
|
||||||
var show_guides := true
|
var show_guides := true
|
||||||
var canvases := []
|
|
||||||
|
#Onion skinning options
|
||||||
# warning-ignore:unused_class_variable
|
# warning-ignore:unused_class_variable
|
||||||
var hidden_canvases := []
|
var onion_skinning_past_rate := 0
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var onion_skinning_future_rate := 0
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var onion_skinning_blue_red := false
|
||||||
|
|
||||||
|
#Brushes
|
||||||
|
enum BRUSH_TYPES {PIXEL, FILE, CUSTOM}
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var left_brush_size := 1
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var right_brush_size := 1
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var current_left_brush_type = BRUSH_TYPES.PIXEL
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var current_right_brush_type = BRUSH_TYPES.PIXEL
|
||||||
|
|
||||||
|
var brushes_from_files := 0
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var custom_brushes := []
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var custom_left_brush_index := -1
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var custom_right_brush_index := -1
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var custom_left_brush_image : Image
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var custom_right_brush_image : Image
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var custom_left_brush_texture := ImageTexture.new()
|
||||||
|
# warning-ignore:unused_class_variable
|
||||||
|
var custom_right_brush_texture := ImageTexture.new()
|
||||||
|
|
||||||
|
#Nodes
|
||||||
var control : Node
|
var control : Node
|
||||||
var canvas : Canvas
|
var canvas : Canvas
|
||||||
var canvas_parent : Node
|
var canvas_parent : Node
|
||||||
|
@ -31,24 +103,19 @@ var main_viewport : ViewportContainer
|
||||||
var second_viewport : ViewportContainer
|
var second_viewport : ViewportContainer
|
||||||
var viewport_separator : VSeparator
|
var viewport_separator : VSeparator
|
||||||
var split_screen_button : BaseButton
|
var split_screen_button : BaseButton
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var left_square_indicator_visible := true
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var right_square_indicator_visible := false
|
|
||||||
var camera : Camera2D
|
var camera : Camera2D
|
||||||
var camera2 : Camera2D
|
var camera2 : Camera2D
|
||||||
var camera_preview : Camera2D
|
var camera_preview : Camera2D
|
||||||
var selection_rectangle : Polygon2D
|
var selection_rectangle : Polygon2D
|
||||||
var horizontal_ruler : BaseButton
|
var horizontal_ruler : BaseButton
|
||||||
var vertical_ruler : BaseButton
|
var vertical_ruler : BaseButton
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var selected_pixels := []
|
|
||||||
var image_clipboard : Image
|
|
||||||
|
|
||||||
var file_menu : MenuButton
|
var file_menu : MenuButton
|
||||||
var edit_menu : MenuButton
|
var edit_menu : MenuButton
|
||||||
var view_menu : MenuButton
|
var view_menu : MenuButton
|
||||||
var help_menu : MenuButton
|
var help_menu : MenuButton
|
||||||
|
var cursor_position_label : Label
|
||||||
|
var zoom_level_label : Label
|
||||||
|
|
||||||
var left_color_picker : ColorPickerButton
|
var left_color_picker : ColorPickerButton
|
||||||
var right_color_picker : ColorPickerButton
|
var right_color_picker : ColorPickerButton
|
||||||
|
@ -62,6 +129,9 @@ var left_brush_type_button : BaseButton
|
||||||
var right_brush_type_button : BaseButton
|
var right_brush_type_button : BaseButton
|
||||||
var left_brush_type_label : Label
|
var left_brush_type_label : Label
|
||||||
var right_brush_type_label : Label
|
var right_brush_type_label : Label
|
||||||
|
var brushes_popup : Popup
|
||||||
|
var file_brush_container : GridContainer
|
||||||
|
var project_brush_container : GridContainer
|
||||||
|
|
||||||
var left_brush_size_container : Container
|
var left_brush_size_container : Container
|
||||||
var right_brush_size_container : Container
|
var right_brush_size_container : Container
|
||||||
|
@ -82,77 +152,24 @@ var right_ld_container : Container
|
||||||
var left_mirror_container : Container
|
var left_mirror_container : Container
|
||||||
var right_mirror_container : Container
|
var right_mirror_container : Container
|
||||||
|
|
||||||
|
var animation_timer : Timer
|
||||||
|
|
||||||
|
var current_frame_label : Label
|
||||||
var loop_animation_button : BaseButton
|
var loop_animation_button : BaseButton
|
||||||
var play_forward : BaseButton
|
var play_forward : BaseButton
|
||||||
var play_backwards : BaseButton
|
var play_backwards : BaseButton
|
||||||
var frame_container : HBoxContainer
|
var frame_container : HBoxContainer
|
||||||
|
|
||||||
var vbox_layer_container : VBoxContainer
|
var vbox_layer_container : VBoxContainer
|
||||||
var remove_layer_button : BaseButton
|
var remove_layer_button : BaseButton
|
||||||
var move_up_layer_button : BaseButton
|
var move_up_layer_button : BaseButton
|
||||||
var move_down_layer_button : BaseButton
|
var move_down_layer_button : BaseButton
|
||||||
var merge_down_layer_button : BaseButton
|
var merge_down_layer_button : BaseButton
|
||||||
var animation_timer : Timer
|
|
||||||
var cursor_position_label : Label
|
|
||||||
var zoom_level_label : Label
|
|
||||||
var current_frame_label : Label
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var current_left_tool := "Pencil"
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var current_right_tool := "Eraser"
|
|
||||||
|
|
||||||
#Brushes
|
|
||||||
enum BRUSH_TYPES {PIXEL, FILE, CUSTOM}
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var left_brush_size := 1
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var right_brush_size := 1
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var current_left_brush_type = BRUSH_TYPES.PIXEL
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var current_right_brush_type = BRUSH_TYPES.PIXEL
|
|
||||||
var brushes_popup : Popup
|
|
||||||
var file_brush_container : GridContainer
|
|
||||||
var project_brush_container : GridContainer
|
|
||||||
|
|
||||||
#0 for area of same color, 1 for all pixels of the same color
|
|
||||||
var left_fill_area := 0
|
|
||||||
var right_fill_area := 0
|
|
||||||
|
|
||||||
#0 for lighten, 1 for darken
|
|
||||||
var left_ld := 0
|
|
||||||
var right_ld := 0
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var left_ld_amount := 0.1
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var right_ld_amount := 0.1
|
|
||||||
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var left_horizontal_mirror := false
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var left_vertical_mirror := false
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var right_horizontal_mirror := false
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var right_vertical_mirror := false
|
|
||||||
|
|
||||||
var brushes_from_files := 0
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var custom_brushes := []
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var custom_left_brush_index := -1
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var custom_right_brush_index := -1
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var custom_left_brush_image : Image
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var custom_right_brush_image : Image
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var custom_left_brush_texture := ImageTexture.new()
|
|
||||||
# warning-ignore:unused_class_variable
|
|
||||||
var custom_right_brush_texture := ImageTexture.new()
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
undo_redo = UndoRedo.new()
|
undo_redo = UndoRedo.new()
|
||||||
|
image_clipboard = Image.new()
|
||||||
|
|
||||||
var root = get_tree().get_root()
|
var root = get_tree().get_root()
|
||||||
control = find_node_by_name(root, "Control")
|
control = find_node_by_name(root, "Control")
|
||||||
canvas = find_node_by_name(root, "Canvas")
|
canvas = find_node_by_name(root, "Canvas")
|
||||||
|
@ -168,12 +185,13 @@ func _ready() -> void:
|
||||||
selection_rectangle = find_node_by_name(root, "SelectionRectangle")
|
selection_rectangle = find_node_by_name(root, "SelectionRectangle")
|
||||||
horizontal_ruler = find_node_by_name(root, "HorizontalRuler")
|
horizontal_ruler = find_node_by_name(root, "HorizontalRuler")
|
||||||
vertical_ruler = find_node_by_name(root, "VerticalRuler")
|
vertical_ruler = find_node_by_name(root, "VerticalRuler")
|
||||||
image_clipboard = Image.new()
|
|
||||||
|
|
||||||
file_menu = find_node_by_name(root, "FileMenu")
|
file_menu = find_node_by_name(root, "FileMenu")
|
||||||
edit_menu = find_node_by_name(root, "EditMenu")
|
edit_menu = find_node_by_name(root, "EditMenu")
|
||||||
view_menu = find_node_by_name(root, "ViewMenu")
|
view_menu = find_node_by_name(root, "ViewMenu")
|
||||||
help_menu = find_node_by_name(root, "HelpMenu")
|
help_menu = find_node_by_name(root, "HelpMenu")
|
||||||
|
cursor_position_label = find_node_by_name(root, "CursorPosition")
|
||||||
|
zoom_level_label = find_node_by_name(root, "ZoomLevel")
|
||||||
|
|
||||||
left_tool_options_container = find_node_by_name(root, "LeftToolOptions")
|
left_tool_options_container = find_node_by_name(root, "LeftToolOptions")
|
||||||
right_tool_options_container = find_node_by_name(root, "RightToolOptions")
|
right_tool_options_container = find_node_by_name(root, "RightToolOptions")
|
||||||
|
@ -187,6 +205,9 @@ func _ready() -> void:
|
||||||
right_brush_type_button = find_node_by_name(right_brush_type_container, "RightBrushTypeButton")
|
right_brush_type_button = find_node_by_name(right_brush_type_container, "RightBrushTypeButton")
|
||||||
left_brush_type_label = find_node_by_name(left_brush_type_container, "LeftBrushTypeLabel")
|
left_brush_type_label = find_node_by_name(left_brush_type_container, "LeftBrushTypeLabel")
|
||||||
right_brush_type_label = find_node_by_name(right_brush_type_container, "RightBrushTypeLabel")
|
right_brush_type_label = find_node_by_name(right_brush_type_container, "RightBrushTypeLabel")
|
||||||
|
brushes_popup = find_node_by_name(root, "BrushesPopup")
|
||||||
|
file_brush_container = find_node_by_name(brushes_popup, "FileBrushContainer")
|
||||||
|
project_brush_container = find_node_by_name(brushes_popup, "ProjectBrushContainer")
|
||||||
|
|
||||||
left_brush_size_container = find_node_by_name(left_tool_options_container, "LeftBrushSize")
|
left_brush_size_container = find_node_by_name(left_tool_options_container, "LeftBrushSize")
|
||||||
right_brush_size_container = find_node_by_name(right_tool_options_container, "RightBrushSize")
|
right_brush_size_container = find_node_by_name(right_tool_options_container, "RightBrushSize")
|
||||||
|
@ -207,6 +228,9 @@ func _ready() -> void:
|
||||||
left_mirror_container = find_node_by_name(left_tool_options_container, "LeftMirroring")
|
left_mirror_container = find_node_by_name(left_tool_options_container, "LeftMirroring")
|
||||||
right_mirror_container = find_node_by_name(right_tool_options_container, "RightMirroring")
|
right_mirror_container = find_node_by_name(right_tool_options_container, "RightMirroring")
|
||||||
|
|
||||||
|
animation_timer = find_node_by_name(root, "AnimationTimer")
|
||||||
|
|
||||||
|
current_frame_label = find_node_by_name(root, "CurrentFrame")
|
||||||
loop_animation_button = find_node_by_name(root, "LoopAnim")
|
loop_animation_button = find_node_by_name(root, "LoopAnim")
|
||||||
play_forward = find_node_by_name(root, "PlayForward")
|
play_forward = find_node_by_name(root, "PlayForward")
|
||||||
play_backwards = find_node_by_name(root, "PlayBackwards")
|
play_backwards = find_node_by_name(root, "PlayBackwards")
|
||||||
|
@ -217,14 +241,6 @@ func _ready() -> void:
|
||||||
move_up_layer_button = find_node_by_name(root, "MoveUpLayer")
|
move_up_layer_button = find_node_by_name(root, "MoveUpLayer")
|
||||||
move_down_layer_button = find_node_by_name(root, "MoveDownLayer")
|
move_down_layer_button = find_node_by_name(root, "MoveDownLayer")
|
||||||
merge_down_layer_button = find_node_by_name(root, "MergeDownLayer")
|
merge_down_layer_button = find_node_by_name(root, "MergeDownLayer")
|
||||||
animation_timer = find_node_by_name(root, "AnimationTimer")
|
|
||||||
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")
|
|
||||||
|
|
||||||
brushes_popup = find_node_by_name(root, "BrushesPopup")
|
|
||||||
file_brush_container = find_node_by_name(brushes_popup, "FileBrushContainer")
|
|
||||||
project_brush_container = find_node_by_name(brushes_popup, "ProjectBrushContainer")
|
|
||||||
|
|
||||||
#Thanks to https://godotengine.org/qa/17524/how-to-find-an-instanced-scene-by-its-name
|
#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:
|
func find_node_by_name(root, node_name) -> Node:
|
||||||
|
|
|
@ -13,7 +13,7 @@ func _ready() -> void:
|
||||||
width = 0.1
|
width = 0.1
|
||||||
|
|
||||||
# warning-ignore:unused_argument
|
# warning-ignore:unused_argument
|
||||||
func _process(delta) -> void:
|
func _process(delta : float) -> void:
|
||||||
width = Global.camera.zoom.x
|
width = Global.camera.zoom.x
|
||||||
mouse_pos = get_local_mouse_position()
|
mouse_pos = get_local_mouse_position()
|
||||||
var point0 := points[0]
|
var point0 := points[0]
|
||||||
|
|
|
@ -10,7 +10,7 @@ var first : Vector2
|
||||||
var last : Vector2
|
var last : Vector2
|
||||||
|
|
||||||
# warning-ignore:unused_argument
|
# warning-ignore:unused_argument
|
||||||
func _process(delta) -> void:
|
func _process(delta : float) -> void:
|
||||||
update()
|
update()
|
||||||
|
|
||||||
#Code taken and modified from Godot's source code
|
#Code taken and modified from Godot's source code
|
||||||
|
|
|
@ -5,31 +5,42 @@ var i
|
||||||
# warning-ignore:unused_class_variable
|
# warning-ignore:unused_class_variable
|
||||||
var currently_selected := false
|
var currently_selected := false
|
||||||
|
|
||||||
|
onready var visibility_button := $HBoxContainer/VisibilityButton
|
||||||
|
onready var label := $HBoxContainer/Label
|
||||||
|
onready var line_edit := $HBoxContainer/LineEdit
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
changed_selection()
|
changed_selection()
|
||||||
|
|
||||||
|
func _input(event : InputEvent):
|
||||||
|
if event.is_action_released("ui_accept") && line_edit.visible:
|
||||||
|
label.visible = true
|
||||||
|
line_edit.visible = false
|
||||||
|
line_edit.editable = false
|
||||||
|
|
||||||
func _on_LayerContainer_pressed() -> void:
|
func _on_LayerContainer_pressed() -> void:
|
||||||
var initially_pressed := pressed
|
var initially_pressed := pressed
|
||||||
var label_initially_visible : bool = $HBoxContainer/Label.visible
|
var label_initially_visible : bool = label.visible
|
||||||
Global.canvas.current_layer_index = i
|
Global.canvas.current_layer_index = i
|
||||||
changed_selection()
|
changed_selection()
|
||||||
if !initially_pressed:
|
if !initially_pressed:
|
||||||
if label_initially_visible:
|
if label_initially_visible:
|
||||||
$HBoxContainer/Label.visible = false
|
label.visible = false
|
||||||
$HBoxContainer/LineEdit.visible = true
|
line_edit.visible = true
|
||||||
$HBoxContainer/LineEdit.editable = true
|
line_edit.editable = true
|
||||||
|
line_edit.grab_focus()
|
||||||
else:
|
else:
|
||||||
$HBoxContainer/Label.visible = true
|
label.visible = true
|
||||||
$HBoxContainer/LineEdit.visible = false
|
line_edit.visible = false
|
||||||
$HBoxContainer/LineEdit.editable = false
|
line_edit.editable = false
|
||||||
|
|
||||||
func changed_selection() -> void:
|
func changed_selection() -> void:
|
||||||
var parent = get_parent()
|
var parent := get_parent()
|
||||||
for child in parent.get_children():
|
for child in parent.get_children():
|
||||||
if child is Button:
|
if child is Button:
|
||||||
child.get_node("HBoxContainer/Label").visible = true
|
child.label.visible = true
|
||||||
child.get_node("HBoxContainer/LineEdit").visible = false
|
child.line_edit.visible = false
|
||||||
child.get_node("HBoxContainer/LineEdit").editable = false
|
child.line_edit.editable = false
|
||||||
if Global.canvas.current_layer_index == child.i:
|
if Global.canvas.current_layer_index == child.i:
|
||||||
child.currently_selected = true
|
child.currently_selected = true
|
||||||
child.pressed = true
|
child.pressed = true
|
||||||
|
@ -58,11 +69,11 @@ func changed_selection() -> void:
|
||||||
func _on_VisibilityButton_pressed() -> void:
|
func _on_VisibilityButton_pressed() -> void:
|
||||||
if Global.canvas.layers[i][3]:
|
if Global.canvas.layers[i][3]:
|
||||||
Global.canvas.layers[i][3] = false
|
Global.canvas.layers[i][3] = false
|
||||||
get_child(0).get_child(0).texture_normal = preload("res://Assets/Graphics/Layers/layer_invisible.png")
|
visibility_button.texture_normal = preload("res://Assets/Graphics/Layers/layer_invisible.png")
|
||||||
else:
|
else:
|
||||||
Global.canvas.layers[i][3] = true
|
Global.canvas.layers[i][3] = true
|
||||||
get_child(0).get_child(0).texture_normal = preload("res://Assets/Graphics/Layers/layer_visible.png")
|
visibility_button.texture_normal = preload("res://Assets/Graphics/Layers/layer_visible.png")
|
||||||
|
|
||||||
func _on_LineEdit_text_changed(new_text : String) -> void:
|
func _on_LineEdit_text_changed(new_text : String) -> void:
|
||||||
Global.canvas.layers[i][2] = new_text
|
Global.canvas.layers[i][2] = new_text
|
||||||
$HBoxContainer/Label.text = new_text
|
label.text = new_text
|
|
@ -142,7 +142,7 @@ func _ready() -> void:
|
||||||
brushes_dir.list_dir_end()
|
brushes_dir.list_dir_end()
|
||||||
Global.brushes_from_files = Global.custom_brushes.size()
|
Global.brushes_from_files = Global.custom_brushes.size()
|
||||||
|
|
||||||
func _input(event) -> void:
|
func _input(event : InputEvent) -> void:
|
||||||
if event.is_action_pressed("toggle_fullscreen"):
|
if event.is_action_pressed("toggle_fullscreen"):
|
||||||
OS.window_fullscreen = !OS.window_fullscreen
|
OS.window_fullscreen = !OS.window_fullscreen
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ func _input(event) -> void:
|
||||||
elif event.is_action_pressed(t[1]): #Shortcut for left button
|
elif event.is_action_pressed(t[1]): #Shortcut for left button
|
||||||
_on_Tool_pressed(t[0], false, true)
|
_on_Tool_pressed(t[0], false, true)
|
||||||
|
|
||||||
func _notification(what) -> void:
|
func _notification(what : int) -> void:
|
||||||
if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST: #Handle exit
|
if what == MainLoop.NOTIFICATION_WM_QUIT_REQUEST: #Handle exit
|
||||||
$QuitDialog.popup_centered()
|
$QuitDialog.popup_centered()
|
||||||
Global.can_draw = false
|
Global.can_draw = false
|
||||||
|
|
|
@ -18,7 +18,7 @@ func _ready() -> void:
|
||||||
tex.create_from_image(img, 0)
|
tex.create_from_image(img, 0)
|
||||||
|
|
||||||
# warning-ignore:unused_argument
|
# warning-ignore:unused_argument
|
||||||
func _process(delta) -> void:
|
func _process(delta : float) -> void:
|
||||||
var mouse_pos := get_local_mouse_position() - Global.canvas.location
|
var mouse_pos := get_local_mouse_position() - Global.canvas.location
|
||||||
var mouse_pos_floored := mouse_pos.floor()
|
var mouse_pos_floored := mouse_pos.floor()
|
||||||
var start_pos := polygon[0]
|
var start_pos := polygon[0]
|
||||||
|
|
|
@ -10,7 +10,7 @@ var first : Vector2
|
||||||
var last : Vector2
|
var last : Vector2
|
||||||
|
|
||||||
# warning-ignore:unused_argument
|
# warning-ignore:unused_argument
|
||||||
func _process(delta) -> void:
|
func _process(delta : float) -> void:
|
||||||
update()
|
update()
|
||||||
|
|
||||||
#Code taken and modified from Godot's source code
|
#Code taken and modified from Godot's source code
|
||||||
|
|
|
@ -10,7 +10,7 @@ var first : Vector2
|
||||||
var last : Vector2
|
var last : Vector2
|
||||||
|
|
||||||
# warning-ignore:unused_argument
|
# warning-ignore:unused_argument
|
||||||
func _process(delta) -> void:
|
func _process(delta : float) -> void:
|
||||||
update()
|
update()
|
||||||
|
|
||||||
#Code taken and modified from Godot's source code
|
#Code taken and modified from Godot's source code
|
||||||
|
|
Loading…
Reference in a new issue