mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
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.
This commit is contained in:
parent
b316cadfb8
commit
68414f5bd9
|
@ -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"
|
||||
|
|
BIN
assets/graphics/misc/pixel_perfect_off.png
Normal file
BIN
assets/graphics/misc/pixel_perfect_off.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 147 B |
35
assets/graphics/misc/pixel_perfect_off.png.import
Normal file
35
assets/graphics/misc/pixel_perfect_off.png.import
Normal file
|
@ -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
|
BIN
assets/graphics/misc/pixel_perfect_on.png
Normal file
BIN
assets/graphics/misc/pixel_perfect_on.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6 KiB |
35
assets/graphics/misc/pixel_perfect_on.png.import
Normal file
35
assets/graphics/misc/pixel_perfect_on.png.import
Normal file
|
@ -0,0 +1,35 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/pixel_perfect_on.png-b6491a77b0ebb21671803e7a75c8e18d.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://assets/graphics/misc/pixel_perfect_on.png"
|
||||
dest_files=[ "res://.import/pixel_perfect_on.png-b6491a77b0ebb21671803e7a75c8e18d.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
|
|
@ -5,6 +5,7 @@ signal color_changed(color, button)
|
|||
var pen_pressure := 1.0
|
||||
var horizontal_mirror := false
|
||||
var vertical_mirror := false
|
||||
var pixel_perfect := false
|
||||
var control := false
|
||||
var shift := false
|
||||
var alt := false
|
||||
|
@ -191,22 +192,9 @@ class Slot:
|
|||
var button: int
|
||||
var color: Color
|
||||
|
||||
var pixel_perfect := false
|
||||
|
||||
func _init(slot_name: String) -> 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")
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"]
|
||||
|
|
Loading…
Reference in a new issue