mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Added checkbox in OutlineDialog for affection selection
This commit is contained in:
parent
45126ce908
commit
4870ebc094
|
@ -318,7 +318,7 @@ func desaturate_image(image : Image) -> void:
|
|||
Global.canvas.handle_redo("Draw")
|
||||
|
||||
|
||||
func generate_outline(image : Image, outline_color : Color, thickness : int, diagonal : bool, inside_image : bool) -> void:
|
||||
func generate_outline(image : Image, pixels : Array, outline_color : Color, thickness : int, diagonal : bool, inside_image : bool) -> void:
|
||||
if image.is_invisible():
|
||||
return
|
||||
var new_image := Image.new()
|
||||
|
@ -326,9 +326,7 @@ func generate_outline(image : Image, outline_color : Color, thickness : int, dia
|
|||
new_image.lock()
|
||||
|
||||
Global.canvas.handle_undo("Draw")
|
||||
for xx in image.get_size().x:
|
||||
for yy in image.get_size().y:
|
||||
var pos = Vector2(xx, yy)
|
||||
for pos in pixels:
|
||||
var current_pixel := image.get_pixelv(pos)
|
||||
if current_pixel.a == 0:
|
||||
continue
|
||||
|
|
|
@ -1,14 +1,38 @@
|
|||
extends ConfirmationDialog
|
||||
|
||||
|
||||
var pixels := []
|
||||
|
||||
onready var outline_color = $OptionsContainer/OutlineColor
|
||||
onready var thick_value = $OptionsContainer/ThickValue
|
||||
onready var diagonal_checkbox = $OptionsContainer/DiagonalCheckBox
|
||||
onready var inside_image_checkbox = $OptionsContainer/InsideImageCheckBox
|
||||
onready var selection_checkbox = $OptionsContainer/SelectionCheckBox
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
$OptionsContainer/OutlineColor.get_picker().presets_visible = false
|
||||
outline_color.get_picker().presets_visible = false
|
||||
|
||||
|
||||
func _on_OutlineDialog_about_to_show() -> void:
|
||||
_on_SelectionCheckBox_toggled(selection_checkbox.pressed)
|
||||
|
||||
|
||||
func _on_OutlineDialog_confirmed() -> void:
|
||||
var outline_color : Color = $OptionsContainer/OutlineColor.color
|
||||
var thickness : int = $OptionsContainer/ThickValue.value
|
||||
var diagonal : bool = $OptionsContainer/DiagonalCheckBox.pressed
|
||||
var inside_image : bool = $OptionsContainer/InsideImageCheckBox.pressed
|
||||
var color : Color = outline_color.color
|
||||
var thickness : int = thick_value.value
|
||||
var diagonal : bool = diagonal_checkbox.pressed
|
||||
var inside_image : bool = inside_image_checkbox.pressed
|
||||
|
||||
var image : Image = Global.current_project.frames[Global.current_project.current_frame].cels[Global.current_project.current_layer].image
|
||||
DrawingAlgos.generate_outline(image, outline_color, thickness, diagonal, inside_image)
|
||||
DrawingAlgos.generate_outline(image, pixels, color, thickness, diagonal, inside_image)
|
||||
|
||||
|
||||
func _on_SelectionCheckBox_toggled(button_pressed : bool) -> void:
|
||||
pixels.clear()
|
||||
if button_pressed:
|
||||
pixels = Global.current_project.selected_pixels.duplicate()
|
||||
else:
|
||||
for x in Global.current_project.size.x:
|
||||
for y in Global.current_project.size.y:
|
||||
pixels.append(Vector2(x, y))
|
||||
|
|
|
@ -13,9 +13,9 @@ anchor_top = 0.5
|
|||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -121.0
|
||||
margin_top = -52.0
|
||||
margin_top = -66.0
|
||||
margin_right = 121.0
|
||||
margin_bottom = 24.0
|
||||
margin_bottom = 38.0
|
||||
custom_constants/vseparation = 4
|
||||
custom_constants/hseparation = 4
|
||||
columns = 2
|
||||
|
@ -64,4 +64,14 @@ margin_right = 242.0
|
|||
margin_bottom = 76.0
|
||||
mouse_default_cursor_shape = 2
|
||||
text = "Place inside image"
|
||||
|
||||
[node name="SelectionCheckBox" type="CheckBox" parent="OptionsContainer"]
|
||||
margin_top = 80.0
|
||||
margin_right = 90.0
|
||||
margin_bottom = 104.0
|
||||
mouse_default_cursor_shape = 2
|
||||
pressed = true
|
||||
text = "Only affect selection"
|
||||
[connection signal="about_to_show" from="." to="." method="_on_OutlineDialog_about_to_show"]
|
||||
[connection signal="confirmed" from="." to="." method="_on_OutlineDialog_confirmed"]
|
||||
[connection signal="toggled" from="OptionsContainer/SelectionCheckBox" to="." method="_on_SelectionCheckBox_toggled"]
|
||||
|
|
Loading…
Reference in a new issue