mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Fix bug where images with width or height 1 are being completely cleared by image effects
This commit is contained in:
parent
49b1403e48
commit
fcfc606861
|
@ -33,6 +33,7 @@ Built using Godot 3.5.2
|
|||
- The same frames are no longer being exported multiple times when "Selected frames" is selected, and multiple cels of the same frames are currently selected on the timeline. [#1001](https://github.com/Orama-Interactive/Pixelorama/issues/1001)
|
||||
- Fixed crash due to division by zero when locking two or three ValueSliders, and one of them has the value of 0 and the user attempts to change it.
|
||||
- Fixed exporting selected layers not including the non-selected frames.
|
||||
- Fix bug where images with width or height 1 are being completely cleared by image effects.
|
||||
- Made the color picker not select fully transparent pixels that are not black. [#999](https://github.com/Orama-Interactive/Pixelorama/issues/999)
|
||||
- The ellipse tool no longer produces gaps with large sizes. [4f3a7a305a264e0d2fe86c201af76eca4b2fea0a](https://github.com/Orama-Interactive/Pixelorama/commit/4f3a7a305a264e0d2fe86c201af76eca4b2fea0a)
|
||||
- Fix "visible layers" option on the export dialog producing wrong results. [346d1f071a8c6b1defb1072d39aea9c642f1ef59](https://github.com/Orama-Interactive/Pixelorama/commit/346d1f071a8c6b1defb1072d39aea9c642f1ef59)
|
||||
|
|
|
@ -6,6 +6,16 @@ signal done
|
|||
|
||||
func generate_image(img: Image, shader: Shader, params: Dictionary, size: Vector2) -> void:
|
||||
img.unlock()
|
||||
var resized_width := false
|
||||
var resized_height := false
|
||||
if size.x == 1:
|
||||
size.x = 2
|
||||
img.crop(2, img.get_height())
|
||||
resized_width = true
|
||||
if size.y == 1:
|
||||
size.y = 2
|
||||
img.crop(img.get_width(), 2)
|
||||
resized_height = true
|
||||
# duplicate shader before modifying code to avoid affecting original resource
|
||||
shader = shader.duplicate()
|
||||
shader.code = shader.code.replace("unshaded", "unshaded, blend_premul_alpha")
|
||||
|
@ -42,4 +52,8 @@ func generate_image(img: Image, shader: Shader, params: Dictionary, size: Vector
|
|||
VisualServer.free_rid(texture)
|
||||
viewport_texture.convert(Image.FORMAT_RGBA8)
|
||||
img.copy_from(viewport_texture)
|
||||
if resized_width:
|
||||
img.crop(img.get_width() - 1, img.get_height())
|
||||
if resized_height:
|
||||
img.crop(img.get_width(), img.get_height() - 1)
|
||||
emit_signal("done")
|
||||
|
|
Loading…
Reference in a new issue