diff --git a/addons/graphics_editor/ColorPicker.gd b/addons/graphics_editor/ColorPicker.gd index 44a01df..07d628d 100644 --- a/addons/graphics_editor/ColorPicker.gd +++ b/addons/graphics_editor/ColorPicker.gd @@ -1,6 +1,8 @@ tool extends ColorPickerButton +#TODO: Picking a color from the canvas is actually broken? + var color_picking = false var mouse_on_top = false diff --git a/addons/graphics_editor/Editor.tscn b/addons/graphics_editor/Editor.tscn index e89457e..d594be9 100644 --- a/addons/graphics_editor/Editor.tscn +++ b/addons/graphics_editor/Editor.tscn @@ -32,7 +32,6 @@ __meta__ = { } [node name="PaintCanvasContainer" type="Control" parent="."] -editor/display_folded = true show_behind_parent = true anchor_right = 1.0 anchor_bottom = 1.0 @@ -47,7 +46,6 @@ __meta__ = { } [node name="ViewportContainer" type="ViewportContainer" parent="PaintCanvasContainer"] -editor/display_folded = true anchor_right = 1.0 anchor_bottom = 1.0 mouse_filter = 1 @@ -164,7 +162,6 @@ switch_on_hover = true script = ExtResource( 9 ) [node name="ToolMenu" type="Control" parent="."] -editor/display_folded = true anchor_left = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 @@ -176,7 +173,6 @@ __meta__ = { } [node name="Buttons" type="Control" parent="ToolMenu"] -editor/display_folded = true anchor_right = 1.0 margin_bottom = 310.0 @@ -233,7 +229,6 @@ __meta__ = { } [node name="Panel" type="Panel" parent="ToolMenu/Layers"] -editor/display_folded = true anchor_right = 1.0 anchor_bottom = 1.0 diff --git a/addons/graphics_editor/Layer.gd b/addons/graphics_editor/Layer.gd index 8279e2d..22070eb 100644 --- a/addons/graphics_editor/Layer.gd +++ b/addons/graphics_editor/Layer.gd @@ -1,12 +1,14 @@ tool extends Control +onready var layers = get_node("../../../../") +onready var canvas = layers.canvas var image_storage = Image.new() #TODO: Get image preview working! var image_preview setget set_image_preview -var layer_visible = true +var layer_visible = true setget set_layer_visible func _ready(): - var canvas_size = get_node("../../../../").canvas.image.get_size() + var canvas_size = canvas.image.get_size() image_storage.create(canvas_size.x, canvas_size.y, true, Image.FORMAT_RGBA8) func set_image_preview(image_data): @@ -17,11 +19,18 @@ func set_image_preview(image_data): texture.setup_local_to_scene() get_node("TextureRect").texture = texture +func set_layer_visible(value): + layer_visible = value + if layer_visible: + get_node("Visible").modulate = Color(1, 1, 1) + else: + get_node("Visible").modulate = Color(0.572549, 0.572549, 0.572549) + func _on_LayerButton_pressed(): - get_node("../../../../").active_layer = name + layers.active_layer = name func _on_Visible_pressed(): - layer_visible = !layer_visible + set_layer_visible(!layer_visible) func _on_Delete_pressed(): - get_node("../../../../").remove_layer(name) + layers.remove_layer(name)