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

Turn Symmetry Guides visibility on and off if mirroring is enabled

Also fixed issue with "Show Guides" view menu option and having multiple projects with guides. Only think remaining is to make the Symmetry Guides look different than regular guides. Closes #133.
This commit is contained in:
OverloadedOrama 2020-07-16 05:05:40 +03:00
parent 9fa91ffd8e
commit a5a8bf1fe5
6 changed files with 26 additions and 2 deletions

View file

@ -15,6 +15,7 @@ Darshan Phaldesai (luiq54), Igor Santarek (jegor377), rob-a-bolton, Kinwailo
- You can now drag & drop files into the program while it's running to open them. You can open .pxo files, image files and palette (json and gpl) files this way.
- You can now draw on the tiling mode previews! ([#65](https://github.com/Orama-Interactive/Pixelorama/issues/65))
- Added Resize Canvas option to Image menu.
- Added Symmetry Guides. They let you change the axis of symmetry for mirroring. ([#133](https://github.com/Orama-Interactive/Pixelorama/issues/133))
- Palettes can now be created from the colors of the selected sprite.
- You can now preview how the frames of the spritesheet you are importing will look.
- You can now import image files as layers. Their size will be cropped to the project's size.

View file

@ -42,6 +42,8 @@ var right_cursor_tool_texture := ImageTexture.new()
var image_clipboard : Image
var play_only_tags := true
var show_x_symmetry_axis := false
var show_y_symmetry_axis := false
# Preferences
var theme_type : int = Theme_Types.DARK

View file

@ -126,7 +126,12 @@ func change_project() -> void:
for guide in Global.canvas.get_children():
if guide is Guide:
if guide in guides:
guide.visible = true
guide.visible = Global.show_guides
if guide is SymmetryGuide:
if guide.type == Guide.Types.HORIZONTAL:
guide.visible = Global.show_x_symmetry_axis and Global.show_guides
else:
guide.visible = Global.show_y_symmetry_axis and Global.show_guides
else:
guide.visible = false

View file

@ -27,11 +27,21 @@ func _on_PixelPerfect_toggled(button_pressed : bool):
func _on_Horizontal_toggled(button_pressed : bool):
tool_slot.horizontal_mirror = button_pressed
tool_slot.save_config()
Global.show_y_symmetry_axis = button_pressed
# If the button is not pressed but another button is, keep the symmetry guide visible
if !button_pressed and (Tools._slots[BUTTON_LEFT].horizontal_mirror or Tools._slots[BUTTON_RIGHT].horizontal_mirror):
Global.show_y_symmetry_axis = true
Global.current_project.y_symmetry_axis.visible = Global.show_y_symmetry_axis and Global.show_guides
func _on_Vertical_toggled(button_pressed : bool):
tool_slot.vertical_mirror = button_pressed
tool_slot.save_config()
Global.show_x_symmetry_axis = button_pressed
# If the button is not pressed but another button is, keep the symmetry guide visible
if !button_pressed and (Tools._slots[BUTTON_LEFT].vertical_mirror or Tools._slots[BUTTON_RIGHT].vertical_mirror):
Global.show_x_symmetry_axis = true
Global.current_project.x_symmetry_axis.visible = Global.show_x_symmetry_axis and Global.show_guides
func save_config() -> void:

View file

@ -4,6 +4,7 @@ class_name SymmetryGuide extends Guide
func _ready() -> void:
._ready()
has_focus = false
visible = false
func _input(_event : InputEvent) -> void:

View file

@ -260,8 +260,13 @@ func toggle_show_guides() -> void:
Global.show_guides = !Global.show_guides
view_menu.set_item_checked(3, Global.show_guides)
for guide in Global.canvas.get_children():
if guide is Guide:
if guide is Guide and guide in Global.current_project.guides:
guide.visible = Global.show_guides
if guide is SymmetryGuide:
if guide.type == Guide.Types.HORIZONTAL:
guide.visible = Global.show_x_symmetry_axis and Global.show_guides
else:
guide.visible = Global.show_y_symmetry_axis and Global.show_guides
func toggle_show_anim_timeline() -> void: