mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-19 01:29:49 +00:00
[0.x] Fix undo/redo history not working when the tool changes (#916)
* remove_undo_redo_draw_op from Draw.gd * shifted undo_redo_draw_op to Global.gd
This commit is contained in:
parent
b2c157fa07
commit
be093f3490
|
@ -617,3 +617,7 @@ func convert_dictionary_values(dict: Dictionary) -> void:
|
||||||
dict[key] = str2var("Vector2" + dict[key])
|
dict[key] = str2var("Vector2" + dict[key])
|
||||||
elif "size" in key or "center_offset" in key: # Convert a String to a Vector3
|
elif "size" in key or "center_offset" in key: # Convert a String to a Vector3
|
||||||
dict[key] = str2var("Vector3" + dict[key])
|
dict[key] = str2var("Vector3" + dict[key])
|
||||||
|
|
||||||
|
|
||||||
|
func undo_redo_draw_op(image: Object, compressed_image_data: Dictionary, buffer_size: int) -> void:
|
||||||
|
image["data"]["data"] = compressed_image_data["data"].decompress(buffer_size)
|
||||||
|
|
|
@ -213,7 +213,7 @@ func commit_undo() -> void:
|
||||||
var buffer_size = compressed_data["data"].size()
|
var buffer_size = compressed_data["data"].size()
|
||||||
compressed_data["data"] = compressed_data["data"].compress()
|
compressed_data["data"] = compressed_data["data"].compress()
|
||||||
project.undo_redo.add_do_method(
|
project.undo_redo.add_do_method(
|
||||||
self, "undo_redo_draw_op", image, compressed_data, buffer_size
|
Global, "undo_redo_draw_op", image, compressed_data, buffer_size
|
||||||
)
|
)
|
||||||
image.unlock()
|
image.unlock()
|
||||||
for image in _undo_data:
|
for image in _undo_data:
|
||||||
|
@ -221,7 +221,7 @@ func commit_undo() -> void:
|
||||||
var buffer_size = compressed_data["data"].size()
|
var buffer_size = compressed_data["data"].size()
|
||||||
compressed_data["data"] = compressed_data["data"].compress()
|
compressed_data["data"] = compressed_data["data"].compress()
|
||||||
project.undo_redo.add_undo_method(
|
project.undo_redo.add_undo_method(
|
||||||
self, "undo_redo_draw_op", image, compressed_data, buffer_size
|
Global, "undo_redo_draw_op", image, compressed_data, buffer_size
|
||||||
)
|
)
|
||||||
project.undo_redo.add_do_method(Global, "undo_or_redo", false, frame, layer)
|
project.undo_redo.add_do_method(Global, "undo_or_redo", false, frame, layer)
|
||||||
project.undo_redo.add_undo_method(Global, "undo_or_redo", true, frame, layer)
|
project.undo_redo.add_undo_method(Global, "undo_or_redo", true, frame, layer)
|
||||||
|
@ -230,10 +230,6 @@ func commit_undo() -> void:
|
||||||
_undo_data.clear()
|
_undo_data.clear()
|
||||||
|
|
||||||
|
|
||||||
func undo_redo_draw_op(image: Object, compressed_image_data: Dictionary, buffer_size: int) -> void:
|
|
||||||
image["data"]["data"] = compressed_image_data["data"].decompress(buffer_size)
|
|
||||||
|
|
||||||
|
|
||||||
func draw_tool(position: Vector2) -> void:
|
func draw_tool(position: Vector2) -> void:
|
||||||
if Global.mirror_view:
|
if Global.mirror_view:
|
||||||
# Even brushes are not perfectly centred and are offsetted by 1 px so we add it
|
# Even brushes are not perfectly centred and are offsetted by 1 px so we add it
|
||||||
|
|
Loading…
Reference in a new issue