mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 09:09:47 +00:00
Symmetry guides now adjust their position when the image is being resized
Fixes #379
This commit is contained in:
parent
54c6c86099
commit
4d85cf1a10
|
@ -33,6 +33,7 @@ PinyaColada, Rémi Verschelde (akien-mga), dasimonde, gschwind, AbhinavKDev
|
||||||
- Fixed issues where fully transparent color could not be picked. One of these cases was [#364](https://github.com/Orama-Interactive/Pixelorama/issues/364).
|
- Fixed issues where fully transparent color could not be picked. One of these cases was [#364](https://github.com/Orama-Interactive/Pixelorama/issues/364).
|
||||||
- Fixed "Export" option in the File menu not working properly and not remembering the directory path and file name when switching between projects (tabs).
|
- Fixed "Export" option in the File menu not working properly and not remembering the directory path and file name when switching between projects (tabs).
|
||||||
- When opening a .pxo project which has guides, they will no longer be added to the project at the first tab too.
|
- When opening a .pxo project which has guides, they will no longer be added to the project at the first tab too.
|
||||||
|
- Symmetry guides now adjust their position when the image is being resized. ([#379](https://github.com/Orama-Interactive/Pixelorama/issues/379))
|
||||||
- Fixed Chinese and Korean characters not displaying properly in the Splash dialog and the About dialog.
|
- Fixed Chinese and Korean characters not displaying properly in the Splash dialog and the About dialog.
|
||||||
- Fixed crash when importing an incorrectly formatted GIMP Color Palette file. ([#363](https://github.com/Orama-Interactive/Pixelorama/issues/363))
|
- Fixed crash when importing an incorrectly formatted GIMP Color Palette file. ([#363](https://github.com/Orama-Interactive/Pixelorama/issues/363))
|
||||||
- Using the lighten/darken on pixels with an alpha value of 0 no longer has an effect on them.
|
- Using the lighten/darken on pixels with an alpha value of 0 no longer has an effect on them.
|
||||||
|
|
|
@ -235,9 +235,7 @@ func colorDistance(c1 : Color, c2 : Color) -> float:
|
||||||
# Image effects
|
# Image effects
|
||||||
|
|
||||||
func scale_image(width : int, height : int, interpolation : int) -> void:
|
func scale_image(width : int, height : int, interpolation : int) -> void:
|
||||||
Global.current_project.undos += 1
|
general_do_scale(width, height)
|
||||||
Global.current_project.undo_redo.create_action("Scale")
|
|
||||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "size", Vector2(width, height).floor())
|
|
||||||
|
|
||||||
for f in Global.current_project.frames:
|
for f in Global.current_project.frames:
|
||||||
for i in range(f.cels.size() - 1, -1, -1):
|
for i in range(f.cels.size() - 1, -1, -1):
|
||||||
|
@ -254,10 +252,7 @@ func scale_image(width : int, height : int, interpolation : int) -> void:
|
||||||
Global.current_project.undo_redo.add_do_property(f.cels[i].image, "data", sprite.data)
|
Global.current_project.undo_redo.add_do_property(f.cels[i].image, "data", sprite.data)
|
||||||
Global.current_project.undo_redo.add_undo_property(f.cels[i].image, "data", f.cels[i].image.data)
|
Global.current_project.undo_redo.add_undo_property(f.cels[i].image, "data", f.cels[i].image.data)
|
||||||
|
|
||||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "size", Global.current_project.size)
|
general_undo_scale()
|
||||||
Global.current_project.undo_redo.add_undo_method(Global, "undo")
|
|
||||||
Global.current_project.undo_redo.add_do_method(Global, "redo")
|
|
||||||
Global.current_project.undo_redo.commit_action()
|
|
||||||
|
|
||||||
|
|
||||||
func crop_image(image : Image) -> void:
|
func crop_image(image : Image) -> void:
|
||||||
|
@ -284,9 +279,7 @@ func crop_image(image : Image) -> void:
|
||||||
|
|
||||||
var width := used_rect.size.x
|
var width := used_rect.size.x
|
||||||
var height := used_rect.size.y
|
var height := used_rect.size.y
|
||||||
Global.current_project.undos += 1
|
general_do_scale(width, height)
|
||||||
Global.current_project.undo_redo.create_action("Scale")
|
|
||||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "size", Vector2(width, height).floor())
|
|
||||||
for f in Global.current_project.frames:
|
for f in Global.current_project.frames:
|
||||||
# Loop through all the layers to crop them
|
# Loop through all the layers to crop them
|
||||||
for j in range(Global.current_project.layers.size() - 1, -1, -1):
|
for j in range(Global.current_project.layers.size() - 1, -1, -1):
|
||||||
|
@ -294,16 +287,11 @@ func crop_image(image : Image) -> void:
|
||||||
Global.current_project.undo_redo.add_do_property(f.cels[j].image, "data", sprite.data)
|
Global.current_project.undo_redo.add_do_property(f.cels[j].image, "data", sprite.data)
|
||||||
Global.current_project.undo_redo.add_undo_property(f.cels[j].image, "data", f.cels[j].image.data)
|
Global.current_project.undo_redo.add_undo_property(f.cels[j].image, "data", f.cels[j].image.data)
|
||||||
|
|
||||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "size", Global.current_project.size)
|
general_undo_scale()
|
||||||
Global.current_project.undo_redo.add_undo_method(Global, "undo")
|
|
||||||
Global.current_project.undo_redo.add_do_method(Global, "redo")
|
|
||||||
Global.current_project.undo_redo.commit_action()
|
|
||||||
|
|
||||||
|
|
||||||
func resize_canvas(width : int, height : int, offset_x : int, offset_y : int) -> void:
|
func resize_canvas(width : int, height : int, offset_x : int, offset_y : int) -> void:
|
||||||
Global.current_project.undos += 1
|
general_do_scale(width, height)
|
||||||
Global.current_project.undo_redo.create_action("Scale")
|
|
||||||
Global.current_project.undo_redo.add_do_property(Global.current_project, "size", Vector2(width, height).floor())
|
|
||||||
for f in Global.current_project.frames:
|
for f in Global.current_project.frames:
|
||||||
for c in f.cels:
|
for c in f.cels:
|
||||||
var sprite := Image.new()
|
var sprite := Image.new()
|
||||||
|
@ -312,7 +300,36 @@ func resize_canvas(width : int, height : int, offset_x : int, offset_y : int) ->
|
||||||
Global.current_project.undo_redo.add_do_property(c.image, "data", sprite.data)
|
Global.current_project.undo_redo.add_do_property(c.image, "data", sprite.data)
|
||||||
Global.current_project.undo_redo.add_undo_property(c.image, "data", c.image.data)
|
Global.current_project.undo_redo.add_undo_property(c.image, "data", c.image.data)
|
||||||
|
|
||||||
|
general_undo_scale()
|
||||||
|
|
||||||
|
|
||||||
|
func general_do_scale(width : int, height : int) -> void:
|
||||||
|
var x_ratio = Global.current_project.size.x / width
|
||||||
|
var y_ratio = Global.current_project.size.y / height
|
||||||
|
var new_x_symmetry_point = Global.current_project.x_symmetry_point / x_ratio
|
||||||
|
var new_y_symmetry_point = Global.current_project.y_symmetry_point / y_ratio
|
||||||
|
var new_x_symmetry_axis_points = Global.current_project.x_symmetry_axis.points
|
||||||
|
var new_y_symmetry_axis_points = Global.current_project.y_symmetry_axis.points
|
||||||
|
new_x_symmetry_axis_points[0].y /= y_ratio
|
||||||
|
new_x_symmetry_axis_points[1].y /= y_ratio
|
||||||
|
new_y_symmetry_axis_points[0].x /= x_ratio
|
||||||
|
new_y_symmetry_axis_points[1].x /= x_ratio
|
||||||
|
|
||||||
|
Global.current_project.undos += 1
|
||||||
|
Global.current_project.undo_redo.create_action("Scale")
|
||||||
|
Global.current_project.undo_redo.add_do_property(Global.current_project, "size", Vector2(width, height).floor())
|
||||||
|
Global.current_project.undo_redo.add_do_property(Global.current_project, "x_symmetry_point", new_x_symmetry_point)
|
||||||
|
Global.current_project.undo_redo.add_do_property(Global.current_project, "y_symmetry_point", new_y_symmetry_point)
|
||||||
|
Global.current_project.undo_redo.add_do_property(Global.current_project.x_symmetry_axis, "points", new_x_symmetry_axis_points)
|
||||||
|
Global.current_project.undo_redo.add_do_property(Global.current_project.y_symmetry_axis, "points", new_y_symmetry_axis_points)
|
||||||
|
|
||||||
|
|
||||||
|
func general_undo_scale() -> void:
|
||||||
Global.current_project.undo_redo.add_undo_property(Global.current_project, "size", Global.current_project.size)
|
Global.current_project.undo_redo.add_undo_property(Global.current_project, "size", Global.current_project.size)
|
||||||
|
Global.current_project.undo_redo.add_undo_property(Global.current_project, "x_symmetry_point", Global.current_project.x_symmetry_point)
|
||||||
|
Global.current_project.undo_redo.add_undo_property(Global.current_project, "y_symmetry_point", Global.current_project.y_symmetry_point)
|
||||||
|
Global.current_project.undo_redo.add_undo_property(Global.current_project.x_symmetry_axis, "points", Global.current_project.x_symmetry_axis.points)
|
||||||
|
Global.current_project.undo_redo.add_undo_property(Global.current_project.y_symmetry_axis, "points", Global.current_project.y_symmetry_axis.points)
|
||||||
Global.current_project.undo_redo.add_undo_method(Global, "undo")
|
Global.current_project.undo_redo.add_undo_method(Global, "undo")
|
||||||
Global.current_project.undo_redo.add_do_method(Global, "redo")
|
Global.current_project.undo_redo.add_do_method(Global, "redo")
|
||||||
Global.current_project.undo_redo.commit_action()
|
Global.current_project.undo_redo.commit_action()
|
||||||
|
|
Loading…
Reference in a new issue