1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-03-16 08:15:18 +00:00

Compare commits

..

No commits in common. "49b1403e486c0b99770398abe9a77ef0385543bc" and "b0d4b30fbf5e4fb4e4cccbc907decbb39736a4bc" have entirely different histories.

3 changed files with 18 additions and 38 deletions

View file

@ -37,7 +37,6 @@ Built using Godot 3.5.2
- The ellipse tool no longer produces gaps with large sizes. [4f3a7a305a264e0d2fe86c201af76eca4b2fea0a](https://github.com/Orama-Interactive/Pixelorama/commit/4f3a7a305a264e0d2fe86c201af76eca4b2fea0a)
- Fix "visible layers" option on the export dialog producing wrong results. [346d1f071a8c6b1defb1072d39aea9c642f1ef59](https://github.com/Orama-Interactive/Pixelorama/commit/346d1f071a8c6b1defb1072d39aea9c642f1ef59)
- Random brushes now work again. [1317e40ffa5e9f01a9d214221bb5133db20a1de9](https://github.com/Orama-Interactive/Pixelorama/commit/1317e40ffa5e9f01a9d214221bb5133db20a1de9)
- Fixed issue where the override.cfg file would be created at the wrong location, if Pixelorama is launched through a shortcut.
- The gizmo in the rotation image effect dialog is now accurately following the mouse.
- Fixed the size label not being updated on the Export dialog's spritesheet tab when the direction changes.

View file

@ -539,7 +539,7 @@ func _renderer_changed(value: int) -> void:
ProjectSettings.set_initial_value("rendering/quality/driver/driver_name", "GLES2")
var renderer_name := OS.get_video_driver_name(renderer)
ProjectSettings.set_setting("rendering/quality/driver/driver_name", renderer_name)
ProjectSettings.save_custom(root_directory.plus_file(OVERRIDE_FILE))
ProjectSettings.save_custom(OVERRIDE_FILE)
func _tablet_driver_changed(value: int) -> void:
@ -548,7 +548,7 @@ func _tablet_driver_changed(value: int) -> void:
return
var tablet_driver_name := OS.get_tablet_driver_name(tablet_driver)
ProjectSettings.set_setting("display/window/tablet_driver", tablet_driver_name)
ProjectSettings.save_custom(root_directory.plus_file(OVERRIDE_FILE))
ProjectSettings.save_custom(OVERRIDE_FILE)
func dialog_open(open: bool) -> void:
@ -651,3 +651,13 @@ func undo_redo_draw_op(
var decompressed := compressed_image_data.decompress(buffer_size)
image.crop(new_size.x, new_size.y)
image.data["data"] = decompressed
## Used by the Move tool for undo/redo, moves all of the Images in the images array
## by diff pixels.
func undo_redo_move(diff: Vector2, images: Array) -> void:
for image in images:
var image_copy := Image.new()
image_copy.copy_from(image)
image.fill(Color(0, 0, 0, 0))
image.blit_rect(image_copy, Rect2(Vector2.ZERO, image.get_size()), diff)

View file

@ -2,11 +2,11 @@ extends BaseTool
var _start_pos: Vector2
var _offset: Vector2
# Used to check if the state of content transformation has been changed
# while draw_move() is being called. For example, pressing Enter while still moving content
var _content_transformation_check := false
var _snap_to_grid := false # Mouse Click + Ctrl
var _undo_data := {}
onready var selection_node: Node2D = Global.canvas.selection
@ -41,7 +41,6 @@ func draw_start(position: Vector2) -> void:
return
_start_pos = position
_offset = position
_undo_data = _get_undo_data()
if Global.current_project.has_selection:
selection_node.transform_content_start()
_content_transformation_check = selection_node.is_moving_content
@ -82,14 +81,7 @@ func draw_end(position: Vector2) -> void:
else:
var pixel_diff: Vector2 = position - _start_pos
Global.canvas.move_preview_location = Vector2.ZERO
var images := _get_selected_draw_images()
for image in images:
var image_copy := Image.new()
image_copy.copy_from(image)
image.fill(Color(0, 0, 0, 0))
image.blit_rect(image_copy, Rect2(Vector2.ZERO, project.size), pixel_diff)
commit_undo("Draw")
commit_undo("Draw", pixel_diff)
_start_pos = Vector2.INF
_snap_to_grid = false
@ -122,39 +114,18 @@ func _snap_position(position: Vector2) -> Vector2:
return position
func commit_undo(action: String) -> void:
var redo_data := _get_undo_data()
func commit_undo(action: String, diff: Vector2) -> void:
var project: Project = Global.current_project
var frame := -1
var layer := -1
if Global.animation_timer.is_stopped() and project.selected_cels.size() == 1:
frame = project.current_frame
layer = project.current_layer
var images := _get_selected_draw_images()
project.undos += 1
project.undo_redo.create_action(action)
Global.undo_redo_compress_images(redo_data, _undo_data, project)
project.undo_redo.add_do_method(Global, "undo_redo_move", diff, images)
project.undo_redo.add_do_method(Global, "undo_or_redo", false, frame, layer)
project.undo_redo.add_undo_method(Global, "undo_redo_move", -diff, images)
project.undo_redo.add_undo_method(Global, "undo_or_redo", true, frame, layer)
project.undo_redo.commit_action()
func _get_undo_data() -> Dictionary:
var data := {}
var project: Project = Global.current_project
var cels := [] # Array of Cels
if Global.animation_timer.is_stopped():
for cel_index in project.selected_cels:
cels.append(project.frames[cel_index[0]].cels[cel_index[1]])
else:
for frame in project.frames:
var cel: BaseCel = frame.cels[project.current_layer]
cels.append(cel)
for cel in cels:
if not cel is PixelCel:
continue
var image: Image = cel.image
image.unlock()
data[image] = image.data
image.lock()
return data