diff --git a/assets/graphics/misc/x_minus_y_mirror_off.png b/assets/graphics/misc/x_minus_y_mirror_off.png new file mode 100644 index 000000000..3d76d8f87 Binary files /dev/null and b/assets/graphics/misc/x_minus_y_mirror_off.png differ diff --git a/assets/graphics/misc/x_minus_y_mirror_off.png.import b/assets/graphics/misc/x_minus_y_mirror_off.png.import new file mode 100644 index 000000000..231b1e836 --- /dev/null +++ b/assets/graphics/misc/x_minus_y_mirror_off.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://1kj5gcswa3t2" +path="res://.godot/imported/x_minus_y_mirror_off.png-da237e3b5b7ad1dfef1c935385f53dc5.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/misc/x_minus_y_mirror_off.png" +dest_files=["res://.godot/imported/x_minus_y_mirror_off.png-da237e3b5b7ad1dfef1c935385f53dc5.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/graphics/misc/x_minus_y_mirror_on.png b/assets/graphics/misc/x_minus_y_mirror_on.png new file mode 100644 index 000000000..7532906e6 Binary files /dev/null and b/assets/graphics/misc/x_minus_y_mirror_on.png differ diff --git a/assets/graphics/misc/x_minus_y_mirror_on.png.import b/assets/graphics/misc/x_minus_y_mirror_on.png.import new file mode 100644 index 000000000..aa0b81718 --- /dev/null +++ b/assets/graphics/misc/x_minus_y_mirror_on.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dn14bkxwdqsfk" +path="res://.godot/imported/x_minus_y_mirror_on.png-0e9186904d8241facc4a0c1190f32c53.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/misc/x_minus_y_mirror_on.png" +dest_files=["res://.godot/imported/x_minus_y_mirror_on.png-0e9186904d8241facc4a0c1190f32c53.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/graphics/misc/xy_mirror_off.png b/assets/graphics/misc/xy_mirror_off.png new file mode 100644 index 000000000..c86917a91 Binary files /dev/null and b/assets/graphics/misc/xy_mirror_off.png differ diff --git a/assets/graphics/misc/xy_mirror_off.png.import b/assets/graphics/misc/xy_mirror_off.png.import new file mode 100644 index 000000000..fbeb136dc --- /dev/null +++ b/assets/graphics/misc/xy_mirror_off.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://dlxhm0ronna25" +path="res://.godot/imported/xy_mirror_off.png-8d2fd9ebdf350f0cd384fdf39fed4ec1.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/misc/xy_mirror_off.png" +dest_files=["res://.godot/imported/xy_mirror_off.png-8d2fd9ebdf350f0cd384fdf39fed4ec1.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/assets/graphics/misc/xy_mirror_on.png b/assets/graphics/misc/xy_mirror_on.png new file mode 100644 index 000000000..5f6d08128 Binary files /dev/null and b/assets/graphics/misc/xy_mirror_on.png differ diff --git a/assets/graphics/misc/xy_mirror_on.png.import b/assets/graphics/misc/xy_mirror_on.png.import new file mode 100644 index 000000000..1b8d4d502 --- /dev/null +++ b/assets/graphics/misc/xy_mirror_on.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://cu2uqp5oupt80" +path="res://.godot/imported/xy_mirror_on.png-95d443df3b6d17add41283bdd720ea7e.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/misc/xy_mirror_on.png" +dest_files=["res://.godot/imported/xy_mirror_on.png-95d443df3b6d17add41283bdd720ea7e.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/src/Autoload/Global.gd b/src/Autoload/Global.gd index a32016986..affc6af29 100644 --- a/src/Autoload/Global.gd +++ b/src/Autoload/Global.gd @@ -184,7 +184,7 @@ var show_x_symmetry_axis := false ## If true, the y symmetry guide ( | ) is visible. var show_y_symmetry_axis := false ## If true, the x=y symmetry guide ( / ) is visible. -var show_x_y_symmetry_axis := false +var show_xy_symmetry_axis := false ## If true, the x==y symmetry guide ( \ ) is visible. var show_x_minus_y_symmetry_axis := false diff --git a/src/Autoload/Tools.gd b/src/Autoload/Tools.gd index 12f0b98a7..f6d9f86fb 100644 --- a/src/Autoload/Tools.gd +++ b/src/Autoload/Tools.gd @@ -15,8 +15,8 @@ const X_MINUS_Y_LINE := Vector2(0.707107, 0.707107) var picking_color_for := MOUSE_BUTTON_LEFT var horizontal_mirror := false var vertical_mirror := false -var diagonal_mirror := false -var diagonal_opposite_mirror := false +var diagonal_xy_mirror := false +var diagonal_x_minus_y_mirror := false var pixel_perfect := false var alpha_locked := false @@ -534,23 +534,23 @@ func get_mirrored_positions( if vertical_mirror: positions.append(calculate_mirror_vertical(mirror_x, project, offset)) else: - if diagonal_mirror: + if diagonal_xy_mirror: positions.append(calculate_mirror_xy(mirror_x, project)) - if diagonal_opposite_mirror: + if diagonal_x_minus_y_mirror: positions.append(calculate_mirror_x_minus_y(mirror_x, project)) if vertical_mirror: var mirror_y := calculate_mirror_vertical(pos, project, offset) positions.append(mirror_y) - if diagonal_mirror: + if diagonal_xy_mirror: positions.append(calculate_mirror_xy(mirror_y, project)) - if diagonal_opposite_mirror: + if diagonal_x_minus_y_mirror: positions.append(calculate_mirror_x_minus_y(mirror_y, project)) - if diagonal_mirror: + if diagonal_xy_mirror: var mirror_diagonal := calculate_mirror_xy(pos, project) positions.append(mirror_diagonal) if not horizontal_mirror and not vertical_mirror: positions.append(calculate_mirror_x_minus_y(mirror_diagonal, project)) - if diagonal_opposite_mirror: + if diagonal_x_minus_y_mirror: positions.append(calculate_mirror_x_minus_y(pos, project)) return positions diff --git a/src/Classes/Drawers.gd b/src/Classes/Drawers.gd index 1539a1908..caa005ebf 100644 --- a/src/Classes/Drawers.gd +++ b/src/Classes/Drawers.gd @@ -87,8 +87,8 @@ func set_pixel(image: Image, position: Vector2i, color: Color, ignore_mirroring if ( not Tools.horizontal_mirror and not Tools.vertical_mirror - and not Tools.diagonal_mirror - and not Tools.diagonal_opposite_mirror + and not Tools.diagonal_xy_mirror + and not Tools.diagonal_x_minus_y_mirror ): return # Handle mirroring diff --git a/src/UI/Canvas/Rulers/Guide.gd b/src/UI/Canvas/Rulers/Guide.gd index a159b0659..e874af01b 100644 --- a/src/UI/Canvas/Rulers/Guide.gd +++ b/src/UI/Canvas/Rulers/Guide.gd @@ -234,7 +234,7 @@ func _project_switched() -> void: elif type == Types.VERTICAL: visible = Global.show_y_symmetry_axis and Global.show_guides elif type == Types.XY: - visible = Global.show_x_y_symmetry_axis and Global.show_guides + visible = Global.show_xy_symmetry_axis and Global.show_guides elif type == Types.X_MINUS_Y: visible = Global.show_x_minus_y_symmetry_axis and Global.show_guides else: diff --git a/src/UI/GlobalToolOptions/GlobalToolOptions.gd b/src/UI/GlobalToolOptions/GlobalToolOptions.gd index 8a1a1415b..275cecad6 100644 --- a/src/UI/GlobalToolOptions/GlobalToolOptions.gd +++ b/src/UI/GlobalToolOptions/GlobalToolOptions.gd @@ -3,6 +3,8 @@ extends PanelContainer @onready var grid_container: GridContainer = find_child("GridContainer") @onready var horizontal_mirror: BaseButton = grid_container.get_node("Horizontal") @onready var vertical_mirror: BaseButton = grid_container.get_node("Vertical") +@onready var diagonal_xy_mirror: BaseButton = grid_container.get_node("DiagonalXY") +@onready var diagonal_x_minus_y_mirror: BaseButton = grid_container.get_node("DiagonalXMinusY") @onready var pixel_perfect: BaseButton = grid_container.get_node("PixelPerfect") @onready var alpha_lock: BaseButton = grid_container.get_node("AlphaLock") @onready var dynamics: Button = $"%Dynamics" @@ -39,25 +41,25 @@ func _on_resized() -> void: grid_container.columns = column_n -func _on_Horizontal_toggled(button_pressed: bool) -> void: - Tools.horizontal_mirror = button_pressed - Global.config_cache.set_value("tools", "horizontal_mirror", button_pressed) - Global.show_y_symmetry_axis = button_pressed +func _on_Horizontal_toggled(toggled_on: bool) -> void: + Tools.horizontal_mirror = toggled_on + Global.config_cache.set_value("tools", "horizontal_mirror", toggled_on) + Global.show_y_symmetry_axis = toggled_on Global.current_project.y_symmetry_axis.visible = ( Global.show_y_symmetry_axis and Global.show_guides ) var texture_button: TextureRect = horizontal_mirror.get_node("TextureRect") var file_name := "horizontal_mirror_on.png" - if !button_pressed: + if not toggled_on: file_name = "horizontal_mirror_off.png" Global.change_button_texturerect(texture_button, file_name) -func _on_Vertical_toggled(button_pressed: bool) -> void: - Tools.vertical_mirror = button_pressed - Global.config_cache.set_value("tools", "vertical_mirror", button_pressed) - Global.show_x_symmetry_axis = button_pressed +func _on_Vertical_toggled(toggled_on: bool) -> void: + Tools.vertical_mirror = toggled_on + Global.config_cache.set_value("tools", "vertical_mirror", toggled_on) + Global.show_x_symmetry_axis = toggled_on # If the button is not pressed but another button is, keep the symmetry guide visible Global.current_project.x_symmetry_axis.visible = ( Global.show_x_symmetry_axis and Global.show_guides @@ -65,11 +67,43 @@ func _on_Vertical_toggled(button_pressed: bool) -> void: var texture_button: TextureRect = vertical_mirror.get_node("TextureRect") var file_name := "vertical_mirror_on.png" - if !button_pressed: + if not toggled_on: file_name = "vertical_mirror_off.png" Global.change_button_texturerect(texture_button, file_name) +func _on_diagonal_xy_toggled(toggled_on: bool) -> void: + Tools.diagonal_xy_mirror = toggled_on + Global.config_cache.set_value("tools", "diagonal_xy_mirror", toggled_on) + Global.show_xy_symmetry_axis = toggled_on + # If the button is not pressed but another button is, keep the symmetry guide visible + Global.current_project.diagonal_xy_symmetry_axis.visible = ( + Global.show_xy_symmetry_axis and Global.show_guides + ) + + var texture_button: TextureRect = diagonal_xy_mirror.get_node("TextureRect") + var file_name := "xy_mirror_on.png" + if not toggled_on: + file_name = "xy_mirror_off.png" + Global.change_button_texturerect(texture_button, file_name) + + +func _on_diagonal_x_minus_y_toggled(toggled_on: bool) -> void: + Tools.diagonal_x_minus_y_mirror = toggled_on + Global.config_cache.set_value("tools", "diagonal_x_minus_y_mirror", toggled_on) + Global.show_x_minus_y_symmetry_axis = toggled_on + # If the button is not pressed but another button is, keep the symmetry guide visible + Global.current_project.diagonal_x_minus_y_symmetry_axis.visible = ( + Global.show_x_minus_y_symmetry_axis and Global.show_guides + ) + + var texture_button: TextureRect = diagonal_x_minus_y_mirror.get_node("TextureRect") + var file_name := "x_minus_y_mirror_on.png" + if not toggled_on: + file_name = "x_minus_y_mirror_off.png" + Global.change_button_texturerect(texture_button, file_name) + + func _on_PixelPerfect_toggled(button_pressed: bool) -> void: Tools.pixel_perfect = button_pressed Global.config_cache.set_value("tools", "pixel_perfect", button_pressed) diff --git a/src/UI/GlobalToolOptions/GlobalToolOptions.tscn b/src/UI/GlobalToolOptions/GlobalToolOptions.tscn index 012f227e5..71890881e 100644 --- a/src/UI/GlobalToolOptions/GlobalToolOptions.tscn +++ b/src/UI/GlobalToolOptions/GlobalToolOptions.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=25 format=3 uid="uid://wo0hqxkst808"] +[gd_scene load_steps=27 format=3 uid="uid://wo0hqxkst808"] [ext_resource type="Texture2D" uid="uid://cjrokejjsp5dm" path="res://assets/graphics/misc/horizontal_mirror_off.png" id="1"] [ext_resource type="Texture2D" uid="uid://hiduvaa73fr6" path="res://assets/graphics/misc/vertical_mirror_off.png" id="2"] @@ -6,8 +6,10 @@ [ext_resource type="Texture2D" uid="uid://ct8wn8m6x4m54" path="res://assets/graphics/misc/value_arrow.svg" id="3_faalk"] [ext_resource type="Texture2D" uid="uid://22h12g8p3jtd" path="res://assets/graphics/misc/pixel_perfect_off.png" id="4"] [ext_resource type="Script" path="res://src/UI/Nodes/ValueSlider.gd" id="5"] +[ext_resource type="Texture2D" uid="uid://dlxhm0ronna25" path="res://assets/graphics/misc/xy_mirror_off.png" id="5_hcmgx"] [ext_resource type="Texture2D" uid="uid://j8eywwy082a4" path="res://assets/graphics/misc/alpha_lock_off.png" id="5_jv20x"] [ext_resource type="Texture2D" uid="uid://dg3dumyfj1682" path="res://assets/graphics/misc/dynamics.png" id="6"] +[ext_resource type="Texture2D" uid="uid://1kj5gcswa3t2" path="res://assets/graphics/misc/x_minus_y_mirror_off.png" id="6_sw8fy"] [ext_resource type="Texture2D" uid="uid://di8au2u87jgv5" path="res://assets/graphics/misc/uncheck.png" id="7"] [ext_resource type="Script" path="res://src/UI/GlobalToolOptions/DynamicsPanel.gd" id="7_iqcw1"] [ext_resource type="PackedScene" uid="uid://bmsc0s03pwji4" path="res://src/UI/Nodes/MaxMinEdit.tscn" id="8"] @@ -179,6 +181,108 @@ grow_vertical = 2 texture = ExtResource("3_faalk") stretch_mode = 3 +[node name="DiagonalXY" type="Button" parent="ScrollContainer/CenterContainer/GridContainer" groups=["UIButtons"]] +visible = false +custom_minimum_size = Vector2(46, 32) +layout_mode = 2 +tooltip_text = "Enable vertical mirrored drawing" +mouse_default_cursor_shape = 2 +toggle_mode = true +shortcut = SubResource("Shortcut_ai7qc") + +[node name="TextureRect" type="TextureRect" parent="ScrollContainer/CenterContainer/GridContainer/DiagonalXY"] +layout_mode = 1 +anchors_preset = 4 +anchor_top = 0.5 +anchor_bottom = 0.5 +offset_left = 5.0 +offset_top = -10.0 +offset_right = 25.0 +offset_bottom = 10.0 +grow_vertical = 2 +texture = ExtResource("5_hcmgx") + +[node name="MirrorOptions" type="MenuButton" parent="ScrollContainer/CenterContainer/GridContainer/DiagonalXY"] +visible = false +custom_minimum_size = Vector2(20, 0) +layout_mode = 1 +anchors_preset = 6 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_left = -20.0 +offset_top = -10.0 +offset_bottom = 10.0 +grow_horizontal = 0 +grow_vertical = 2 +mouse_default_cursor_shape = 2 +item_count = 2 +popup/item_0/text = "Move to canvas center" +popup/item_1/text = "Move to view center" +popup/item_1/id = 1 + +[node name="TextureRect" type="TextureRect" parent="ScrollContainer/CenterContainer/GridContainer/DiagonalXY/MirrorOptions"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("3_faalk") +stretch_mode = 3 + +[node name="DiagonalXMinusY" type="Button" parent="ScrollContainer/CenterContainer/GridContainer" groups=["UIButtons"]] +visible = false +custom_minimum_size = Vector2(46, 32) +layout_mode = 2 +tooltip_text = "Enable vertical mirrored drawing" +mouse_default_cursor_shape = 2 +toggle_mode = true +shortcut = SubResource("Shortcut_ai7qc") + +[node name="TextureRect" type="TextureRect" parent="ScrollContainer/CenterContainer/GridContainer/DiagonalXMinusY"] +layout_mode = 1 +anchors_preset = 4 +anchor_top = 0.5 +anchor_bottom = 0.5 +offset_left = 5.0 +offset_top = -10.0 +offset_right = 25.0 +offset_bottom = 10.0 +grow_vertical = 2 +texture = ExtResource("6_sw8fy") + +[node name="MirrorOptions" type="MenuButton" parent="ScrollContainer/CenterContainer/GridContainer/DiagonalXMinusY"] +visible = false +custom_minimum_size = Vector2(20, 0) +layout_mode = 1 +anchors_preset = 6 +anchor_left = 1.0 +anchor_top = 0.5 +anchor_right = 1.0 +anchor_bottom = 0.5 +offset_left = -20.0 +offset_top = -10.0 +offset_bottom = 10.0 +grow_horizontal = 0 +grow_vertical = 2 +mouse_default_cursor_shape = 2 +item_count = 2 +popup/item_0/text = "Move to canvas center" +popup/item_1/text = "Move to view center" +popup/item_1/id = 1 + +[node name="TextureRect" type="TextureRect" parent="ScrollContainer/CenterContainer/GridContainer/DiagonalXMinusY/MirrorOptions"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +texture = ExtResource("3_faalk") +stretch_mode = 3 + [node name="PixelPerfect" type="Button" parent="ScrollContainer/CenterContainer/GridContainer" groups=["UIButtons"]] custom_minimum_size = Vector2(32, 32) layout_mode = 2 @@ -546,6 +650,8 @@ offset_bottom = 23.0 [connection signal="resized" from="." to="." method="_on_resized"] [connection signal="toggled" from="ScrollContainer/CenterContainer/GridContainer/Horizontal" to="." method="_on_Horizontal_toggled"] [connection signal="toggled" from="ScrollContainer/CenterContainer/GridContainer/Vertical" to="." method="_on_Vertical_toggled"] +[connection signal="toggled" from="ScrollContainer/CenterContainer/GridContainer/DiagonalXY" to="." method="_on_diagonal_xy_toggled"] +[connection signal="toggled" from="ScrollContainer/CenterContainer/GridContainer/DiagonalXMinusY" to="." method="_on_diagonal_x_minus_y_toggled"] [connection signal="toggled" from="ScrollContainer/CenterContainer/GridContainer/PixelPerfect" to="." method="_on_PixelPerfect_toggled"] [connection signal="toggled" from="ScrollContainer/CenterContainer/GridContainer/AlphaLock" to="." method="_on_alpha_lock_toggled"] [connection signal="pressed" from="ScrollContainer/CenterContainer/GridContainer/Dynamics" to="." method="_on_Dynamics_pressed"] diff --git a/src/UI/TopMenuContainer/TopMenuContainer.gd b/src/UI/TopMenuContainer/TopMenuContainer.gd index 3858450e7..4814ed57c 100644 --- a/src/UI/TopMenuContainer/TopMenuContainer.gd +++ b/src/UI/TopMenuContainer/TopMenuContainer.gd @@ -838,7 +838,7 @@ func _toggle_show_guides() -> void: elif guide.type == Guide.Types.VERTICAL: guide.visible = Global.show_y_symmetry_axis and Global.show_guides elif guide.type == Guide.Types.XY: - guide.visible = Global.show_x_y_symmetry_axis and Global.show_guides + guide.visible = Global.show_xy_symmetry_axis and Global.show_guides elif guide.type == Guide.Types.X_MINUS_Y: guide.visible = Global.show_x_minus_y_symmetry_axis and Global.show_guides