mirror of
https://github.com/Relintai/GraphicsEditor.git
synced 2025-02-19 15:54:23 +01:00
Added more canvas outline settings
This commit is contained in:
parent
d8bcc2df3f
commit
42f7abf88a
@ -2,12 +2,13 @@ tool
|
|||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
export var color = Color()
|
export var color = Color()
|
||||||
|
export var width = 3
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func _draw():
|
func _draw():
|
||||||
draw_outline_box(rect_size, color, 3)
|
draw_outline_box(rect_size, color, width)
|
||||||
|
|
||||||
func draw_outline_box(size, color, width):
|
func draw_outline_box(size, color, width):
|
||||||
#Top line
|
#Top line
|
||||||
|
@ -165,10 +165,10 @@ anchor_left = 0.5
|
|||||||
anchor_top = 0.5
|
anchor_top = 0.5
|
||||||
anchor_right = 0.5
|
anchor_right = 0.5
|
||||||
anchor_bottom = 0.5
|
anchor_bottom = 0.5
|
||||||
margin_left = -150.0
|
margin_left = -155.0
|
||||||
margin_top = -50.0
|
margin_top = -80.0
|
||||||
margin_right = 150.0
|
margin_right = 155.0
|
||||||
margin_bottom = 50.0
|
margin_bottom = 80.0
|
||||||
[connection signal="mouse_entered" from="PaintCanvasContainer" to="PaintCanvasContainer" method="_on_PaintCanvasContainer_mouse_entered"]
|
[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="mouse_exited" from="PaintCanvasContainer" to="PaintCanvasContainer" method="_on_PaintCanvasContainer_mouse_exited"]
|
||||||
[connection signal="pressed" from="ToolMenu/Buttons/PaintTool" to="." method="_on_PaintTool_pressed"]
|
[connection signal="pressed" from="ToolMenu/Buttons/PaintTool" to="." method="_on_PaintTool_pressed"]
|
||||||
|
@ -39,7 +39,6 @@ func save_file():
|
|||||||
var pixel_color = chunk_image.get_pixel(x, y)
|
var pixel_color = chunk_image.get_pixel(x, y)
|
||||||
var global_cell_x = (chunk_x * canvas.region_size) + x
|
var global_cell_x = (chunk_x * canvas.region_size) + x
|
||||||
var global_cell_y = (chunk_y * canvas.region_size) + y
|
var global_cell_y = (chunk_y * canvas.region_size) + y
|
||||||
image.lock()
|
|
||||||
image.set_pixel(global_cell_x, global_cell_y, pixel_color)
|
image.set_pixel(global_cell_x, global_cell_y, pixel_color)
|
||||||
image.unlock()
|
image.unlock()
|
||||||
image.save_png(file_path)
|
image.save_png(file_path)
|
||||||
|
@ -8,8 +8,9 @@ var end_time
|
|||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
#start_time = OS.get_ticks_msec()
|
#start_time = OS.get_ticks_msec()
|
||||||
get_node("CanvasOutlineToggle/CheckButton").pressed = canvas_outline.visible
|
get_node("CanvasOutline/Enabled/CheckButton").pressed = canvas_outline.visible
|
||||||
get_node("CanvasOutlineColor/ColorPickerButton").color = canvas_outline.color
|
get_node("CanvasOutline/Color/ColorPickerButton").color = canvas_outline.color
|
||||||
|
get_node("CanvasOutline/Width/SpinBox").value = canvas_outline.width
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
# if get_parent().paint_canvas_node != null:
|
# if get_parent().paint_canvas_node != null:
|
||||||
@ -19,11 +20,15 @@ func _process(delta):
|
|||||||
# set_process(false)
|
# set_process(false)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
func _on_ColorPickerButton_color_changed(color):
|
|
||||||
canvas_outline.color = color
|
|
||||||
|
|
||||||
func _on_CheckButton_toggled(button_pressed):
|
func _on_CheckButton_toggled(button_pressed):
|
||||||
canvas_outline.visible = 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():
|
func _on_Ok_pressed():
|
||||||
hide()
|
hide()
|
||||||
|
|
||||||
|
@ -4,59 +4,89 @@
|
|||||||
|
|
||||||
[node name="Settings" type="WindowDialog"]
|
[node name="Settings" type="WindowDialog"]
|
||||||
margin_top = 20.0
|
margin_top = 20.0
|
||||||
margin_right = 300.0
|
margin_right = 310.0
|
||||||
margin_bottom = 120.0
|
margin_bottom = 180.0
|
||||||
window_title = "Settings"
|
window_title = "Settings"
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
|
||||||
[node name="Ok" type="Button" parent="."]
|
[node name="Ok" type="Button" parent="."]
|
||||||
margin_left = 210.0
|
margin_left = 220.0
|
||||||
margin_top = 70.0
|
margin_top = 130.0
|
||||||
margin_right = 290.0
|
margin_right = 300.0
|
||||||
margin_bottom = 90.0
|
margin_bottom = 150.0
|
||||||
text = "Ok"
|
text = "Ok"
|
||||||
|
|
||||||
[node name="CanvasOutlineToggle" type="Control" parent="."]
|
[node name="CanvasOutline" type="Control" parent="."]
|
||||||
margin_left = 10.0
|
margin_left = 10.0
|
||||||
margin_top = 10.0
|
margin_top = 10.0
|
||||||
margin_right = 290.0
|
margin_right = 300.0
|
||||||
margin_bottom = 30.0
|
margin_bottom = 120.0
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_group_": true
|
"_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_right = 130.0
|
||||||
margin_bottom = 20.0
|
margin_bottom = 20.0
|
||||||
text = "Canvas Outline:"
|
text = "Enabled:"
|
||||||
valign = 1
|
valign = 1
|
||||||
|
|
||||||
[node name="CheckButton" type="CheckButton" parent="CanvasOutlineToggle"]
|
[node name="CheckButton" type="CheckButton" parent="CanvasOutline/Enabled"]
|
||||||
margin_left = 210.0
|
margin_left = 210.0
|
||||||
margin_top = -10.0
|
margin_top = -10.0
|
||||||
margin_right = 286.0
|
margin_right = 286.0
|
||||||
margin_bottom = 30.0
|
margin_bottom = 30.0
|
||||||
pressed = true
|
pressed = true
|
||||||
|
|
||||||
[node name="CanvasOutlineColor" type="Control" parent="."]
|
[node name="Color" type="Control" parent="CanvasOutline"]
|
||||||
margin_left = 10.0
|
margin_left = 10.0
|
||||||
margin_top = 40.0
|
margin_top = 50.0
|
||||||
margin_right = 290.0
|
margin_right = 290.0
|
||||||
margin_bottom = 60.0
|
margin_bottom = 70.0
|
||||||
__meta__ = {
|
|
||||||
"_edit_group_": true
|
|
||||||
}
|
|
||||||
|
|
||||||
[node name="Label" type="Label" parent="CanvasOutlineColor"]
|
[node name="Label" type="Label" parent="CanvasOutline/Color"]
|
||||||
margin_right = 130.0
|
margin_right = 130.0
|
||||||
margin_bottom = 20.0
|
margin_bottom = 20.0
|
||||||
text = "Canvas Outline Color:"
|
text = "Color:"
|
||||||
valign = 1
|
valign = 1
|
||||||
|
|
||||||
[node name="ColorPickerButton" type="ColorPickerButton" parent="CanvasOutlineColor"]
|
[node name="ColorPickerButton" type="ColorPickerButton" parent="CanvasOutline/Color"]
|
||||||
margin_left = 170.0
|
margin_left = 170.0
|
||||||
margin_right = 280.0
|
margin_right = 280.0
|
||||||
margin_bottom = 20.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="pressed" from="Ok" to="." method="_on_Ok_pressed"]
|
||||||
[connection signal="toggled" from="CanvasOutlineToggle/CheckButton" to="." method="_on_CheckButton_toggled"]
|
[connection signal="toggled" from="CanvasOutline/Enabled/CheckButton" to="." method="_on_CheckButton_toggled"]
|
||||||
[connection signal="color_changed" from="CanvasOutlineColor/ColorPickerButton" to="." method="_on_ColorPickerButton_color_changed"]
|
[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"]
|
||||||
|
Loading…
Reference in New Issue
Block a user