From 9ca564cfe18630d870e61b4657ba0f640c6f731e Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Sat, 21 Mar 2020 22:55:36 +0200 Subject: [PATCH] Cel unlinking now works properly Undo/redo can have some weird behavior right now --- Changelog.md | 5 ++++- Prefabs/FrameButton.tscn | 2 +- Scripts/FrameButton.gd | 18 +++++++++++++----- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Changelog.md b/Changelog.md index 5cc43d8b4..090d37348 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,10 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [v0.7] - Unreleased ### Added +- Cels are now in the timeline. Each cel refers to a specific layer AND a frame. Frames are a collection of cels for every layer. +- Cel linking is now possible. This way, layers can be "shared" in multiple frames. - Importing .pngs as palettes is now possible - thanks to Martin Novák (novhack)! - A confirmation message now appears when the user quits Pixelorama, if there are unsaved changes - thanks to Schweini07! - Locking layers is now possible. When a layer is locked, no changes can be made to it. Layers are unlocked by default. -- Ability to get color for palette buttons, when editing a palette, from the currently selected left and right colors +- Ability to get color for palette buttons, when editing a palette, from the currently selected left and right colors. +- Esperanto translation - thanks to Teashrock! ### Changed - The timeline has been revamped! diff --git a/Prefabs/FrameButton.tscn b/Prefabs/FrameButton.tscn index 37d5eb747..44403fb8c 100644 --- a/Prefabs/FrameButton.tscn +++ b/Prefabs/FrameButton.tscn @@ -35,7 +35,7 @@ __meta__ = { margin_right = 20.0 margin_bottom = 20.0 mouse_default_cursor_shape = 2 -items = [ "Remove Frame", null, 0, false, true, -1, 0, null, "", false, "Clone Frame", null, 0, false, false, -1, 0, null, "", false, "Move Left", null, 0, false, true, -1, 0, null, "", false, "Move Right", null, 0, false, true, -1, 0, null, "", false, "Unlink Cell", null, 0, false, true, 4, 0, null, "", false ] +items = [ "Remove Frame", null, 0, false, true, -1, 0, null, "", false, "Clone Frame", null, 0, false, false, -1, 0, null, "", false, "Move Left", null, 0, false, true, -1, 0, null, "", false, "Move Right", null, 0, false, true, -1, 0, null, "", false, "Unlink Cel", null, 0, false, true, 4, 0, null, "", false ] [node name="LinkedIndicator" type="Polygon2D" parent="."] visible = false diff --git a/Scripts/FrameButton.gd b/Scripts/FrameButton.gd index 22ca165b1..3cfacf83c 100644 --- a/Scripts/FrameButton.gd +++ b/Scripts/FrameButton.gd @@ -9,10 +9,10 @@ func _ready() -> void: hint_tooltip = "Frame: %s, Layer: %s" % [frame, layer] if Global.canvases[frame] in Global.layers[layer][5]: get_node("LinkedIndicator").visible = true - popup_menu.set_item_disabled(4, false) # Unlink cell + popup_menu.set_item_disabled(4, false) # Unlink cel else: get_node("LinkedIndicator").visible = false - popup_menu.set_item_disabled(4, true) # Unlink cell + popup_menu.set_item_disabled(4, true) # Unlink cel func _on_FrameButton_pressed() -> void: if Input.is_action_just_released("left_mouse"): @@ -87,11 +87,19 @@ func _on_PopupMenu_id_pressed(ID : int) -> void: change_frame_order(-1) 3: # Move Right change_frame_order(1) - 4: # Unlink Cell - var cell_index : int = Global.layers[layer][5].find(Global.canvases[frame]) - Global.layers[layer][5].remove(cell_index) + 4: # Unlink Cel + var cel_index : int = Global.layers[layer][5].find(Global.canvases[frame]) + Global.layers[layer][5].remove(cel_index) _ready() + var sprite := Image.new() + sprite.copy_from(Global.canvases[frame].layers[layer][0]) + sprite.lock() + Global.canvases[frame].layers[layer][0] = sprite + var tex := ImageTexture.new() + tex.create_from_image(sprite, 0) + Global.canvases[frame].layers[layer][1] = tex + func remove_frame() -> void: var canvas : Canvas = Global.canvases[frame] var new_canvases := Global.canvases.duplicate()