1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-21 21:13:14 +00:00

Cloning frames works

This commit is contained in:
OverloadedOrama 2020-03-03 03:05:48 +02:00
parent 120e47d0f9
commit 24818bfaea
2 changed files with 8 additions and 8 deletions

View file

@ -30,7 +30,7 @@ var pen_pressure := 1.0 # For tablet pressure sensitivity
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready() -> void: func _ready() -> void:
var fill_layers := layers.empty() var fill_layers := layers.empty()
for i in range(Global.layers.size()): for l in Global.layers:
if fill_layers: if fill_layers:
# The sprite itself # The sprite itself
var sprite := Image.new() var sprite := Image.new()

View file

@ -37,7 +37,7 @@ func _on_PopupMenu_id_pressed(ID : int) -> void:
0: # Remove Frame 0: # Remove Frame
remove_frame() remove_frame()
1: # Clone Layer 1: # Clone Frame
var canvas : Canvas = Global.canvases[frame] var canvas : Canvas = Global.canvases[frame]
var new_canvas : Canvas = load("res://Prefabs/Canvas.tscn").instance() var new_canvas : Canvas = load("res://Prefabs/Canvas.tscn").instance()
new_canvas.size = Global.canvas.size new_canvas.size = Global.canvas.size
@ -65,10 +65,10 @@ func _on_PopupMenu_id_pressed(ID : int) -> void:
Global.undo_redo.add_do_property(Global, "hidden_canvases", Global.hidden_canvases) Global.undo_redo.add_do_property(Global, "hidden_canvases", Global.hidden_canvases)
Global.undo_redo.add_do_property(Global, "canvas", new_canvas) Global.undo_redo.add_do_property(Global, "canvas", new_canvas)
Global.undo_redo.add_do_property(Global, "current_frame", new_canvases.size() - 1) Global.undo_redo.add_do_property(Global, "current_frame", new_canvases.size() - 1)
for child in Global.frame_containers.get_children(): for i in range(Global.layers.size()):
var frame_button = child.get_node("FrameButton") for child in Global.layers[i][2].get_children():
Global.undo_redo.add_do_property(frame_button, "pressed", false) Global.undo_redo.add_do_property(child, "pressed", false)
Global.undo_redo.add_undo_property(frame_button, "pressed", frame_button.pressed) Global.undo_redo.add_undo_property(child, "pressed", child.pressed)
for c in Global.canvases: for c in Global.canvases:
Global.undo_redo.add_do_property(c, "visible", false) Global.undo_redo.add_do_property(c, "visible", false)
Global.undo_redo.add_undo_property(c, "visible", c.visible) Global.undo_redo.add_undo_property(c, "visible", c.visible)
@ -79,9 +79,9 @@ func _on_PopupMenu_id_pressed(ID : int) -> void:
Global.undo_redo.add_undo_property(Global, "current_frame", Global.current_frame) Global.undo_redo.add_undo_property(Global, "current_frame", Global.current_frame)
Global.undo_redo.commit_action() Global.undo_redo.commit_action()
2: #Move Left 2: # Move Left
change_frame_order(-1) change_frame_order(-1)
3: #Move Right 3: # Move Right
change_frame_order(1) change_frame_order(1)
func remove_frame() -> void: func remove_frame() -> void: