diff --git a/Changelog.md b/Changelog.md index 372aad08b..5cc43d8b4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -17,10 +17,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - A VSplitContainer has been added between the canvas and the timeline. - Notification text is now black on the gold and light themes. - Layer's LineEdit now saves the changes when it loses focus, or when the user presses ESC (or Enter) +- LineEdits lose focus when the user presses Enter - thanks to Gaarco! +- Layer visibility is taken into account when exporting the drawing as a .png file. This means that invisible layers will not be included in the final .png file. ### Fixed - Chinese characters not being rendered in notifications (the labels that appear when undoing/redoing) - Fixed issue when moving frames, the current frame was being shown but the frame next to it was actually the one being drawn on. +- Fixed issue with LineEdits not letting go of focus when the user clicked somewhere else - Thanks to Gaarco! (Issue #167) ## [v0.6.2] - 17-02-2020 diff --git a/Scripts/Dialogs/ExportSprites.gd b/Scripts/Dialogs/ExportSprites.gd index b7040ad15..40cfdb1a5 100644 --- a/Scripts/Dialogs/ExportSprites.gd +++ b/Scripts/Dialogs/ExportSprites.gd @@ -74,18 +74,22 @@ func save_sprite(canvas : Canvas, path : String) -> void: var whole_image := Image.new() whole_image.create(canvas.size.x, canvas.size.y, false, Image.FORMAT_RGBA8) whole_image.lock() + var layer_i := 0 for layer in canvas.layers: - var img : Image = layer[0] - img.lock() - if layer[2] < 1: # If we have layer transparency - for xx in img.get_size().x: - for yy in img.get_size().y: - var pixel_color := img.get_pixel(xx, yy) - var alpha : float = pixel_color.a * layer[4] - img.set_pixel(xx, yy, Color(pixel_color.r, pixel_color.g, pixel_color.b, alpha)) + if Global.layers[layer_i][1]: # If layer is visible + var img : Image = layer[0] + img.lock() + if layer[2] < 1: # If we have layer transparency + for xx in img.get_size().x: + for yy in img.get_size().y: + var pixel_color := img.get_pixel(xx, yy) + var alpha : float = pixel_color.a * layer[4] + img.set_pixel(xx, yy, Color(pixel_color.r, pixel_color.g, pixel_color.b, alpha)) - canvas.blend_rect(whole_image, img, Rect2(canvas.position, canvas.size), Vector2.ZERO) - layer[0].lock() + canvas.blend_rect(whole_image, img, Rect2(canvas.position, canvas.size), Vector2.ZERO) + layer[0].lock() + + layer_i += 1 if resize != 100: whole_image.unlock() @@ -129,18 +133,22 @@ func save_spritesheet() -> void: hh = 1 dst.y = canvas.size.y * vv + var layer_i := 0 for layer in canvas.layers: - var img : Image = layer[0] - img.lock() - if layer[2] < 1: # If we have layer transparency - for xx in img.get_size().x: - for yy in img.get_size().y: - var pixel_color := img.get_pixel(xx, yy) - var alpha : float = pixel_color.a * layer[4] - img.set_pixel(xx, yy, Color(pixel_color.r, pixel_color.g, pixel_color.b, alpha)) + if Global.layers[layer_i][1]: # If layer is visible + var img : Image = layer[0] + img.lock() + if layer[2] < 1: # If we have layer transparency + for xx in img.get_size().x: + for yy in img.get_size().y: + var pixel_color := img.get_pixel(xx, yy) + var alpha : float = pixel_color.a * layer[4] + img.set_pixel(xx, yy, Color(pixel_color.r, pixel_color.g, pixel_color.b, alpha)) - canvas.blend_rect(whole_image, img, Rect2(canvas.position, canvas.size), dst) - layer[0].lock() + canvas.blend_rect(whole_image, img, Rect2(canvas.position, canvas.size), dst) + layer[0].lock() + + layer_i += 1 if resize != 100: whole_image.unlock()