mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-19 01:29:49 +00:00
Added more options to the OutlineDialog
This commit is contained in:
parent
7e3fd089e4
commit
bedede5970
|
@ -1,6 +1,9 @@
|
||||||
extends ConfirmationDialog
|
extends ConfirmationDialog
|
||||||
|
|
||||||
|
|
||||||
|
enum {CEL, FRAME, ALL_FRAMES, ALL_PROJECTS}
|
||||||
|
|
||||||
|
var affect : int = CEL
|
||||||
var pixels := []
|
var pixels := []
|
||||||
var current_cel : Image
|
var current_cel : Image
|
||||||
var preview_image : Image
|
var preview_image : Image
|
||||||
|
@ -13,9 +16,6 @@ var inside_image := false
|
||||||
|
|
||||||
onready var preview : TextureRect = $VBoxContainer/Preview
|
onready var preview : TextureRect = $VBoxContainer/Preview
|
||||||
onready var outline_color = $VBoxContainer/OptionsContainer/OutlineColor
|
onready var outline_color = $VBoxContainer/OptionsContainer/OutlineColor
|
||||||
#onready var thick_value = $VBoxContainer/OptionsContainer/ThickValue
|
|
||||||
#onready var diagonal_checkbox = $VBoxContainer/OptionsContainer/DiagonalCheckBox
|
|
||||||
#onready var inside_image_checkbox = $VBoxContainer/OptionsContainer/InsideImageCheckBox
|
|
||||||
onready var selection_checkbox = $VBoxContainer/OptionsContainer/SelectionCheckBox
|
onready var selection_checkbox = $VBoxContainer/OptionsContainer/SelectionCheckBox
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,9 +33,38 @@ func _on_OutlineDialog_about_to_show() -> void:
|
||||||
|
|
||||||
|
|
||||||
func _on_OutlineDialog_confirmed() -> void:
|
func _on_OutlineDialog_confirmed() -> void:
|
||||||
Global.canvas.handle_undo("Draw")
|
if affect == CEL:
|
||||||
DrawingAlgos.generate_outline(current_cel, pixels, color, thickness, diagonal, inside_image)
|
Global.canvas.handle_undo("Draw")
|
||||||
Global.canvas.handle_redo("Draw")
|
DrawingAlgos.generate_outline(current_cel, pixels, color, thickness, diagonal, inside_image)
|
||||||
|
Global.canvas.handle_redo("Draw")
|
||||||
|
elif affect == FRAME:
|
||||||
|
Global.canvas.handle_undo("Draw", Global.current_project, -1)
|
||||||
|
for cel in Global.current_project.frames[Global.current_project.current_frame].cels:
|
||||||
|
DrawingAlgos.generate_outline(cel.image, pixels, color, thickness, diagonal, inside_image)
|
||||||
|
Global.canvas.handle_redo("Draw", Global.current_project, -1)
|
||||||
|
|
||||||
|
elif affect == ALL_FRAMES:
|
||||||
|
Global.canvas.handle_undo("Draw", Global.current_project, -1, -1)
|
||||||
|
for frame in Global.current_project.frames:
|
||||||
|
for cel in frame.cels:
|
||||||
|
DrawingAlgos.generate_outline(cel.image, pixels, color, thickness, diagonal, inside_image)
|
||||||
|
Global.canvas.handle_redo("Draw", Global.current_project, -1, -1)
|
||||||
|
|
||||||
|
elif affect == ALL_PROJECTS:
|
||||||
|
for project in Global.projects:
|
||||||
|
var _pixels := []
|
||||||
|
if selection_checkbox.pressed:
|
||||||
|
_pixels = project.selected_pixels.duplicate()
|
||||||
|
else:
|
||||||
|
for x in project.size.x:
|
||||||
|
for y in project.size.y:
|
||||||
|
_pixels.append(Vector2(x, y))
|
||||||
|
|
||||||
|
Global.canvas.handle_undo("Draw", project, -1, -1)
|
||||||
|
for frame in project.frames:
|
||||||
|
for cel in frame.cels:
|
||||||
|
DrawingAlgos.generate_outline(cel.image, _pixels, color, thickness, diagonal, inside_image)
|
||||||
|
Global.canvas.handle_redo("Draw", project, -1, -1)
|
||||||
|
|
||||||
|
|
||||||
func _on_SelectionCheckBox_toggled(button_pressed : bool) -> void:
|
func _on_SelectionCheckBox_toggled(button_pressed : bool) -> void:
|
||||||
|
@ -75,3 +104,7 @@ func update_preview() -> void:
|
||||||
DrawingAlgos.generate_outline(preview_image, pixels, color, thickness, diagonal, inside_image)
|
DrawingAlgos.generate_outline(preview_image, pixels, color, thickness, diagonal, inside_image)
|
||||||
preview_texture.create_from_image(preview_image, 0)
|
preview_texture.create_from_image(preview_image, 0)
|
||||||
preview.texture = preview_texture
|
preview.texture = preview_texture
|
||||||
|
|
||||||
|
|
||||||
|
func _on_AffectOptionButton_item_selected(index : int) -> void:
|
||||||
|
affect = index
|
||||||
|
|
|
@ -21,14 +21,15 @@ __meta__ = {
|
||||||
|
|
||||||
[node name="Preview" type="TextureRect" parent="VBoxContainer"]
|
[node name="Preview" type="TextureRect" parent="VBoxContainer"]
|
||||||
margin_right = 312.0
|
margin_right = 312.0
|
||||||
|
margin_bottom = 200.0
|
||||||
rect_min_size = Vector2( 200, 200 )
|
rect_min_size = Vector2( 200, 200 )
|
||||||
expand = true
|
expand = true
|
||||||
stretch_mode = 6
|
stretch_mode = 6
|
||||||
|
|
||||||
[node name="OptionsContainer" type="GridContainer" parent="VBoxContainer"]
|
[node name="OptionsContainer" type="GridContainer" parent="VBoxContainer"]
|
||||||
margin_top = 4.0
|
margin_top = 204.0
|
||||||
margin_right = 312.0
|
margin_right = 312.0
|
||||||
margin_bottom = 108.0
|
margin_bottom = 308.0
|
||||||
custom_constants/vseparation = 4
|
custom_constants/vseparation = 4
|
||||||
custom_constants/hseparation = 4
|
custom_constants/hseparation = 4
|
||||||
columns = 2
|
columns = 2
|
||||||
|
@ -88,6 +89,14 @@ margin_bottom = 104.0
|
||||||
mouse_default_cursor_shape = 2
|
mouse_default_cursor_shape = 2
|
||||||
pressed = true
|
pressed = true
|
||||||
text = "Only affect selection"
|
text = "Only affect selection"
|
||||||
|
|
||||||
|
[node name="AffectOptionButton" type="OptionButton" parent="VBoxContainer/OptionsContainer"]
|
||||||
|
margin_right = 29.0
|
||||||
|
margin_bottom = 20.0
|
||||||
|
mouse_default_cursor_shape = 2
|
||||||
|
text = "Current cel"
|
||||||
|
items = [ "Current cel", null, false, 0, null, "Current frame", null, false, 1, null, "All frames", null, false, 2, null, "All projects", null, false, 3, null ]
|
||||||
|
selected = 0
|
||||||
[connection signal="about_to_show" from="." to="." method="_on_OutlineDialog_about_to_show"]
|
[connection signal="about_to_show" from="." to="." method="_on_OutlineDialog_about_to_show"]
|
||||||
[connection signal="confirmed" from="." to="." method="_on_OutlineDialog_confirmed"]
|
[connection signal="confirmed" from="." to="." method="_on_OutlineDialog_confirmed"]
|
||||||
[connection signal="value_changed" from="VBoxContainer/OptionsContainer/ThickValue" to="." method="_on_ThickValue_value_changed"]
|
[connection signal="value_changed" from="VBoxContainer/OptionsContainer/ThickValue" to="." method="_on_ThickValue_value_changed"]
|
||||||
|
@ -95,3 +104,4 @@ text = "Only affect selection"
|
||||||
[connection signal="toggled" from="VBoxContainer/OptionsContainer/DiagonalCheckBox" to="." method="_on_DiagonalCheckBox_toggled"]
|
[connection signal="toggled" from="VBoxContainer/OptionsContainer/DiagonalCheckBox" to="." method="_on_DiagonalCheckBox_toggled"]
|
||||||
[connection signal="toggled" from="VBoxContainer/OptionsContainer/InsideImageCheckBox" to="." method="_on_InsideImageCheckBox_toggled"]
|
[connection signal="toggled" from="VBoxContainer/OptionsContainer/InsideImageCheckBox" to="." method="_on_InsideImageCheckBox_toggled"]
|
||||||
[connection signal="toggled" from="VBoxContainer/OptionsContainer/SelectionCheckBox" to="." method="_on_SelectionCheckBox_toggled"]
|
[connection signal="toggled" from="VBoxContainer/OptionsContainer/SelectionCheckBox" to="." method="_on_SelectionCheckBox_toggled"]
|
||||||
|
[connection signal="item_selected" from="VBoxContainer/OptionsContainer/AffectOptionButton" to="." method="_on_AffectOptionButton_item_selected"]
|
||||||
|
|
Loading…
Reference in a new issue