mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-02-12 16:53:07 +00:00
Compare commits
5 commits
ccf4d6ffd2
...
d64f93180b
Author | SHA1 | Date | |
---|---|---|---|
|
d64f93180b | ||
|
d0ecf3b03d | ||
|
0e53f7ed67 | ||
|
6c37c68acf | ||
|
3d65e48c92 |
BIN
assets/graphics/misc/x_minus_y_mirror_off.png
Normal file
BIN
assets/graphics/misc/x_minus_y_mirror_off.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 218 B |
34
assets/graphics/misc/x_minus_y_mirror_off.png.import
Normal file
34
assets/graphics/misc/x_minus_y_mirror_off.png.import
Normal file
|
@ -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
|
BIN
assets/graphics/misc/x_minus_y_mirror_on.png
Normal file
BIN
assets/graphics/misc/x_minus_y_mirror_on.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 187 B |
34
assets/graphics/misc/x_minus_y_mirror_on.png.import
Normal file
34
assets/graphics/misc/x_minus_y_mirror_on.png.import
Normal file
|
@ -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
|
BIN
assets/graphics/misc/xy_mirror_off.png
Normal file
BIN
assets/graphics/misc/xy_mirror_off.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 183 B |
34
assets/graphics/misc/xy_mirror_off.png.import
Normal file
34
assets/graphics/misc/xy_mirror_off.png.import
Normal file
|
@ -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
|
BIN
assets/graphics/misc/xy_mirror_on.png
Normal file
BIN
assets/graphics/misc/xy_mirror_on.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 185 B |
34
assets/graphics/misc/xy_mirror_on.png.import
Normal file
34
assets/graphics/misc/xy_mirror_on.png.import
Normal file
|
@ -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
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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:
|
||||
if not horizontal_mirror and not vertical_mirror and diagonal_x_minus_y_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
|
||||
|
||||
|
@ -564,11 +564,14 @@ func calculate_mirror_vertical(pos: Vector2i, project: Project, offset := 0) ->
|
|||
|
||||
|
||||
func calculate_mirror_xy(pos: Vector2i, project: Project) -> Vector2i:
|
||||
return Vector2i(Vector2(pos).reflect(XY_LINE).round()) + project.size - Vector2i.ONE
|
||||
return Vector2i(Vector2(pos).reflect(XY_LINE).round()) + Vector2i(project.xy_symmetry_point)
|
||||
|
||||
|
||||
func calculate_mirror_x_minus_y(pos: Vector2i, _project: Project) -> Vector2i:
|
||||
return Vector2i(Vector2(pos).reflect(X_MINUS_Y_LINE).round())
|
||||
func calculate_mirror_x_minus_y(pos: Vector2i, project: Project) -> Vector2i:
|
||||
return (
|
||||
Vector2i(Vector2(pos).reflect(X_MINUS_Y_LINE).round())
|
||||
+ Vector2i(project.x_minus_y_symmetry_point)
|
||||
)
|
||||
|
||||
|
||||
func set_button_size(button_size: int) -> void:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -69,6 +69,8 @@ var user_data := "" ## User defined data, set in the project properties.
|
|||
|
||||
var x_symmetry_point: float
|
||||
var y_symmetry_point: float
|
||||
var xy_symmetry_point: Vector2
|
||||
var x_minus_y_symmetry_point: Vector2
|
||||
var x_symmetry_axis := SymmetryGuide.new()
|
||||
var y_symmetry_axis := SymmetryGuide.new()
|
||||
var diagonal_xy_symmetry_axis := SymmetryGuide.new()
|
||||
|
@ -113,6 +115,8 @@ func _init(_frames: Array[Frame] = [], _name := tr("untitled"), _size := Vector2
|
|||
|
||||
x_symmetry_point = size.x - 1
|
||||
y_symmetry_point = size.y - 1
|
||||
xy_symmetry_point = Vector2i(size.y, size.x) - Vector2i.ONE
|
||||
x_minus_y_symmetry_point = Vector2(maxi(size.x - size.y, 0), maxi(size.y - size.x, 0))
|
||||
x_symmetry_axis.type = Guide.Types.HORIZONTAL
|
||||
x_symmetry_axis.project = self
|
||||
x_symmetry_axis.add_point(Vector2(-19999, y_symmetry_point / 2 + 0.5))
|
||||
|
@ -128,13 +132,13 @@ func _init(_frames: Array[Frame] = [], _name := tr("untitled"), _size := Vector2
|
|||
diagonal_xy_symmetry_axis.type = Guide.Types.XY
|
||||
diagonal_xy_symmetry_axis.project = self
|
||||
diagonal_xy_symmetry_axis.add_point(Vector2(19999, -19999))
|
||||
diagonal_xy_symmetry_axis.add_point(Vector2i(-19999, 19999) + size)
|
||||
diagonal_xy_symmetry_axis.add_point(Vector2(-19999, 19999) + xy_symmetry_point + Vector2.ONE)
|
||||
Global.canvas.add_child(diagonal_xy_symmetry_axis)
|
||||
|
||||
diagonal_x_minus_y_symmetry_axis.type = Guide.Types.X_MINUS_Y
|
||||
diagonal_x_minus_y_symmetry_axis.project = self
|
||||
diagonal_x_minus_y_symmetry_axis.add_point(Vector2(-19999, -19999))
|
||||
diagonal_x_minus_y_symmetry_axis.add_point(Vector2(19999, 19999))
|
||||
diagonal_x_minus_y_symmetry_axis.add_point(Vector2(19999, 19999) + x_minus_y_symmetry_point)
|
||||
Global.canvas.add_child(diagonal_x_minus_y_symmetry_axis)
|
||||
|
||||
if OS.get_name() == "Web":
|
||||
|
|
|
@ -179,17 +179,25 @@ func resize_bitmap_values(
|
|||
var is_ellipse_select := true
|
||||
var w := smaller_image.get_width()
|
||||
var h := smaller_image.get_height()
|
||||
var ellipse_select := DrawingAlgos.get_ellipse_points(Vector2.ZERO, Vector2i(w,h))
|
||||
var ellipse_select := DrawingAlgos.get_ellipse_points(Vector2.ZERO, Vector2i(w, h))
|
||||
var x_min := []
|
||||
var x_max := []
|
||||
x_min.resize(h)
|
||||
x_max.resize(h)
|
||||
# Determine x_min and x_max of y
|
||||
for i in ellipse_select.size()/2:
|
||||
i*=2
|
||||
for i in ellipse_select.size() / 2:
|
||||
i *= 2
|
||||
var y := ellipse_select[i].y
|
||||
var xmin := ellipse_select[i].x if ellipse_select[i].x < ellipse_select[i+1].x else ellipse_select[i+1].x
|
||||
var xmax := ellipse_select[i].x if ellipse_select[i].x >= ellipse_select[i+1].x else ellipse_select[i+1].x
|
||||
var xmin := (
|
||||
ellipse_select[i].x
|
||||
if ellipse_select[i].x < ellipse_select[i + 1].x
|
||||
else ellipse_select[i + 1].x
|
||||
)
|
||||
var xmax := (
|
||||
ellipse_select[i].x
|
||||
if ellipse_select[i].x >= ellipse_select[i + 1].x
|
||||
else ellipse_select[i + 1].x
|
||||
)
|
||||
|
||||
if x_min[y] == null && x_max[y] == null:
|
||||
x_min[y] = xmin
|
||||
|
@ -200,7 +208,7 @@ func resize_bitmap_values(
|
|||
if x_max[y] != null && x_max[y] < xmax:
|
||||
x_max[y] = xmax
|
||||
# too small to be rectangular selection
|
||||
if x_min[0] == 0 && x_max[0] == w-1:
|
||||
if x_min[0] == 0 && x_max[0] == w - 1:
|
||||
is_ellipse_select = false
|
||||
# if ellipse is too small, ellipse_select doesn't quite cover the true elliptical selection
|
||||
for y in range(h):
|
||||
|
@ -211,7 +219,7 @@ func resize_bitmap_values(
|
|||
if !is_ellipse_select:
|
||||
break
|
||||
for x in range(w):
|
||||
if smaller_image.get_pixel(x,y) == Color(1,1,1,1) && (x < x_min[y] || x > x_max[y]):
|
||||
if smaller_image.get_pixel(x, y) == Color(1, 1, 1, 1) && (x < x_min[y] || x > x_max[y]):
|
||||
is_ellipse_select = false
|
||||
break
|
||||
# if selection is an ellipse selection, resized as standard ellipse
|
||||
|
@ -219,7 +227,9 @@ func resize_bitmap_values(
|
|||
smaller_image.resize(new_size.x, new_size.y, Image.INTERPOLATE_BILINEAR)
|
||||
else:
|
||||
var resized_img := Image.create(new_size.x, new_size.y, false, smaller_image.get_format())
|
||||
var new_ellipse_select := DrawingAlgos.get_ellipse_points_filled(Vector2.ZERO, Vector2i(new_size.x,new_size.y))
|
||||
var new_ellipse_select := DrawingAlgos.get_ellipse_points_filled(
|
||||
Vector2.ZERO, Vector2i(new_size.x, new_size.y)
|
||||
)
|
||||
for p in new_ellipse_select:
|
||||
resized_img.set_pixel(p.x, p.y, Color(1, 1, 1, 1))
|
||||
smaller_image = resized_img
|
||||
|
|
|
@ -31,12 +31,13 @@ func _input(_event: InputEvent) -> void:
|
|||
if type == Types.HORIZONTAL:
|
||||
point0.y -= width * INPUT_WIDTH
|
||||
point1.y += width * INPUT_WIDTH
|
||||
else:
|
||||
elif type == Types.VERTICAL:
|
||||
point0.x -= width * INPUT_WIDTH
|
||||
point1.x += width * INPUT_WIDTH
|
||||
var rect := Rect2()
|
||||
rect.position = point0
|
||||
rect.end = point1
|
||||
rect = rect.abs()
|
||||
if (
|
||||
Input.is_action_just_pressed(&"left_mouse")
|
||||
and Global.can_draw
|
||||
|
@ -55,7 +56,7 @@ func _input(_event: InputEvent) -> void:
|
|||
var yy := snappedf(mouse_pos.y, 0.5)
|
||||
points[0].y = yy
|
||||
points[1].y = yy
|
||||
else:
|
||||
elif type == Types.VERTICAL:
|
||||
var xx := snappedf(mouse_pos.x, 0.5)
|
||||
points[0].x = xx
|
||||
points[1].x = xx
|
||||
|
@ -234,7 +235,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:
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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"]
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue