diff --git a/Translations/Translations.pot b/Translations/Translations.pot index 369b569cc..7af0711c1 100644 --- a/Translations/Translations.pot +++ b/Translations/Translations.pot @@ -419,6 +419,9 @@ msgstr "" msgid "Canvas" msgstr "" +msgid "Selection" +msgstr "" + msgid "Shortcuts" msgstr "" @@ -980,6 +983,15 @@ msgstr "" msgid "The transparent checker follow the zoom level of canvas" msgstr "" +msgid "Animated selection borders" +msgstr "" + +msgid "Border color 1:" +msgstr "" + +msgid "Border color 2:" +msgstr "" + msgid "Only custom preset can be modified" msgstr "" diff --git a/src/Autoload/Global.gd b/src/Autoload/Global.gd index c3cdb9461..1783aa5d3 100644 --- a/src/Autoload/Global.gd +++ b/src/Autoload/Global.gd @@ -72,6 +72,11 @@ var checker_color_2 := Color(0.34, 0.35, 0.34, 1) var checker_follow_movement := false var checker_follow_scale := false var tilemode_opacity := 1.0 + +var selection_animated_borders := true +var selection_border_color_1 := Color.white +var selection_border_color_2 := Color.black + var fps_limit_focus := true var fps_limit := 0 diff --git a/src/Preferences/PreferencesDialog.gd b/src/Preferences/PreferencesDialog.gd index 2796a8fe9..cc7f3425a 100644 --- a/src/Preferences/PreferencesDialog.gd +++ b/src/Preferences/PreferencesDialog.gd @@ -37,6 +37,10 @@ var preferences = [ ["checker_follow_scale", "Canvas/CheckerOptions/CheckerFollowScale", "pressed", Global.checker_follow_scale], ["tilemode_opacity", "Canvas/CheckerOptions/TileModeOpacity", "value", Global.tilemode_opacity], + ["selection_animated_borders", "Selection/SelectionOptions/Animate", "pressed", Global.selection_animated_borders], + ["selection_border_color_1", "Selection/SelectionOptions/BorderColor1", "color", Global.selection_border_color_1], + ["selection_border_color_2", "Selection/SelectionOptions/BorderColor2", "color", Global.selection_border_color_2], + ["fps_limit", "Performance/PerformanceContainer/SetFPSLimit", "value", Global.fps_limit], ["fps_limit_focus", "Performance/PerformanceContainer/EnableLimitFPSFocus", "pressed", Global.fps_limit_focus], ] @@ -150,6 +154,12 @@ func preference_update(prop : String) -> void: if prop in ["fps_limit"]: Engine.set_target_fps(Global.fps_limit) + if prop in ["selection_animated_borders", "selection_border_color_1", "selection_border_color_2"]: + Global.canvas.selection.marching_ants_outline.material.set_shader_param("animated", Global.selection_animated_borders) + Global.canvas.selection.marching_ants_outline.material.set_shader_param("first_color", Global.selection_border_color_1) + Global.canvas.selection.marching_ants_outline.material.set_shader_param("second_color", Global.selection_border_color_2) + Global.canvas.selection.update() + Global.config_cache.save("user://cache.ini") @@ -169,6 +179,7 @@ func _on_PreferencesDialog_about_to_show(changed_language := false) -> void: list.add_item(" " + tr("Language")) list.add_item(" " + tr("Interface")) list.add_item(" " + tr("Canvas")) + list.add_item(" " + tr("Selection")) list.add_item(" " + tr("Image")) list.add_item(" " + tr("Shortcuts")) list.add_item(" " + tr("Backup")) @@ -186,7 +197,7 @@ func _on_PreferencesDialog_popup_hide() -> void: func _on_List_item_selected(index : int) -> void: selected_item = index for child in right_side.get_children(): - var content_list = ["Startup", "Languages", "Interface", "Canvas", "Image", "Shortcuts", "Backup", "Performance", "Indicators"] + var content_list = ["Startup", "Languages", "Interface", "Canvas", "Selection", "Image", "Shortcuts", "Backup", "Performance", "Indicators"] if OS.get_name() == "HTML5": content_list.erase("Startup") child.visible = child.name == content_list[index] diff --git a/src/Preferences/PreferencesDialog.tscn b/src/Preferences/PreferencesDialog.tscn index 4a493afc3..2e6f0a420 100644 --- a/src/Preferences/PreferencesDialog.tscn +++ b/src/Preferences/PreferencesDialog.tscn @@ -674,6 +674,67 @@ step = 0.1 value = 1.0 align = 2 +[node name="Selection" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"] +visible = false +margin_top = 28.0 +margin_right = 498.0 +margin_bottom = 76.0 + +[node name="SelectionOptions" type="GridContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer/Selection"] +margin_right = 498.0 +margin_bottom = 48.0 +custom_constants/vseparation = 4 +custom_constants/hseparation = 4 +columns = 3 + +[node name="AnimateLabel" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Selection/SelectionOptions"] +margin_top = 5.0 +margin_right = 176.0 +margin_bottom = 19.0 +rect_min_size = Vector2( 110, 0 ) +mouse_filter = 0 +text = "Animated selection borders" + +[node name="Animate" type="CheckBox" parent="HSplitContainer/ScrollContainer/VBoxContainer/Selection/SelectionOptions"] +margin_left = 180.0 +margin_right = 275.0 +margin_bottom = 24.0 +mouse_default_cursor_shape = 2 +pressed = true +text = "On" + +[node name="BorderColor1Label" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Selection/SelectionOptions"] +margin_left = 279.0 +margin_top = 5.0 +margin_right = 374.0 +margin_bottom = 19.0 +mouse_filter = 0 +text = "Border color 1:" + +[node name="BorderColor1" type="ColorPickerButton" parent="HSplitContainer/ScrollContainer/VBoxContainer/Selection/SelectionOptions"] +margin_top = 28.0 +margin_right = 176.0 +margin_bottom = 48.0 +rect_min_size = Vector2( 64, 20 ) +mouse_default_cursor_shape = 2 +color = Color( 1, 1, 1, 1 ) + +[node name="BorderColor2Label" type="Label" parent="HSplitContainer/ScrollContainer/VBoxContainer/Selection/SelectionOptions"] +margin_left = 180.0 +margin_top = 31.0 +margin_right = 275.0 +margin_bottom = 45.0 +mouse_filter = 0 +text = "Border color 2:" + +[node name="BorderColor2" type="ColorPickerButton" parent="HSplitContainer/ScrollContainer/VBoxContainer/Selection/SelectionOptions"] +margin_left = 279.0 +margin_top = 28.0 +margin_right = 374.0 +margin_bottom = 48.0 +rect_min_size = Vector2( 64, 20 ) +mouse_default_cursor_shape = 2 + [node name="Image" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"] visible = false margin_top = 240.0 diff --git a/src/Shaders/MarchingAntsOutline.shader b/src/Shaders/MarchingAntsOutline.shader index c9294b9c4..0d0d63da2 100644 --- a/src/Shaders/MarchingAntsOutline.shader +++ b/src/Shaders/MarchingAntsOutline.shader @@ -49,4 +49,4 @@ void fragment() { // Erase the texture's pixels in order to only keep the outline visible COLOR.a = 0.0; } -} \ No newline at end of file +} diff --git a/src/UI/Canvas/Canvas.tscn b/src/UI/Canvas/Canvas.tscn index d7302dc96..1f37e1bca 100644 --- a/src/UI/Canvas/Canvas.tscn +++ b/src/UI/Canvas/Canvas.tscn @@ -23,7 +23,7 @@ shader_param/width = 0.05 shader_param/frequency = 200.0 shader_param/stripe_direction = 0.5 -[sub_resource type="ShaderMaterial" id=4] +[sub_resource type="ShaderMaterial" id=3] shader = ExtResource( 10 ) [node name="Canvas" type="Node2D"] @@ -62,5 +62,5 @@ centered = false script = ExtResource( 3 ) [node name="Previews" type="Node2D" parent="."] -material = SubResource( 4 ) +material = SubResource( 3 ) script = ExtResource( 7 ) diff --git a/src/UI/Canvas/Selection.gd b/src/UI/Canvas/Selection.gd index 9651929f7..f357f7bf2 100644 --- a/src/UI/Canvas/Selection.gd +++ b/src/UI/Canvas/Selection.gd @@ -213,12 +213,12 @@ func _draw() -> void: draw_set_transform(_position, rotation, _scale) if big_bounding_rectangle.size != Vector2.ZERO: for gizmo in gizmos: # Draw gizmos - draw_rect(gizmo.rect, Color.black) + draw_rect(gizmo.rect, Global.selection_border_color_2) var filled_rect : Rect2 = gizmo.rect var filled_size : Vector2 = gizmo.rect.size * Vector2(0.2, 0.2) filled_rect.position += filled_size filled_rect.size -= filled_size * 2 - draw_rect(filled_rect, Color.white) # Filled white square + draw_rect(filled_rect, Global.selection_border_color_1) # Filled white square if is_moving_content and !preview_image.is_empty(): draw_texture(preview_image_texture, big_bounding_rectangle.position, Color(1, 1, 1, 0.5))