From 68414f5bd90d2663c3fb96b8697d0232dc4663b9 Mon Sep 17 00:00:00 2001 From: Manolis Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Mon, 28 Feb 2022 19:24:14 +0200 Subject: [PATCH] Made pixel perfect into a global tool option More global tool options will most likely be added soon, most notably tablet pen pressure sensitivity options. --- Translations/Translations.pot | 3 +- assets/graphics/misc/pixel_perfect_off.png | Bin 0 -> 147 bytes .../misc/pixel_perfect_off.png.import | 35 ++++++++++++ assets/graphics/misc/pixel_perfect_on.png | Bin 0 -> 6125 bytes .../graphics/misc/pixel_perfect_on.png.import | 35 ++++++++++++ src/Autoload/Tools.gd | 15 +----- src/Tools/BaseTool.gd | 6 --- src/Tools/BaseTool.tscn | 24 --------- src/Tools/Bucket.tscn | 9 ---- src/Tools/ColorPicker.tscn | 10 ---- src/Tools/Draw.gd | 4 +- src/Tools/Draw.tscn | 10 +--- src/Tools/Eraser.tscn | 8 +-- src/Tools/LineTool.tscn | 11 +--- src/Tools/Move.tscn | 10 ---- src/Tools/Pan.tscn | 10 ---- src/Tools/Pencil.tscn | 15 +----- src/Tools/SelectionTools/PolygonSelect.tscn | 2 +- src/Tools/SelectionTools/SelectionTool.tscn | 9 +--- src/Tools/Shading.tscn | 51 ++++++++---------- src/Tools/ShapeDrawer.tscn | 13 +---- src/Tools/Zoom.tscn | 10 ---- src/UI/GlobalToolOptions.gd | 30 +++++++---- src/UI/GlobalToolOptions.tscn | 27 +++++++++- 24 files changed, 153 insertions(+), 194 deletions(-) create mode 100644 assets/graphics/misc/pixel_perfect_off.png create mode 100644 assets/graphics/misc/pixel_perfect_off.png.import create mode 100644 assets/graphics/misc/pixel_perfect_on.png create mode 100644 assets/graphics/misc/pixel_perfect_on.png.import diff --git a/Translations/Translations.pot b/Translations/Translations.pot index 890a0ad7a..dd48061a8 100644 --- a/Translations/Translations.pot +++ b/Translations/Translations.pot @@ -1146,7 +1146,8 @@ msgstr "" msgid "Fill inside" msgstr "" -msgid "Makes lines smooth by removing the extra pixels on the edges" +msgid "Pixel Perfect\n" +"Makes lines smooth by removing the extra pixels on the edges" msgstr "" msgid "Fill Shape" diff --git a/assets/graphics/misc/pixel_perfect_off.png b/assets/graphics/misc/pixel_perfect_off.png new file mode 100644 index 0000000000000000000000000000000000000000..47965d5cf05d48ecb436579dbfdb631b4c0fce6a GIT binary patch literal 147 zcmeAS@N?(olHy`uVBq!ia0vp^Vj#@H1|*Mc$*~4fjKx9jP7LeL$-D$|d_7$pLo9le z6C_v{H{>-4&Q5T4K3uP27G|o#oZ`Ik@NlE-wH8 literal 0 HcmV?d00001 diff --git a/assets/graphics/misc/pixel_perfect_off.png.import b/assets/graphics/misc/pixel_perfect_off.png.import new file mode 100644 index 000000000..f0abb0e18 --- /dev/null +++ b/assets/graphics/misc/pixel_perfect_off.png.import @@ -0,0 +1,35 @@ +[remap] + +importer="texture" +type="StreamTexture" +path="res://.import/pixel_perfect_off.png-3ae3ddb583d51a5cedad3b51fdc0f0d4.stex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/graphics/misc/pixel_perfect_off.png" +dest_files=[ "res://.import/pixel_perfect_off.png-3ae3ddb583d51a5cedad3b51fdc0f0d4.stex" ] + +[params] + +compress/mode=0 +compress/lossy_quality=0.7 +compress/hdr_mode=0 +compress/bptc_ldr=0 +compress/normal_map=0 +flags/repeat=0 +flags/filter=false +flags/mipmaps=false +flags/anisotropic=false +flags/srgb=2 +process/fix_alpha_border=true +process/premult_alpha=false +process/HDR_as_SRGB=false +process/invert_color=false +process/normal_map_invert_y=false +stream=false +size_limit=0 +detect_3d=false +svg/scale=1.0 diff --git a/assets/graphics/misc/pixel_perfect_on.png b/assets/graphics/misc/pixel_perfect_on.png new file mode 100644 index 0000000000000000000000000000000000000000..553dfb47818abdc33ae4b4777683db858282eff5 GIT binary patch literal 6125 zcmV zaB^>EX>4U6ba`-PAZ2)IW&i+q+U=ZIawRcuh2OafFQJ*qoIJ)!j zm&>El4IR)V!odMZjT-;+-&6e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VwWB~t;9Do^8 zGw=*;Wb1)V)FXu~Ap11d#?G~FUM5JMZ3z^{`~vC);UPy^k4u1m8iN66?`*iJU9WaY z(>Lopqb$lz*>nF*&tGzr;{4v%5A3gf{k5EZ{XzEiC!_DH{==lP8YpL%eDa>MZ2fVw zO%k+woBX)q=Nt0BC#-5Q*2D~2J!|-HyZSEPy85fBpC3*AW*<%cJk@F%ZrS2sC#QHL zI}N=M)auvz&pNRVGX=jXJ*Q+aOM-e`#Fn657qKO%*F|gz>U9xYf_h!VmY`l2u_dV2 zMQjP`brD;FdR@eppk5cTB`E)&6C$$OX`@;p-%JaHGuP~J7ouqQPAmy{8{?4O5<~un z0WJHqA(45t1Fi*T86EvEpq8gcoyrqb0004nX+uL$Nkc;*aB^>EX>4Tx0C=2zkv&Mm zP!xqvQ>7vmK|6>zWT@g`K~%)CRIvyaN?V~-2a}inL6e3g#l=x@EjakISaoo5*44pP z5Cnff9G#pLU8KbOl0u6ZZ+PV6yn8P1od*bw3RBIlNkG*sBNdN{+1#oac!iI?0f-ov zn5ieyiy3&<*FE)8-9`8;@4i2)Psy7M@QK7xrW+RV2J!5srE}gV4zZG?5T6rI7<545 zN3P2*zi}=)Eby5jBa@mZ4iSsR4wgHZl?;`5hB&OK8qF87E-Re3IIEQ!Yn_wdFqqd? z(p;xCf;g6tK$0?&Q9~IOScuSHBgI6D_G2FYVaJ~&mrSlQ7&#VDg$l{>gTKM=Y|X;- zlshRH1G-;q`(qRc>;lcYZGRuzcJl=AKLb}<+h1(}bDyNw+gkVt=-&n|uG^Zt2VCv| zLr=P7NRH&EB@_z4`x!k`4j8-zde_|CTKhPC05X)-@(pls2#ghJ_PWQtdpdLbx2Kig z4|KqCsJvRyYXATM24YJ`L;(K){{a7>y{D4^000SaNLh0L04^f{04^f|c%?sf00007 zbV*G`2j&3*5-k_CX>@2HM@dakSAh-} z0000?NklX>L6 zgQU8K7 void: name = slot_name kname = name.replace(" ", "_").to_lower() - load_config() - - func save_config() -> void: - var config := { - "pixel_perfect": pixel_perfect, - } - Global.config_cache.set_value(kname, "slot", config) - - func load_config() -> void: - var config = Global.config_cache.get_value(kname, "slot", {}) - pixel_perfect = config.get("pixel_perfect", pixel_perfect) func _ready() -> void: @@ -234,6 +222,7 @@ func _ready() -> void: horizontal_mirror = Global.config_cache.get_value("preferences", "horizontal_mirror", false) vertical_mirror = Global.config_cache.get_value("preferences", "vertical_mirror", false) + pixel_perfect = Global.config_cache.get_value("preferences", "pixel_perfect", false) # Yield is necessary for the color picker nodes to update their color values yield(get_tree(), "idle_frame") diff --git a/src/Tools/BaseTool.gd b/src/Tools/BaseTool.gd index bcc028571..67ef9feee 100644 --- a/src/Tools/BaseTool.gd +++ b/src/Tools/BaseTool.gd @@ -14,12 +14,6 @@ func _ready() -> void: $Label.text = tool_slot.name load_config() - $PixelPerfect.pressed = tool_slot.pixel_perfect - - -func _on_PixelPerfect_toggled(button_pressed: bool) -> void: - tool_slot.pixel_perfect = button_pressed - tool_slot.save_config() func save_config() -> void: diff --git a/src/Tools/BaseTool.tscn b/src/Tools/BaseTool.tscn index be14a9cb3..a022378ee 100644 --- a/src/Tools/BaseTool.tscn +++ b/src/Tools/BaseTool.tscn @@ -9,9 +9,6 @@ margin_right = 123.0 margin_bottom = 65.0 size_flags_horizontal = 3 script = ExtResource( 1 ) -__meta__ = { -"_edit_use_anchors_": false -} [node name="Label" type="Label" parent="."] margin_right = 116.0 @@ -19,24 +16,3 @@ margin_bottom = 14.0 text = "Tool" align = 1 autowrap = true - -[node name="PixelPerfect" type="CheckBox" parent="."] -margin_left = 4.0 -margin_top = 18.0 -margin_right = 112.0 -margin_bottom = 42.0 -grow_horizontal = 2 -grow_vertical = 2 -hint_tooltip = "Makes lines smooth by removing the extra pixels on the edges" -mouse_default_cursor_shape = 2 -size_flags_horizontal = 4 -text = "Pixel Perfect" -align = 1 - -[node name="EmptySpacer" type="Control" parent="."] -margin_top = 46.0 -margin_right = 116.0 -margin_bottom = 58.0 -rect_min_size = Vector2( 0, 12 ) - -[connection signal="toggled" from="PixelPerfect" to="." method="_on_PixelPerfect_toggled"] diff --git a/src/Tools/Bucket.tscn b/src/Tools/Bucket.tscn index b8ddb993a..605db5580 100644 --- a/src/Tools/Bucket.tscn +++ b/src/Tools/Bucket.tscn @@ -187,15 +187,6 @@ margin_right = 85.0 margin_bottom = 24.0 mouse_default_cursor_shape = 2 -[node name="PixelPerfect" parent="." index="7"] -visible = false - -[node name="EmptySpacer" parent="." index="8"] -visible = false -margin_top = 212.0 -margin_right = 131.0 -margin_bottom = 224.0 - [connection signal="item_selected" from="FillAreaOptions" to="." method="_on_FillAreaOptions_item_selected"] [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"] diff --git a/src/Tools/ColorPicker.tscn b/src/Tools/ColorPicker.tscn index 725cc4280..6cc084590 100644 --- a/src/Tools/ColorPicker.tscn +++ b/src/Tools/ColorPicker.tscn @@ -30,14 +30,4 @@ text = "Left Color" items = [ "Left Color", null, false, 0, null, "Right Color", null, false, 1, null ] selected = 0 -[node name="PixelPerfect" parent="." index="2"] -visible = false -margin_top = 60.0 -margin_bottom = 84.0 - -[node name="EmptySpacer" parent="." index="3"] -visible = false -margin_top = 60.0 -margin_bottom = 72.0 - [connection signal="item_selected" from="ColorPicker/Options" to="." method="_on_Options_item_selected"] diff --git a/src/Tools/Draw.gd b/src/Tools/Draw.gd index df61868fb..f2ede06f0 100644 --- a/src/Tools/Draw.gd +++ b/src/Tools/Draw.gd @@ -183,7 +183,7 @@ func draw_tool(position: Vector2) -> void: if Global.pressure_sensitivity_mode == Global.PressureSensitivity.ALPHA: strength *= Tools.pen_pressure - _drawer.pixel_perfect = tool_slot.pixel_perfect if _brush_size == 1 else false + _drawer.pixel_perfect = Tools.pixel_perfect if _brush_size == 1 else false _drawer.horizontal_mirror = Tools.horizontal_mirror _drawer.vertical_mirror = Tools.vertical_mirror _drawer.color_op.strength = strength @@ -500,7 +500,7 @@ func _line_angle_constraint(start: Vector2, end: Vector2) -> Dictionary: var angle := rad2deg(end.angle_to_point(start)) var distance := start.distance_to(end) if Tools.control: - if tool_slot.pixel_perfect: + if Tools.pixel_perfect: angle = stepify(angle, 22.5) if step_decimals(angle) != 0: var diff := end - start diff --git a/src/Tools/Draw.tscn b/src/Tools/Draw.tscn index c2d64954d..e8ec35c60 100644 --- a/src/Tools/Draw.tscn +++ b/src/Tools/Draw.tscn @@ -79,11 +79,7 @@ value = 1.0 allow_greater = true ticks_on_borders = true -[node name="PixelPerfect" parent="." index="3"] -margin_top = 74.0 -margin_bottom = 98.0 - -[node name="ColorInterpolation" type="VBoxContainer" parent="." index="4"] +[node name="ColorInterpolation" type="VBoxContainer" parent="." index="3"] visible = false margin_top = 102.0 margin_right = 116.0 @@ -122,10 +118,6 @@ size_flags_horizontal = 4 size_flags_vertical = 1 ticks_on_borders = true -[node name="EmptySpacer" parent="." index="5"] -margin_top = 102.0 -margin_bottom = 114.0 - [connection signal="pressed" from="Brush/Type" to="." method="_on_BrushType_pressed"] [connection signal="value_changed" from="Brush/Size" to="." method="_on_BrushSize_value_changed"] [connection signal="value_changed" from="BrushSize" to="." method="_on_BrushSize_value_changed"] diff --git a/src/Tools/Eraser.tscn b/src/Tools/Eraser.tscn index c54fedf78..70ce86120 100644 --- a/src/Tools/Eraser.tscn +++ b/src/Tools/Eraser.tscn @@ -7,9 +7,9 @@ script = ExtResource( 2 ) [node name="Opacity" type="VBoxContainer" parent="." index="4"] -margin_top = 102.0 +margin_top = 74.0 margin_right = 116.0 -margin_bottom = 164.0 +margin_bottom = 136.0 [node name="OpacityLabel" type="Label" parent="Opacity" index="0"] margin_right = 116.0 @@ -42,9 +42,5 @@ size_flags_horizontal = 4 max_value = 255.0 value = 255.0 -[node name="EmptySpacer" parent="." index="6"] -margin_top = 168.0 -margin_bottom = 180.0 - [connection signal="value_changed" from="Opacity/OpacitySpinBox" to="." method="_on_Opacity_value_changed"] [connection signal="value_changed" from="Opacity/OpacitySlider" to="." method="_on_Opacity_value_changed"] diff --git a/src/Tools/LineTool.tscn b/src/Tools/LineTool.tscn index cf839362b..a6a565405 100644 --- a/src/Tools/LineTool.tscn +++ b/src/Tools/LineTool.tscn @@ -52,18 +52,9 @@ visible = false margin_top = 18.0 margin_bottom = 34.0 -[node name="PixelPerfect" parent="." index="5"] -visible = false -margin_top = 66.0 -margin_bottom = 90.0 - -[node name="ColorInterpolation" parent="." index="6"] +[node name="ColorInterpolation" parent="." index="5"] margin_top = 66.0 margin_bottom = 128.0 -[node name="EmptySpacer" parent="." index="7"] -margin_top = 66.0 -margin_bottom = 78.0 - [connection signal="value_changed" from="ShapeThickness/ThicknessSpinbox" to="." method="_on_Thickness_value_changed"] [connection signal="value_changed" from="ThicknessSlider" to="." method="_on_Thickness_value_changed"] diff --git a/src/Tools/Move.tscn b/src/Tools/Move.tscn index 4ac1e4da9..4d9432224 100644 --- a/src/Tools/Move.tscn +++ b/src/Tools/Move.tscn @@ -5,13 +5,3 @@ [node name="ToolOptions" instance=ExtResource( 1 )] script = ExtResource( 2 ) - -[node name="PixelPerfect" parent="." index="1"] -visible = false -margin_top = 126.0 -margin_bottom = 150.0 - -[node name="EmptySpacer" parent="." index="2"] -visible = false -margin_top = 126.0 -margin_bottom = 138.0 diff --git a/src/Tools/Pan.tscn b/src/Tools/Pan.tscn index b13898c54..80068710e 100644 --- a/src/Tools/Pan.tscn +++ b/src/Tools/Pan.tscn @@ -5,13 +5,3 @@ [node name="ToolOptions" instance=ExtResource( 1 )] script = ExtResource( 2 ) - -[node name="PixelPerfect" parent="." index="1"] -visible = false -margin_top = 126.0 -margin_bottom = 150.0 - -[node name="EmptySpacer" parent="." index="2"] -visible = false -margin_top = 126.0 -margin_bottom = 138.0 diff --git a/src/Tools/Pencil.tscn b/src/Tools/Pencil.tscn index ad48ed72f..8af7b622f 100644 --- a/src/Tools/Pencil.tscn +++ b/src/Tools/Pencil.tscn @@ -39,17 +39,11 @@ __meta__ = { "_editor_description_": "" } -[node name="PixelPerfect" parent="." index="4"] -margin_left = 10.0 -margin_top = 102.0 -margin_right = 118.0 -margin_bottom = 126.0 - [node name="FillInside" type="CheckBox" parent="." index="5"] margin_left = 19.0 -margin_top = 130.0 +margin_top = 102.0 margin_right = 109.0 -margin_bottom = 154.0 +margin_bottom = 126.0 mouse_default_cursor_shape = 2 size_flags_horizontal = 4 text = "Fill inside" @@ -58,10 +52,5 @@ __meta__ = { "_editor_description_": "" } -[node name="EmptySpacer" parent="." index="7"] -margin_top = 158.0 -margin_right = 128.0 -margin_bottom = 170.0 - [connection signal="toggled" from="Overwrite" to="." method="_on_Overwrite_toggled"] [connection signal="toggled" from="FillInside" to="." method="_on_FillInside_toggled"] diff --git a/src/Tools/SelectionTools/PolygonSelect.tscn b/src/Tools/SelectionTools/PolygonSelect.tscn index c2cd81227..d18160d98 100644 --- a/src/Tools/SelectionTools/PolygonSelect.tscn +++ b/src/Tools/SelectionTools/PolygonSelect.tscn @@ -6,6 +6,6 @@ [node name="ToolOptions" instance=ExtResource( 1 )] script = ExtResource( 2 ) -[node name="DoubleClickTimer" type="Timer" parent="." index="10"] +[node name="DoubleClickTimer" type="Timer" parent="." index="8"] wait_time = 0.1 one_shot = true diff --git a/src/Tools/SelectionTools/SelectionTool.tscn b/src/Tools/SelectionTools/SelectionTool.tscn index 1bacd9a77..a5751bd77 100644 --- a/src/Tools/SelectionTools/SelectionTool.tscn +++ b/src/Tools/SelectionTools/SelectionTool.tscn @@ -114,14 +114,7 @@ min_value = 1.0 value = 1.0 allow_greater = true -[node name="PixelPerfect" parent="." index="7"] -visible = false - -[node name="EmptySpacer" parent="." index="8"] -margin_top = 166.0 -margin_bottom = 178.0 - -[node name="Timer" type="Timer" parent="." index="9"] +[node name="Timer" type="Timer" parent="." index="7"] wait_time = 0.2 one_shot = true diff --git a/src/Tools/Shading.tscn b/src/Tools/Shading.tscn index bdb908d25..b0c446849 100644 --- a/src/Tools/Shading.tscn +++ b/src/Tools/Shading.tscn @@ -24,14 +24,27 @@ margin_right = 118.0 margin_left = 17.0 margin_right = 109.0 -[node name="PixelPerfect" parent="." index="3"] +[node name="ColorInterpolation" parent="." index="3"] +margin_top = 216.0 +margin_right = 126.0 +margin_bottom = 278.0 + +[node name="Label" parent="ColorInterpolation" index="0"] margin_left = 9.0 -margin_right = 117.0 +margin_right = 116.0 + +[node name="Factor" parent="ColorInterpolation" index="1"] +margin_left = 26.0 +margin_right = 100.0 + +[node name="Slider" parent="ColorInterpolation" index="2"] +margin_left = 17.0 +margin_right = 109.0 [node name="ShadingMode" type="OptionButton" parent="." index="4"] -margin_top = 102.0 +margin_top = 74.0 margin_right = 126.0 -margin_bottom = 122.0 +margin_bottom = 94.0 mouse_default_cursor_shape = 2 text = "Simple Shading" items = [ "Simple Shading", null, false, 0, null, "Hue Shifting", null, false, 1, null ] @@ -39,9 +52,9 @@ selected = 0 [node name="LightenDarken" type="OptionButton" parent="." index="5"] margin_left = 17.0 -margin_top = 126.0 +margin_top = 98.0 margin_right = 109.0 -margin_bottom = 146.0 +margin_bottom = 118.0 rect_min_size = Vector2( 92, 0 ) mouse_default_cursor_shape = 2 size_flags_horizontal = 4 @@ -50,9 +63,9 @@ items = [ "Lighten", null, false, 0, null, "Darken", null, false, 1, null ] selected = 0 [node name="Amount" type="VBoxContainer" parent="." index="6"] -margin_top = 150.0 +margin_top = 122.0 margin_right = 126.0 -margin_bottom = 212.0 +margin_bottom = 184.0 alignment = 1 [node name="Label" type="Label" parent="Amount" index="0"] @@ -208,28 +221,6 @@ size_flags_vertical = 1 value = 10.0 ticks_on_borders = true -[node name="ColorInterpolation" parent="." index="8"] -margin_top = 216.0 -margin_right = 126.0 -margin_bottom = 278.0 - -[node name="Label" parent="ColorInterpolation" index="0"] -margin_left = 9.0 -margin_right = 116.0 - -[node name="Factor" parent="ColorInterpolation" index="1"] -margin_left = 26.0 -margin_right = 100.0 - -[node name="Slider" parent="ColorInterpolation" index="2"] -margin_left = 17.0 -margin_right = 109.0 - -[node name="EmptySpacer" parent="." index="9"] -margin_top = 216.0 -margin_right = 126.0 -margin_bottom = 228.0 - [connection signal="item_selected" from="ShadingMode" to="." method="_on_ShadingMode_item_selected"] [connection signal="item_selected" from="LightenDarken" to="." method="_on_LightenDarken_item_selected"] [connection signal="value_changed" from="Amount/Spinbox" to="." method="_on_LightenDarken_value_changed"] diff --git a/src/Tools/ShapeDrawer.tscn b/src/Tools/ShapeDrawer.tscn index b58a25f05..50f786cee 100644 --- a/src/Tools/ShapeDrawer.tscn +++ b/src/Tools/ShapeDrawer.tscn @@ -52,16 +52,11 @@ visible = false margin_top = 18.0 margin_bottom = 34.0 -[node name="PixelPerfect" parent="." index="5"] -visible = false -margin_top = 66.0 -margin_bottom = 90.0 - -[node name="ColorInterpolation" parent="." index="6"] +[node name="ColorInterpolation" parent="." index="5"] margin_top = 66.0 margin_bottom = 128.0 -[node name="FillCheckbox" type="CheckBox" parent="." index="7"] +[node name="FillCheckbox" type="CheckBox" parent="." index="6"] margin_left = 13.0 margin_top = 66.0 margin_right = 102.0 @@ -71,10 +66,6 @@ mouse_default_cursor_shape = 2 size_flags_horizontal = 4 text = "Fill Shape" -[node name="EmptySpacer" parent="." index="8"] -margin_top = 94.0 -margin_bottom = 106.0 - [connection signal="value_changed" from="ShapeThickness/ThicknessSpinbox" to="." method="_on_Thickness_value_changed"] [connection signal="value_changed" from="ThicknessSlider" to="." method="_on_Thickness_value_changed"] [connection signal="toggled" from="FillCheckbox" to="." method="_on_FillCheckbox_toggled"] diff --git a/src/Tools/Zoom.tscn b/src/Tools/Zoom.tscn index 6829239f9..ef2949b72 100644 --- a/src/Tools/Zoom.tscn +++ b/src/Tools/Zoom.tscn @@ -56,16 +56,6 @@ mouse_default_cursor_shape = 2 size_flags_horizontal = 4 text = "100% Zoom" -[node name="PixelPerfect" parent="." index="6"] -visible = false -margin_top = 126.0 -margin_bottom = 150.0 - -[node name="EmptySpacer" parent="." index="7"] -visible = false -margin_top = 126.0 -margin_bottom = 138.0 - [connection signal="item_selected" from="ModeOptions" to="." method="_on_ModeOptions_item_selected"] [connection signal="pressed" from="FitToFrame" to="." method="_on_FitToFrame_pressed"] [connection signal="pressed" from="100%" to="." method="_on_100_pressed"] diff --git a/src/UI/GlobalToolOptions.gd b/src/UI/GlobalToolOptions.gd index 827f164a0..68d5b9885 100644 --- a/src/UI/GlobalToolOptions.gd +++ b/src/UI/GlobalToolOptions.gd @@ -1,8 +1,9 @@ extends PanelContainer onready var grid_container: GridContainer = find_node("GridContainer") -onready var horizontal_mirror: BaseButton = find_node("Horizontal") -onready var vertical_mirror: BaseButton = find_node("Vertical") +onready var horizontal_mirror: BaseButton = grid_container.get_node("Horizontal") +onready var vertical_mirror: BaseButton = grid_container.get_node("Vertical") +onready var pixel_perfect: BaseButton = grid_container.get_node("PixelPerfect") func _ready() -> void: @@ -11,6 +12,16 @@ func _ready() -> void: horizontal_mirror.pressed = Tools.horizontal_mirror vertical_mirror.pressed = Tools.vertical_mirror + pixel_perfect.pressed = Tools.pixel_perfect + + +func _on_resized() -> void: + var tool_panel_size: Vector2 = rect_size + var column_n = tool_panel_size.x / 36.5 + + if column_n < 1: + column_n = 1 + grid_container.columns = column_n func _on_Horizontal_toggled(button_pressed: bool) -> void: @@ -46,10 +57,11 @@ func _on_Vertical_toggled(button_pressed: bool) -> void: Global.change_button_texturerect(texture_button, file_name) -func _on_resized() -> void: - var tool_panel_size: Vector2 = rect_size - var column_n = tool_panel_size.x / 36.5 - - if column_n < 1: - column_n = 1 - grid_container.columns = column_n +func _on_PixelPerfect_toggled(button_pressed: bool) -> void: + Tools.pixel_perfect = button_pressed + Global.config_cache.set_value("preferences", "pixel_perfect", button_pressed) + var texture_button: TextureRect = pixel_perfect.get_node("TextureRect") + var file_name := "pixel_perfect_on.png" + if !button_pressed: + file_name = "pixel_perfect_off.png" + Global.change_button_texturerect(texture_button, file_name) diff --git a/src/UI/GlobalToolOptions.tscn b/src/UI/GlobalToolOptions.tscn index 6139185cd..d26e8b810 100644 --- a/src/UI/GlobalToolOptions.tscn +++ b/src/UI/GlobalToolOptions.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://assets/graphics/misc/horizontal_mirror_off.png" type="Texture" id=1] [ext_resource path="res://assets/graphics/misc/vertical_mirror_off.png" type="Texture" id=2] [ext_resource path="res://src/UI/GlobalToolOptions.gd" type="Script" id=3] +[ext_resource path="res://assets/graphics/misc/pixel_perfect_off.png" type="Texture" id=4] [node name="Global Tool Options" type="PanelContainer"] margin_left = 958.0 @@ -19,7 +20,7 @@ margin_right = 311.0 margin_bottom = 39.0 [node name="GridContainer" type="GridContainer" parent="ScrollContainer"] -margin_right = 68.0 +margin_right = 104.0 margin_bottom = 32.0 columns = 3 @@ -68,6 +69,28 @@ __meta__ = { "_edit_use_anchors_": false } +[node name="PixelPerfect" type="Button" parent="ScrollContainer/GridContainer" groups=["UIButtons"]] +margin_left = 72.0 +margin_right = 104.0 +margin_bottom = 32.0 +rect_min_size = Vector2( 32, 32 ) +hint_tooltip = "Pixel Perfect +Makes lines smooth by removing the extra pixels on the edges" +mouse_default_cursor_shape = 2 +toggle_mode = true + +[node name="TextureRect" type="TextureRect" parent="ScrollContainer/GridContainer/PixelPerfect"] +anchor_left = 0.5 +anchor_top = 0.5 +anchor_right = 0.5 +anchor_bottom = 0.5 +margin_left = -11.0 +margin_top = -11.0 +margin_right = 11.0 +margin_bottom = 11.0 +texture = ExtResource( 4 ) + [connection signal="resized" from="." to="." method="_on_resized"] [connection signal="toggled" from="ScrollContainer/GridContainer/Horizontal" to="." method="_on_Horizontal_toggled"] [connection signal="toggled" from="ScrollContainer/GridContainer/Vertical" to="." method="_on_Vertical_toggled"] +[connection signal="toggled" from="ScrollContainer/GridContainer/PixelPerfect" to="." method="_on_PixelPerfect_toggled"]