1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-19 01:29:49 +00:00

Let the user change border color and toggle the marching ants effect in the preferences

This commit is contained in:
Manolis Papadeas 2021-05-28 03:46:16 +03:00
parent 5a93af7477
commit 6d2f02b782
7 changed files with 95 additions and 6 deletions

View file

@ -419,6 +419,9 @@ msgstr ""
msgid "Canvas" msgid "Canvas"
msgstr "" msgstr ""
msgid "Selection"
msgstr ""
msgid "Shortcuts" msgid "Shortcuts"
msgstr "" msgstr ""
@ -980,6 +983,15 @@ msgstr ""
msgid "The transparent checker follow the zoom level of canvas" msgid "The transparent checker follow the zoom level of canvas"
msgstr "" msgstr ""
msgid "Animated selection borders"
msgstr ""
msgid "Border color 1:"
msgstr ""
msgid "Border color 2:"
msgstr ""
msgid "Only custom preset can be modified" msgid "Only custom preset can be modified"
msgstr "" msgstr ""

View file

@ -72,6 +72,11 @@ var checker_color_2 := Color(0.34, 0.35, 0.34, 1)
var checker_follow_movement := false var checker_follow_movement := false
var checker_follow_scale := false var checker_follow_scale := false
var tilemode_opacity := 1.0 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_focus := true
var fps_limit := 0 var fps_limit := 0

View file

@ -37,6 +37,10 @@ var preferences = [
["checker_follow_scale", "Canvas/CheckerOptions/CheckerFollowScale", "pressed", Global.checker_follow_scale], ["checker_follow_scale", "Canvas/CheckerOptions/CheckerFollowScale", "pressed", Global.checker_follow_scale],
["tilemode_opacity", "Canvas/CheckerOptions/TileModeOpacity", "value", Global.tilemode_opacity], ["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", "Performance/PerformanceContainer/SetFPSLimit", "value", Global.fps_limit],
["fps_limit_focus", "Performance/PerformanceContainer/EnableLimitFPSFocus", "pressed", Global.fps_limit_focus], ["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"]: if prop in ["fps_limit"]:
Engine.set_target_fps(Global.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") 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("Language"))
list.add_item(" " + tr("Interface")) list.add_item(" " + tr("Interface"))
list.add_item(" " + tr("Canvas")) list.add_item(" " + tr("Canvas"))
list.add_item(" " + tr("Selection"))
list.add_item(" " + tr("Image")) list.add_item(" " + tr("Image"))
list.add_item(" " + tr("Shortcuts")) list.add_item(" " + tr("Shortcuts"))
list.add_item(" " + tr("Backup")) list.add_item(" " + tr("Backup"))
@ -186,7 +197,7 @@ func _on_PreferencesDialog_popup_hide() -> void:
func _on_List_item_selected(index : int) -> void: func _on_List_item_selected(index : int) -> void:
selected_item = index selected_item = index
for child in right_side.get_children(): 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": if OS.get_name() == "HTML5":
content_list.erase("Startup") content_list.erase("Startup")
child.visible = child.name == content_list[index] child.visible = child.name == content_list[index]

View file

@ -674,6 +674,67 @@ step = 0.1
value = 1.0 value = 1.0
align = 2 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"] [node name="Image" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"]
visible = false visible = false
margin_top = 240.0 margin_top = 240.0

View file

@ -23,7 +23,7 @@ shader_param/width = 0.05
shader_param/frequency = 200.0 shader_param/frequency = 200.0
shader_param/stripe_direction = 0.5 shader_param/stripe_direction = 0.5
[sub_resource type="ShaderMaterial" id=4] [sub_resource type="ShaderMaterial" id=3]
shader = ExtResource( 10 ) shader = ExtResource( 10 )
[node name="Canvas" type="Node2D"] [node name="Canvas" type="Node2D"]
@ -62,5 +62,5 @@ centered = false
script = ExtResource( 3 ) script = ExtResource( 3 )
[node name="Previews" type="Node2D" parent="."] [node name="Previews" type="Node2D" parent="."]
material = SubResource( 4 ) material = SubResource( 3 )
script = ExtResource( 7 ) script = ExtResource( 7 )

View file

@ -213,12 +213,12 @@ func _draw() -> void:
draw_set_transform(_position, rotation, _scale) draw_set_transform(_position, rotation, _scale)
if big_bounding_rectangle.size != Vector2.ZERO: if big_bounding_rectangle.size != Vector2.ZERO:
for gizmo in gizmos: # Draw gizmos 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_rect : Rect2 = gizmo.rect
var filled_size : Vector2 = gizmo.rect.size * Vector2(0.2, 0.2) var filled_size : Vector2 = gizmo.rect.size * Vector2(0.2, 0.2)
filled_rect.position += filled_size filled_rect.position += filled_size
filled_rect.size -= filled_size * 2 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(): if is_moving_content and !preview_image.is_empty():
draw_texture(preview_image_texture, big_bounding_rectangle.position, Color(1, 1, 1, 0.5)) draw_texture(preview_image_texture, big_bounding_rectangle.position, Color(1, 1, 1, 0.5))