2019-11-29 22:41:34 +00:00
|
|
|
extends BaseButton
|
2019-09-25 19:59:48 +00:00
|
|
|
|
2020-05-01 17:47:10 +00:00
|
|
|
|
2020-07-09 12:22:17 +00:00
|
|
|
var brush := Brushes.Brush.new()
|
2020-05-01 17:47:10 +00:00
|
|
|
|
2019-09-25 19:59:48 +00:00
|
|
|
|
|
|
|
func _on_BrushButton_pressed() -> void:
|
2020-01-27 22:19:55 +00:00
|
|
|
# Delete the brush on middle mouse press
|
|
|
|
if Input.is_action_just_released("middle_mouse"):
|
|
|
|
_on_DeleteButton_pressed()
|
2020-06-05 14:21:35 +00:00
|
|
|
else:
|
2020-07-09 12:22:17 +00:00
|
|
|
Global.brushes_popup.select_brush(brush)
|
2019-11-11 13:55:28 +00:00
|
|
|
|
2020-05-01 17:47:10 +00:00
|
|
|
|
2019-11-11 13:55:28 +00:00
|
|
|
func _on_DeleteButton_pressed() -> void:
|
2020-07-09 12:22:17 +00:00
|
|
|
if brush.type != Brushes.CUSTOM:
|
2020-06-05 14:21:35 +00:00
|
|
|
return
|
|
|
|
|
2020-07-09 12:22:17 +00:00
|
|
|
Global.brushes_popup.remove_brush(self)
|
2019-11-11 13:55:28 +00:00
|
|
|
|
2020-05-01 17:47:10 +00:00
|
|
|
|
2019-11-11 13:55:28 +00:00
|
|
|
func _on_BrushButton_mouse_entered() -> void:
|
2020-07-09 12:22:17 +00:00
|
|
|
if brush.type == Brushes.CUSTOM:
|
2019-11-11 13:55:28 +00:00
|
|
|
$DeleteButton.visible = true
|
|
|
|
|
2020-05-01 17:47:10 +00:00
|
|
|
|
2019-11-11 13:55:28 +00:00
|
|
|
func _on_BrushButton_mouse_exited() -> void:
|
2020-07-09 12:22:17 +00:00
|
|
|
if brush.type == Brushes.CUSTOM:
|
2019-11-11 13:55:28 +00:00
|
|
|
$DeleteButton.visible = false
|