2020-08-25 16:49:18 +00:00
|
|
|
extends ImageEffect
|
2020-07-18 14:23:36 +00:00
|
|
|
|
|
|
|
|
2020-08-08 16:02:49 +00:00
|
|
|
onready var color1 : ColorPickerButton = $VBoxContainer/OptionsContainer/ColorsContainer/ColorPickerButton
|
|
|
|
onready var color2 : ColorPickerButton = $VBoxContainer/OptionsContainer/ColorsContainer/ColorPickerButton2
|
|
|
|
onready var steps : SpinBox = $VBoxContainer/OptionsContainer/StepSpinBox
|
|
|
|
onready var direction : OptionButton = $VBoxContainer/OptionsContainer/DirectionOptionButton
|
2020-07-18 14:23:36 +00:00
|
|
|
|
|
|
|
|
2020-07-27 01:47:29 +00:00
|
|
|
func _ready() -> void:
|
|
|
|
color1.get_picker().presets_visible = false
|
|
|
|
color2.get_picker().presets_visible = false
|
|
|
|
|
|
|
|
|
2020-08-25 16:49:18 +00:00
|
|
|
func set_nodes() -> void:
|
|
|
|
preview = $VBoxContainer/Preview
|
|
|
|
selection_checkbox = $VBoxContainer/OptionsContainer/SelectionCheckBox
|
|
|
|
affect_option_button = $VBoxContainer/OptionsContainer/AffectOptionButton
|
2020-07-18 14:23:36 +00:00
|
|
|
|
|
|
|
|
2020-08-27 22:20:07 +00:00
|
|
|
func commit_action(_cel : Image, _pixels : Array, _project : Project = Global.current_project) -> void:
|
|
|
|
DrawingAlgos.generate_gradient(_cel, [color1.color, color2.color], steps.value, direction.selected, _pixels)
|
2020-07-18 14:23:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_ColorPickerButton_color_changed(_color : Color) -> void:
|
|
|
|
update_preview()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_ColorPickerButton2_color_changed(_color : Color) -> void:
|
|
|
|
update_preview()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_StepSpinBox_value_changed(_value : int) -> void:
|
|
|
|
update_preview()
|
|
|
|
|
|
|
|
|
2020-08-25 16:49:18 +00:00
|
|
|
func _on_DirectionOptionButton_item_selected(_index : int) -> void:
|
2020-08-08 16:02:49 +00:00
|
|
|
update_preview()
|