diff --git a/addons/graphics_editor/CanvasOutline.gd b/addons/graphics_editor/CanvasOutline.gd index c17d7ce..4183c81 100644 --- a/addons/graphics_editor/CanvasOutline.gd +++ b/addons/graphics_editor/CanvasOutline.gd @@ -2,12 +2,13 @@ tool extends Control export var color = Color() +export var width = 3 func _ready(): pass func _draw(): - draw_outline_box(rect_size, color, 3) + draw_outline_box(rect_size, color, width) func draw_outline_box(size, color, width): #Top line diff --git a/addons/graphics_editor/Editor.tscn b/addons/graphics_editor/Editor.tscn index a9774e4..29bf6bc 100644 --- a/addons/graphics_editor/Editor.tscn +++ b/addons/graphics_editor/Editor.tscn @@ -165,10 +165,10 @@ anchor_left = 0.5 anchor_top = 0.5 anchor_right = 0.5 anchor_bottom = 0.5 -margin_left = -150.0 -margin_top = -50.0 -margin_right = 150.0 -margin_bottom = 50.0 +margin_left = -155.0 +margin_top = -80.0 +margin_right = 155.0 +margin_bottom = 80.0 [connection signal="mouse_entered" from="PaintCanvasContainer" to="PaintCanvasContainer" method="_on_PaintCanvasContainer_mouse_entered"] [connection signal="mouse_exited" from="PaintCanvasContainer" to="PaintCanvasContainer" method="_on_PaintCanvasContainer_mouse_exited"] [connection signal="pressed" from="ToolMenu/Buttons/PaintTool" to="." method="_on_PaintTool_pressed"] diff --git a/addons/graphics_editor/SaveFileDialog.gd b/addons/graphics_editor/SaveFileDialog.gd index aff311e..9def6f4 100644 --- a/addons/graphics_editor/SaveFileDialog.gd +++ b/addons/graphics_editor/SaveFileDialog.gd @@ -39,7 +39,6 @@ func save_file(): var pixel_color = chunk_image.get_pixel(x, y) var global_cell_x = (chunk_x * canvas.region_size) + x var global_cell_y = (chunk_y * canvas.region_size) + y - image.lock() image.set_pixel(global_cell_x, global_cell_y, pixel_color) image.unlock() image.save_png(file_path) diff --git a/addons/graphics_editor/Settings.gd b/addons/graphics_editor/Settings.gd index eb3b11b..7218aff 100644 --- a/addons/graphics_editor/Settings.gd +++ b/addons/graphics_editor/Settings.gd @@ -8,8 +8,9 @@ var end_time func _ready(): #start_time = OS.get_ticks_msec() - get_node("CanvasOutlineToggle/CheckButton").pressed = canvas_outline.visible - get_node("CanvasOutlineColor/ColorPickerButton").color = canvas_outline.color + get_node("CanvasOutline/Enabled/CheckButton").pressed = canvas_outline.visible + get_node("CanvasOutline/Color/ColorPickerButton").color = canvas_outline.color + get_node("CanvasOutline/Width/SpinBox").value = canvas_outline.width func _process(delta): # if get_parent().paint_canvas_node != null: @@ -19,11 +20,15 @@ func _process(delta): # set_process(false) pass -func _on_ColorPickerButton_color_changed(color): - canvas_outline.color = color - func _on_CheckButton_toggled(button_pressed): canvas_outline.visible = button_pressed +func _on_ColorPickerButton_color_changed(color): + canvas_outline.color = color + +func _on_SpinBox_value_changed(value): + canvas_outline.width = value + func _on_Ok_pressed(): hide() + diff --git a/addons/graphics_editor/Settings.tscn b/addons/graphics_editor/Settings.tscn index 43473eb..907bcbd 100644 --- a/addons/graphics_editor/Settings.tscn +++ b/addons/graphics_editor/Settings.tscn @@ -4,59 +4,89 @@ [node name="Settings" type="WindowDialog"] margin_top = 20.0 -margin_right = 300.0 -margin_bottom = 120.0 +margin_right = 310.0 +margin_bottom = 180.0 window_title = "Settings" script = ExtResource( 1 ) [node name="Ok" type="Button" parent="."] -margin_left = 210.0 -margin_top = 70.0 -margin_right = 290.0 -margin_bottom = 90.0 +margin_left = 220.0 +margin_top = 130.0 +margin_right = 300.0 +margin_bottom = 150.0 text = "Ok" -[node name="CanvasOutlineToggle" type="Control" parent="."] +[node name="CanvasOutline" type="Control" parent="."] margin_left = 10.0 margin_top = 10.0 -margin_right = 290.0 -margin_bottom = 30.0 +margin_right = 300.0 +margin_bottom = 120.0 __meta__ = { "_edit_group_": true } -[node name="Label" type="Label" parent="CanvasOutlineToggle"] +[node name="Label" type="Label" parent="CanvasOutline"] +margin_right = 100.0 +margin_bottom = 14.0 +text = "Canvas Outline:" + +[node name="Enabled" type="Control" parent="CanvasOutline"] +margin_left = 10.0 +margin_top = 20.0 +margin_right = 290.0 +margin_bottom = 40.0 + +[node name="Label" type="Label" parent="CanvasOutline/Enabled"] margin_right = 130.0 margin_bottom = 20.0 -text = "Canvas Outline:" +text = "Enabled:" valign = 1 -[node name="CheckButton" type="CheckButton" parent="CanvasOutlineToggle"] +[node name="CheckButton" type="CheckButton" parent="CanvasOutline/Enabled"] margin_left = 210.0 margin_top = -10.0 margin_right = 286.0 margin_bottom = 30.0 pressed = true -[node name="CanvasOutlineColor" type="Control" parent="."] +[node name="Color" type="Control" parent="CanvasOutline"] margin_left = 10.0 -margin_top = 40.0 +margin_top = 50.0 margin_right = 290.0 -margin_bottom = 60.0 -__meta__ = { -"_edit_group_": true -} +margin_bottom = 70.0 -[node name="Label" type="Label" parent="CanvasOutlineColor"] +[node name="Label" type="Label" parent="CanvasOutline/Color"] margin_right = 130.0 margin_bottom = 20.0 -text = "Canvas Outline Color:" +text = "Color:" valign = 1 -[node name="ColorPickerButton" type="ColorPickerButton" parent="CanvasOutlineColor"] +[node name="ColorPickerButton" type="ColorPickerButton" parent="CanvasOutline/Color"] margin_left = 170.0 margin_right = 280.0 margin_bottom = 20.0 + +[node name="Width" type="Control" parent="CanvasOutline"] +margin_left = 10.0 +margin_top = 80.0 +margin_right = 290.0 +margin_bottom = 100.0 + +[node name="Label" type="Label" parent="CanvasOutline/Width"] +margin_right = 130.0 +margin_bottom = 20.0 +rect_rotation = -0.00812905 +text = "Width:" +valign = 1 + +[node name="SpinBox" type="SpinBox" parent="CanvasOutline/Width"] +margin_left = 210.0 +margin_right = 284.0 +margin_bottom = 24.0 +max_value = 9999.0 +allow_greater = true +allow_lesser = true [connection signal="pressed" from="Ok" to="." method="_on_Ok_pressed"] -[connection signal="toggled" from="CanvasOutlineToggle/CheckButton" to="." method="_on_CheckButton_toggled"] -[connection signal="color_changed" from="CanvasOutlineColor/ColorPickerButton" to="." method="_on_ColorPickerButton_color_changed"] +[connection signal="toggled" from="CanvasOutline/Enabled/CheckButton" to="." method="_on_CheckButton_toggled"] +[connection signal="color_changed" from="CanvasOutline/Color/ColorPickerButton" to="." method="_on_ColorPickerButton_color_changed"] +[connection signal="value_changed" from="CanvasOutline/Width/SpinBox" to="." method="_on_SpinBox_value_changed"]