Implemented locking/unlocking layers
When a layer is locked, no changes can be made to it.
BIN
Assets/Graphics/Dark Themes/Layers/Lock.png
Normal file
After Width: | Height: | Size: 735 B |
34
Assets/Graphics/Dark Themes/Layers/Lock.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Lock.png-9253af0d80ec5684a17613b6e5d28ded.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Graphics/Dark Themes/Layers/Lock.png"
|
||||
dest_files=[ "res://.import/Lock.png-9253af0d80ec5684a17613b6e5d28ded.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
Assets/Graphics/Dark Themes/Layers/Lock_Hover.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
34
Assets/Graphics/Dark Themes/Layers/Lock_Hover.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Lock_Hover.png-b9a0e5f411d19706e8262906e2e525a4.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Graphics/Dark Themes/Layers/Lock_Hover.png"
|
||||
dest_files=[ "res://.import/Lock_Hover.png-b9a0e5f411d19706e8262906e2e525a4.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
Assets/Graphics/Dark Themes/Layers/Unlock.png
Normal file
After Width: | Height: | Size: 718 B |
34
Assets/Graphics/Dark Themes/Layers/Unlock.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Unlock.png-9d9c7e247255647a55364f4f306f9095.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Graphics/Dark Themes/Layers/Unlock.png"
|
||||
dest_files=[ "res://.import/Unlock.png-9d9c7e247255647a55364f4f306f9095.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
Assets/Graphics/Dark Themes/Layers/Unlock_Hover.png
Normal file
After Width: | Height: | Size: 718 B |
34
Assets/Graphics/Dark Themes/Layers/Unlock_Hover.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Unlock_Hover.png-b5ce9295ff6e785f6e3679320f3b65d9.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Graphics/Dark Themes/Layers/Unlock_Hover.png"
|
||||
dest_files=[ "res://.import/Unlock_Hover.png-b5ce9295ff6e785f6e3679320f3b65d9.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
Assets/Graphics/Gold Themes/Layers/Lock.png
Normal file
After Width: | Height: | Size: 6 KiB |
34
Assets/Graphics/Gold Themes/Layers/Lock.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Lock.png-416bf727369200d7502932659c7deec1.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Graphics/Gold Themes/Layers/Lock.png"
|
||||
dest_files=[ "res://.import/Lock.png-416bf727369200d7502932659c7deec1.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
Assets/Graphics/Gold Themes/Layers/Lock_Hover.png
Normal file
After Width: | Height: | Size: 6 KiB |
34
Assets/Graphics/Gold Themes/Layers/Lock_Hover.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Lock_Hover.png-428f700716402bc09c16ba354a2758f1.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Graphics/Gold Themes/Layers/Lock_Hover.png"
|
||||
dest_files=[ "res://.import/Lock_Hover.png-428f700716402bc09c16ba354a2758f1.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
Assets/Graphics/Gold Themes/Layers/Unlock.png
Normal file
After Width: | Height: | Size: 724 B |
34
Assets/Graphics/Gold Themes/Layers/Unlock.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Unlock.png-ae00d42d445f8264be1092ce547d974a.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Graphics/Gold Themes/Layers/Unlock.png"
|
||||
dest_files=[ "res://.import/Unlock.png-ae00d42d445f8264be1092ce547d974a.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
Assets/Graphics/Gold Themes/Layers/Unlock_Hover.png
Normal file
After Width: | Height: | Size: 724 B |
34
Assets/Graphics/Gold Themes/Layers/Unlock_Hover.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Unlock_Hover.png-78e723e6649c4ab922f37eb6469206ce.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Graphics/Gold Themes/Layers/Unlock_Hover.png"
|
||||
dest_files=[ "res://.import/Unlock_Hover.png-78e723e6649c4ab922f37eb6469206ce.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
Assets/Graphics/Light Themes/Layers/Lock.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
34
Assets/Graphics/Light Themes/Layers/Lock.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Lock.png-dc7e2c18836835a8b8a96271217c9efd.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Graphics/Light Themes/Layers/Lock.png"
|
||||
dest_files=[ "res://.import/Lock.png-dc7e2c18836835a8b8a96271217c9efd.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
Assets/Graphics/Light Themes/Layers/Lock_Hover.png
Normal file
After Width: | Height: | Size: 5.7 KiB |
34
Assets/Graphics/Light Themes/Layers/Lock_Hover.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Lock_Hover.png-4da93394f176989a60b6e85874cfa07e.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Graphics/Light Themes/Layers/Lock_Hover.png"
|
||||
dest_files=[ "res://.import/Lock_Hover.png-4da93394f176989a60b6e85874cfa07e.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
Assets/Graphics/Light Themes/Layers/Unlock.png
Normal file
After Width: | Height: | Size: 718 B |
34
Assets/Graphics/Light Themes/Layers/Unlock.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Unlock.png-abf213a919e6bf6f9a20575b5ee07cf4.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Graphics/Light Themes/Layers/Unlock.png"
|
||||
dest_files=[ "res://.import/Unlock.png-abf213a919e6bf6f9a20575b5ee07cf4.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
Assets/Graphics/Light Themes/Layers/Unlock_Hover.png
Normal file
After Width: | Height: | Size: 716 B |
34
Assets/Graphics/Light Themes/Layers/Unlock_Hover.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/Unlock_Hover.png-55cd8b99f1a29eabf99f8ac183068a35.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Graphics/Light Themes/Layers/Unlock_Hover.png"
|
||||
dest_files=[ "res://.import/Unlock_Hover.png-55cd8b99f1a29eabf99f8ac183068a35.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
|
@ -1,8 +1,10 @@
|
|||
[gd_scene load_steps=4 format=2]
|
||||
[gd_scene load_steps=6 format=2]
|
||||
|
||||
[ext_resource path="res://Scripts/LayerContainer.gd" type="Script" id=1]
|
||||
[ext_resource path="res://Assets/Graphics/Dark Themes/Layers/Layer_Visible.png" type="Texture" id=2]
|
||||
[ext_resource path="res://Assets/Graphics/Dark Themes/Layers/Layer_Visible_Hover.png" type="Texture" id=3]
|
||||
[ext_resource path="res://Assets/Graphics/Dark Themes/Layers/Unlock_Hover.png" type="Texture" id=4]
|
||||
[ext_resource path="res://Assets/Graphics/Dark Themes/Layers/Unlock.png" type="Texture" id=5]
|
||||
|
||||
[node name="LayerContainer" type="Button"]
|
||||
margin_right = 210.0
|
||||
|
@ -25,7 +27,7 @@ __meta__ = {
|
|||
}
|
||||
|
||||
[node name="LayerButtons" type="HBoxContainer" parent="HBoxContainer"]
|
||||
margin_right = 32.0
|
||||
margin_right = 68.0
|
||||
margin_bottom = 36.0
|
||||
|
||||
[node name="VisibilityButton" type="TextureButton" parent="HBoxContainer/LayerButtons" groups=[
|
||||
|
@ -41,11 +43,25 @@ size_flags_vertical = 4
|
|||
texture_normal = ExtResource( 2 )
|
||||
texture_hover = ExtResource( 3 )
|
||||
|
||||
[node name="LayerName" type="HBoxContainer" parent="HBoxContainer"]
|
||||
[node name="LockButton" type="TextureButton" parent="HBoxContainer/LayerButtons" groups=[
|
||||
"UIButtons",
|
||||
]]
|
||||
margin_left = 36.0
|
||||
margin_top = 2.0
|
||||
margin_right = 68.0
|
||||
margin_bottom = 34.0
|
||||
hint_tooltip = "Lock/unlock layer."
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 0
|
||||
size_flags_vertical = 4
|
||||
texture_normal = ExtResource( 5 )
|
||||
texture_hover = ExtResource( 4 )
|
||||
|
||||
[node name="LayerName" type="HBoxContainer" parent="HBoxContainer"]
|
||||
margin_left = 72.0
|
||||
margin_right = 212.0
|
||||
margin_bottom = 36.0
|
||||
rect_min_size = Vector2( 176, 0 )
|
||||
rect_min_size = Vector2( 140, 0 )
|
||||
mouse_default_cursor_shape = 2
|
||||
size_flags_horizontal = 0
|
||||
alignment = 1
|
||||
|
@ -55,7 +71,7 @@ __meta__ = {
|
|||
|
||||
[node name="Label" type="Label" parent="HBoxContainer/LayerName"]
|
||||
margin_top = 11.0
|
||||
margin_right = 176.0
|
||||
margin_right = 140.0
|
||||
margin_bottom = 25.0
|
||||
size_flags_horizontal = 3
|
||||
text = "Layer 0"
|
||||
|
@ -76,3 +92,4 @@ caret_blink = true
|
|||
caret_blink_speed = 0.5
|
||||
[connection signal="pressed" from="." to="." method="_on_LayerContainer_pressed"]
|
||||
[connection signal="pressed" from="HBoxContainer/LayerButtons/VisibilityButton" to="." method="_on_VisibilityButton_pressed"]
|
||||
[connection signal="pressed" from="HBoxContainer/LayerButtons/LockButton" to="." method="_on_LockButton_pressed"]
|
||||
|
|
|
@ -146,8 +146,8 @@ func add_layer(is_new := true) -> void:
|
|||
|
||||
var new_layers : Array = Global.layers.duplicate()
|
||||
|
||||
# Store [Layer name, Layer visibility boolean, Frame container]
|
||||
new_layers.append([layer_name, true, HBoxContainer.new()])
|
||||
# Store [Layer name, Layer visibility boolean, Layer lock boolean, Frame container]
|
||||
new_layers.append([layer_name, true, false, HBoxContainer.new()])
|
||||
|
||||
Global.undos += 1
|
||||
Global.undo_redo.create_action("Add Layer")
|
||||
|
@ -156,7 +156,7 @@ func add_layer(is_new := true) -> void:
|
|||
var new_layer := Image.new()
|
||||
if is_new:
|
||||
new_layer.create(c.size.x, c.size.y, false, Image.FORMAT_RGBA8)
|
||||
else: # clone layer
|
||||
else: # Clone layer
|
||||
new_layer.copy_from(c.layers[Global.current_layer][0])
|
||||
|
||||
new_layer.lock()
|
||||
|
|
|
@ -180,7 +180,7 @@ func _input(event : InputEvent) -> void:
|
|||
can_undo = true
|
||||
|
||||
current_pixel = get_local_mouse_position() + location
|
||||
if Global.current_frame != frame:
|
||||
if Global.current_frame != frame || Global.layers[Global.current_layer][2]:
|
||||
previous_mouse_pos = current_pixel
|
||||
previous_mouse_pos.x = clamp(previous_mouse_pos.x, location.x, location.x + size.x)
|
||||
previous_mouse_pos.y = clamp(previous_mouse_pos.y, location.y, location.y + size.y)
|
||||
|
@ -493,7 +493,7 @@ func update_texture(layer_index : int) -> void:
|
|||
layers[layer_index][1].create_from_image(layers[layer_index][0], 0)
|
||||
|
||||
var frame_texture_rect : TextureRect
|
||||
frame_texture_rect = Global.find_node_by_name(Global.layers[layer_index][2].get_child(frame),"FrameTexture")
|
||||
frame_texture_rect = Global.find_node_by_name(Global.layers[layer_index][3].get_child(frame),"FrameTexture")
|
||||
frame_texture_rect.texture = layers[layer_index][1]
|
||||
|
||||
func pencil_and_eraser(sprite : Image, mouse_pos : Vector2, color : Color, current_mouse_button : String, current_action := "None") -> void:
|
||||
|
|
|
@ -371,8 +371,8 @@ func _ready() -> void:
|
|||
|
||||
error_dialog = find_node_by_name(root, "ErrorDialog")
|
||||
|
||||
# Store [Layer name, Layer visibility boolean, Frame container]
|
||||
layers.append([tr("Layer") + " 0", true, HBoxContainer.new()])
|
||||
# Store [Layer name, Layer visibility boolean, Layer lock boolean, Frame container]
|
||||
layers.append([tr("Layer") + " 0", true, false, HBoxContainer.new()])
|
||||
|
||||
# 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:
|
||||
|
@ -477,7 +477,7 @@ func canvases_changed(value : Array) -> void:
|
|||
frame_id.queue_free()
|
||||
|
||||
for i in range(layers.size() - 1, -1, -1):
|
||||
frames_container.add_child(layers[i][2])
|
||||
frames_container.add_child(layers[i][3])
|
||||
|
||||
for j in range(canvases.size()):
|
||||
var label := Label.new()
|
||||
|
@ -492,7 +492,7 @@ func canvases_changed(value : Array) -> void:
|
|||
frame_button.layer = i
|
||||
frame_button.get_child(0).texture = Global.canvases[j].layers[i][1]
|
||||
|
||||
layers[i][2].add_child(frame_button)
|
||||
layers[i][3].add_child(frame_button)
|
||||
|
||||
func layers_changed(value : Array) -> void:
|
||||
layers = value
|
||||
|
@ -516,14 +516,14 @@ func layers_changed(value : Array) -> void:
|
|||
layer_container.label.text = layers[i][0]
|
||||
layer_container.line_edit.text = layers[i][0]
|
||||
|
||||
frames_container.add_child(layers[i][2])
|
||||
frames_container.add_child(layers[i][3])
|
||||
for j in range(canvases.size()):
|
||||
var frame_button = load("res://Prefabs/FrameButton.tscn").instance()
|
||||
frame_button.frame = j
|
||||
frame_button.layer = i
|
||||
frame_button.get_child(0).texture = Global.canvases[j].layers[i][1]
|
||||
|
||||
layers[i][2].add_child(frame_button)
|
||||
layers[i][3].add_child(frame_button)
|
||||
|
||||
var layer_button = layers_container.get_child(layers_container.get_child_count() - 1 - current_layer)
|
||||
layer_button.pressed = true
|
||||
|
@ -556,16 +556,16 @@ func frame_changed(value : int) -> void:
|
|||
text_color = Color.black
|
||||
frame_ids.get_child(i).add_color_override("font_color", text_color)
|
||||
for layer in layers:
|
||||
if i < layer[2].get_child_count():
|
||||
layer[2].get_child(i).pressed = false
|
||||
if i < layer[3].get_child_count():
|
||||
layer[3].get_child(i).pressed = false
|
||||
i += 1
|
||||
|
||||
# Select the new canvas/frame
|
||||
canvas = canvases[current_frame]
|
||||
canvas.visible = true
|
||||
frame_ids.get_child(current_frame).add_color_override("font_color", Color("#3c5d75"))
|
||||
if current_frame < layers[current_layer][2].get_child_count():
|
||||
layers[current_layer][2].get_child(current_frame).pressed = true
|
||||
if current_frame < layers[current_layer][3].get_child_count():
|
||||
layers[current_layer][3].get_child(current_frame).pressed = true
|
||||
|
||||
func layer_changed(value : int) -> void:
|
||||
current_layer = value
|
||||
|
|
|
@ -3,11 +3,13 @@ extends Button
|
|||
|
||||
var i := 0
|
||||
var visibility_button : BaseButton
|
||||
var lock_button : BaseButton
|
||||
var label : Label
|
||||
var line_edit : LineEdit
|
||||
|
||||
func _ready() -> void:
|
||||
visibility_button = Global.find_node_by_name(self, "VisibilityButton")
|
||||
lock_button = Global.find_node_by_name(self, "LockButton")
|
||||
label = Global.find_node_by_name(self, "Label")
|
||||
line_edit = Global.find_node_by_name(self, "LineEdit")
|
||||
|
||||
|
@ -18,6 +20,13 @@ func _ready() -> void:
|
|||
visibility_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Layer_Invisible.png" % Global.theme_type)
|
||||
visibility_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Layer_Invisible_Hover.png" % Global.theme_type)
|
||||
|
||||
if Global.layers[i][2]:
|
||||
lock_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Lock.png" % Global.theme_type)
|
||||
lock_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Lock_Hover.png" % Global.theme_type)
|
||||
else:
|
||||
lock_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Unlock.png" % Global.theme_type)
|
||||
lock_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Unlock_Hover.png" % Global.theme_type)
|
||||
|
||||
func _input(event : InputEvent) -> void:
|
||||
if event.is_action_released("ui_accept") && line_edit.visible && event.scancode != KEY_SPACE:
|
||||
label.visible = true
|
||||
|
@ -51,3 +60,13 @@ func _on_VisibilityButton_pressed() -> void:
|
|||
visibility_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Layer_Visible.png" % Global.theme_type)
|
||||
visibility_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Layer_Visible_Hover.png" % Global.theme_type)
|
||||
Global.canvas.update()
|
||||
|
||||
func _on_LockButton_pressed() -> void:
|
||||
if Global.layers[i][2]:
|
||||
Global.layers[i][2] = false
|
||||
lock_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Unlock.png" % Global.theme_type)
|
||||
lock_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Unlock_Hover.png" % Global.theme_type)
|
||||
else:
|
||||
Global.layers[i][2] = true
|
||||
lock_button.texture_normal = load("res://Assets/Graphics/%s Themes/Layers/Lock.png" % Global.theme_type)
|
||||
lock_button.texture_hover = load("res://Assets/Graphics/%s Themes/Layers/Lock_Hover.png" % Global.theme_type)
|
||||
|
|
|
@ -407,8 +407,9 @@ func _on_OpenSprite_file_selected(path : String) -> void:
|
|||
while global_layer_line == ".":
|
||||
var layer_name := file.get_line()
|
||||
var layer_visibility := file.get_8()
|
||||
# Store [Layer name, Layer visibility boolean, Frame container]
|
||||
Global.layers.append([layer_name, layer_visibility, HBoxContainer.new()])
|
||||
var layer_lock := file.get_8()
|
||||
# Store [Layer name, Layer visibility boolean, Layer lock boolean, Frame container]
|
||||
Global.layers.append([layer_name, layer_visibility, layer_lock, HBoxContainer.new()])
|
||||
global_layer_line = file.get_line()
|
||||
|
||||
var frame_line := file.get_line()
|
||||
|
@ -519,6 +520,7 @@ func _on_SaveSprite_file_selected(path : String) -> void:
|
|||
file.store_line(".")
|
||||
file.store_line(layer[0]) # Layer name
|
||||
file.store_8(layer[1]) # Layer visibility
|
||||
file.store_8(layer[2]) # Layer lock
|
||||
file.store_line("END_GLOBAL_LAYERS")
|
||||
|
||||
for canvas in Global.canvases: # Store frames
|
||||
|
|
|
@ -19,6 +19,8 @@ func _ready() -> void:
|
|||
|
||||
# warning-ignore:unused_argument
|
||||
func _process(delta : float) -> void:
|
||||
if Global.layers[Global.current_layer][2]:
|
||||
return
|
||||
var mouse_pos: Vector2 = get_local_mouse_position() - Global.canvas.location
|
||||
var mouse_pos_floored := mouse_pos.floor()
|
||||
var start_pos := polygon[0]
|
||||
|
|