From 24818bfaea3de8639615fab73eab4c08d6691bf6 Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Tue, 3 Mar 2020 03:05:48 +0200 Subject: [PATCH] Cloning frames works --- Scripts/Canvas.gd | 2 +- Scripts/FrameButton.gd | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Scripts/Canvas.gd b/Scripts/Canvas.gd index 5c6e3c897..e7d082d4a 100644 --- a/Scripts/Canvas.gd +++ b/Scripts/Canvas.gd @@ -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. func _ready() -> void: var fill_layers := layers.empty() - for i in range(Global.layers.size()): + for l in Global.layers: if fill_layers: # The sprite itself var sprite := Image.new() diff --git a/Scripts/FrameButton.gd b/Scripts/FrameButton.gd index 154bf4ae0..fbc5d4c81 100644 --- a/Scripts/FrameButton.gd +++ b/Scripts/FrameButton.gd @@ -37,7 +37,7 @@ func _on_PopupMenu_id_pressed(ID : int) -> void: 0: # Remove Frame remove_frame() - 1: # Clone Layer + 1: # Clone Frame var canvas : Canvas = Global.canvases[frame] var new_canvas : Canvas = load("res://Prefabs/Canvas.tscn").instance() 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, "canvas", new_canvas) Global.undo_redo.add_do_property(Global, "current_frame", new_canvases.size() - 1) - for child in Global.frame_containers.get_children(): - var frame_button = child.get_node("FrameButton") - Global.undo_redo.add_do_property(frame_button, "pressed", false) - Global.undo_redo.add_undo_property(frame_button, "pressed", frame_button.pressed) + for i in range(Global.layers.size()): + for child in Global.layers[i][2].get_children(): + Global.undo_redo.add_do_property(child, "pressed", false) + Global.undo_redo.add_undo_property(child, "pressed", child.pressed) for c in Global.canvases: Global.undo_redo.add_do_property(c, "visible", false) 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.commit_action() - 2: #Move Left + 2: # Move Left change_frame_order(-1) - 3: #Move Right + 3: # Move Right change_frame_order(1) func remove_frame() -> void: