mirror of
https://github.com/Relintai/GraphicsEditor.git
synced 2024-11-19 16:27:22 +01:00
Fixed some layer bugs and updated gitignore
This commit is contained in:
parent
7b08d9106f
commit
7fdb3fc04c
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,9 +1,9 @@
|
||||
\exports/
|
||||
\.import/
|
||||
|
||||
addons/scene_notes/
|
||||
addons/*
|
||||
|
||||
addons/todo/
|
||||
!addons/graphics_editor
|
||||
|
||||
scene-notes\.ini
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
[ext_resource path="res://addons/graphics_editor/Dialogs/Settings.gd" type="Script" id=1]
|
||||
|
||||
[node name="Settings" type="WindowDialog"]
|
||||
visible = true
|
||||
margin_top = 20.0
|
||||
margin_right = 250.0
|
||||
margin_bottom = 270.0
|
||||
|
@ -29,7 +29,6 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="PaintCanvasContainer" type="Control" parent="."]
|
||||
editor/display_folded = true
|
||||
show_behind_parent = true
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
@ -74,10 +73,6 @@ anchor_right = 0.0
|
||||
anchor_bottom = 0.0
|
||||
margin_right = 1600.0
|
||||
margin_bottom = 1600.0
|
||||
grid_size = 16
|
||||
canvas_size = Vector2( 100, 100 )
|
||||
chunk_size = Vector2( 10, 10 )
|
||||
can_draw = true
|
||||
|
||||
[node name="PixelCursorHighlight" type="Control" parent="PaintCanvasContainer/ViewportContainer/Viewport/PaintCanvas"]
|
||||
anchor_right = 1.0
|
||||
@ -99,16 +94,11 @@ __meta__ = {
|
||||
[node name="VisualGrid" parent="PaintCanvasContainer/ViewportContainer/Viewport/PaintCanvas/Grids" instance=ExtResource( 6 )]
|
||||
mouse_filter = 2
|
||||
color = Color( 0.639216, 0.639216, 0.639216, 1 )
|
||||
size = 16
|
||||
zoom = 0
|
||||
offset = Vector2( 0, 0 )
|
||||
|
||||
[node name="VisualGrid2" parent="PaintCanvasContainer/ViewportContainer/Viewport/PaintCanvas/Grids" instance=ExtResource( 6 )]
|
||||
mouse_filter = 2
|
||||
color = Color( 1, 1, 1, 1 )
|
||||
size = 160.0
|
||||
zoom = 0
|
||||
offset = Vector2( 0, 0 )
|
||||
|
||||
[node name="CanvasOutline" type="Control" parent="PaintCanvasContainer/ViewportContainer/Viewport/PaintCanvas"]
|
||||
anchor_right = 1.0
|
||||
@ -122,7 +112,6 @@ color = Color( 0, 1, 0, 1 )
|
||||
width = 3.0
|
||||
|
||||
[node name="Navbar" type="Control" parent="."]
|
||||
editor/display_folded = true
|
||||
anchor_right = 1.0
|
||||
margin_bottom = 20.0
|
||||
script = ExtResource( 8 )
|
||||
@ -139,7 +128,6 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="ToolMenu" type="Control" parent="."]
|
||||
editor/display_folded = true
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
@ -234,7 +222,6 @@ align = 1
|
||||
valign = 1
|
||||
|
||||
[node name="BottomPanel" type="Panel" parent="."]
|
||||
editor/display_folded = true
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
@ -250,6 +237,7 @@ __meta__ = {
|
||||
}
|
||||
|
||||
[node name="Dialogs" type="Control" parent="."]
|
||||
editor/display_folded = true
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
mouse_filter = 2
|
||||
|
@ -6,7 +6,6 @@ onready var layer_list = get_node("Panel/ScrollContainer/VBoxContainer")
|
||||
var layer_scene = preload("res://addons/graphics_editor/Layer.tscn")
|
||||
var active_layer setget set_active_layer
|
||||
|
||||
#TODO: When a layer gets deleted, and then added back in with the same name, the layer data is copied over then
|
||||
func _ready():
|
||||
if layer_list.get_children().size() <= 0:
|
||||
add_new_layer(true)
|
||||
@ -35,11 +34,11 @@ func get_all_layer_images():
|
||||
array.append(i.image_storage)
|
||||
return array
|
||||
|
||||
func increase_number_string(array, name_string, cur_int = 1):
|
||||
for i in array:
|
||||
if i == "%s %s" % [name_string, cur_int]:
|
||||
cur_int += 1
|
||||
return "%s %s" % [name_string, cur_int]
|
||||
var num_increase = 1
|
||||
func increase_number_string(array, name_string):
|
||||
var name_to_return = "%s %s" % [name_string, num_increase]
|
||||
num_increase += 1
|
||||
return name_to_return
|
||||
|
||||
func _on_AddLayer_pressed():
|
||||
add_new_layer()
|
||||
@ -57,9 +56,15 @@ func add_new_layer(is_active = false):
|
||||
set_active_layer(new_node_name)
|
||||
|
||||
func remove_layer(layer_name):
|
||||
if layer_list.get_children().size() <= 1:
|
||||
var layer_children = layer_list.get_children()
|
||||
if layer_children.size() <= 1:
|
||||
print("There needs to be an active layer always!")
|
||||
return
|
||||
var node_to_remove = layer_list.get_node_or_null(layer_name)
|
||||
if node_to_remove:
|
||||
node_to_remove.queue_free()
|
||||
for i in layer_children.size():
|
||||
if layer_children[i].name == layer_name:
|
||||
if layer_children[i].name == active_layer:
|
||||
if layer_children.size() != i+1:
|
||||
set_active_layer(layer_children[i+1].name)
|
||||
else:
|
||||
set_active_layer(layer_children[i-1].name)
|
||||
layer_children[i].queue_free()
|
@ -21,7 +21,7 @@ config/icon="res://icon.png"
|
||||
|
||||
[editor_plugins]
|
||||
|
||||
enabled=PoolStringArray( "todo" )
|
||||
enabled=PoolStringArray( "todo", "zylann.editor_debugger" )
|
||||
|
||||
[rendering]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user