diff --git a/Translations/Translations.pot b/Translations/Translations.pot index 4ca3efd07..f1dcc5b77 100644 --- a/Translations/Translations.pot +++ b/Translations/Translations.pot @@ -1322,13 +1322,13 @@ msgstr "" msgid "0: Color from the brush itself, 100: the currently selected color" msgstr "" -msgid "Fill area:" +#. Found in the bucket tool options, to let users toggle if it should fill colors continuously or not. +msgid "Fill continuously" msgstr "" -msgid "Same color area" -msgstr "" - -msgid "Same color pixels" +#. Hint tooltip of the "Fill continuously" checkbox, found in the bucket tool options. +msgid "If enabled, it fills the continuous area with the selected color.\n" +"If disabled, it replaces all pixels of the same color with the selected color." msgstr "" msgid "Fill with:" diff --git a/src/Tools/Bucket.gd b/src/Tools/Bucket.gd index 41bd609ef..a3a6c04dd 100644 --- a/src/Tools/Bucket.gd +++ b/src/Tools/Bucket.gd @@ -5,7 +5,7 @@ const COLOR_REPLACE_SHADER := preload("res://src/Shaders/ColorReplace.shader") var _prev_mode := 0 var _pattern: Patterns.Pattern var _similarity := 100 -var _fill_area := 0 +var _fill_area := true var _fill_with := 0 var _offset_x := 0 var _offset_y := 0 @@ -14,28 +14,22 @@ var _allegro_flood_segments: Array # results array per image while flooding var _allegro_image_segments: Array +onready var fill_check_box: CheckBox = $FillCheckBox + func _ready() -> void: update_pattern() func _input(event: InputEvent) -> void: - var options: OptionButton = $FillAreaOptions - - if event.is_action_pressed("change_tool_mode"): - _prev_mode = options.selected - if event.is_action("change_tool_mode"): - options.selected = _prev_mode ^ 1 - _fill_area = options.selected - $Similarity.visible = (_fill_area == 1) - if event.is_action_released("change_tool_mode"): - options.selected = _prev_mode - _fill_area = options.selected - $Similarity.visible = (_fill_area == 1) + if event.is_action_pressed("change_tool_mode") or event.is_action_released("change_tool_mode"): + fill_check_box.pressed = not fill_check_box.pressed + _fill_area = fill_check_box.pressed + $Similarity.visible = not _fill_area -func _on_FillAreaOptions_item_selected(index: int) -> void: - _fill_area = index +func _on_FillCheckBox_toggled(button_pressed: bool) -> void: + _fill_area = button_pressed update_config() save_config() @@ -111,9 +105,9 @@ func set_config(config: Dictionary) -> void: func update_config() -> void: - $FillAreaOptions.selected = _fill_area + $FillCheckBox.pressed = _fill_area $FillWithOptions.selected = _fill_with - $Similarity.visible = (_fill_area == 1) + $Similarity.visible = not _fill_area $Similarity/Value.value = _similarity $Similarity/Slider.value = _similarity $FillPattern.visible = _fill_with == 1 @@ -154,7 +148,7 @@ func draw_start(position: Vector2) -> void: ): return var undo_data = _get_undo_data() - if _fill_area == 0: + if _fill_area: fill_in_area(position) else: fill_in_color(position) diff --git a/src/Tools/Bucket.tscn b/src/Tools/Bucket.tscn index 6d3014bc4..8f80f2210 100644 --- a/src/Tools/Bucket.tscn +++ b/src/Tools/Bucket.tscn @@ -27,28 +27,21 @@ margin_bottom = 105.0 script = ExtResource( 3 ) [node name="Label" parent="." index="0"] -margin_right = 131.0 +margin_right = 133.0 -[node name="FillArea" type="Label" parent="." index="1"] -margin_left = 38.0 +[node name="FillCheckBox" type="CheckBox" parent="." index="1"] margin_top = 18.0 -margin_right = 92.0 -margin_bottom = 32.0 +margin_right = 133.0 +margin_bottom = 42.0 +hint_tooltip = "If enabled, it fills the continuous area with the selected color. +If disabled, it replaces all pixels of the same color with the selected color." mouse_default_cursor_shape = 2 size_flags_horizontal = 4 -text = "Fill area:" +pressed = true +text = "Fill continuously" +align = 1 -[node name="FillAreaOptions" type="OptionButton" parent="." index="2"] -margin_top = 36.0 -margin_right = 131.0 -margin_bottom = 56.0 -mouse_default_cursor_shape = 2 -size_flags_horizontal = 4 -text = "Same color area" -items = [ "Same color area", null, false, 0, null, "Same color pixels", null, false, 1, null ] -selected = 0 - -[node name="Similarity" type="VBoxContainer" parent="." index="3"] +[node name="Similarity" type="VBoxContainer" parent="." index="2"] visible = false margin_top = 60.0 margin_right = 131.0 @@ -96,26 +89,26 @@ __meta__ = { "_editor_description_": "" } -[node name="FillWith" type="Label" parent="." index="4"] -margin_left = 38.0 -margin_top = 60.0 -margin_right = 92.0 -margin_bottom = 74.0 +[node name="FillWith" type="Label" parent="." index="3"] +margin_left = 39.0 +margin_top = 46.0 +margin_right = 93.0 +margin_bottom = 60.0 size_flags_horizontal = 4 text = "Fill with:" -[node name="FillWithOptions" type="OptionButton" parent="." index="5"] -margin_left = 5.0 -margin_top = 78.0 -margin_right = 126.0 -margin_bottom = 98.0 +[node name="FillWithOptions" type="OptionButton" parent="." index="4"] +margin_left = 6.0 +margin_top = 64.0 +margin_right = 127.0 +margin_bottom = 84.0 mouse_default_cursor_shape = 2 size_flags_horizontal = 4 text = "Selected Color" items = [ "Selected Color", null, false, 0, null, "Pattern", null, false, 1, null ] selected = 0 -[node name="FillPattern" type="VBoxContainer" parent="." index="6"] +[node name="FillPattern" type="VBoxContainer" parent="." index="5"] visible = false margin_left = 22.0 margin_top = 102.0 @@ -187,7 +180,7 @@ margin_right = 85.0 margin_bottom = 24.0 mouse_default_cursor_shape = 2 -[connection signal="item_selected" from="FillAreaOptions" to="." method="_on_FillAreaOptions_item_selected"] +[connection signal="toggled" from="FillCheckBox" to="." method="_on_FillCheckBox_toggled"] [connection signal="value_changed" from="Similarity/Value" to="." method="_on_Value_value_changed"] [connection signal="value_changed" from="Similarity/Slider" to="." method="_on_Slider_value_changed"] [connection signal="item_selected" from="FillWithOptions" to="." method="_on_FillWithOptions_item_selected"]