Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AtlasTexture saved with region 0,0,0,0 (no region) spams error in console #28691

Open
Ranoller opened this issue May 5, 2019 · 4 comments
Open

Comments

@Ranoller
Copy link
Contributor

Ranoller commented May 5, 2019

Godot version:

7018de8

OS/device including version:

win 7 64

Issue description:

Saving an Atlas texture with not region (x=0, y=0, w=0,h=0) will allways spam thit at the project open:
AtalsSpam
Problem is not the warning... problem is that you don´t know what texture is failing, so in a big project you can have that mensage allways spamming at open and you will never find what is causing that.

Steps to reproduce:
Save an atlas texture to a tres file with no region.

Edit: i will copy error in text for googling help purpose:

Image::create: Index p_widht - 1=-1 out of size (MAX_WIDTH=16384)
At: core\image.cpp:1443
Image::blit_rect: Condition ' dsize == 0 ' is true.
At: core\image.cpp:1927

@bojidar-bg
Copy link
Contributor

Here is a backtrace of the error:

#0  Image::create (this=0x7fffc40e2270, p_width=0, p_height=0, p_use_mipmaps=true, p_format=Image::FORMAT_DXT1) at core/image.cpp:1443
#1  0x00000000043d1c13 in Image::Image (this=0x7fffc40e2270, p_width=0, p_height=0, p_use_mipmaps=true, p_format=Image::FORMAT_DXT1) at core/image.cpp:1864
#2  0x00000000043d20ff in Image::get_rect (this=0xc1b2c50, p_area=...) at core/image.cpp:1917
#3  0x0000000002b7cbde in EditorTexturePreviewPlugin::generate (this=0xaa24740, p_from=..., p_size=...) at editor/plugins/editor_preview_plugins.cpp:101
#4  0x00000000027155d8 in EditorResourcePreviewGenerator::generate_from_path (this=0xaa24740, p_path=..., p_size=...) at editor/editor_resource_preview.cpp:71
#5  0x0000000002717f8c in EditorResourcePreview::_generate_preview (this=0x7b0f3b0, r_texture=..., r_small_texture=..., p_item=..., cache_base=...)
    at editor/editor_resource_preview.cpp:153
#6  0x0000000002716a3e in EditorResourcePreview::_thread (this=0x7b0f3b0) at editor/editor_resource_preview.cpp:242
#7  0x000000000271616d in EditorResourcePreview::_thread_func (ud=0x7b0f3b0) at editor/editor_resource_preview.cpp:93
#8  0x00000000023d0eb9 in ThreadPosix::thread_callback (userdata=0xb649ae0) at drivers/unix/thread_posix.cpp:74
#9  0x00007ffff74f7a92 in start_thread () from /usr/lib/libpthread.so.0
#10 0x00007ffff7130cd3 in clone () from /usr/lib/libc.so.6

The error comes from the fact that width - 1 = -1 which is less than 0. Not sure if images with width or height of 0 cause problems though.

The check was added in #18629, CC @raphael10241024.

@Raphael2048
Copy link
Contributor

I just copied the code from a creation function below.
I think an image with width or height of 0 should not be allowed, we shouldn't try to create an image when atlas contains nothing.

@bojidar-bg bojidar-bg added this to the 3.2 milestone May 12, 2019
@Ranoller
Copy link
Contributor Author

Main problem with this issue is not the error, is the problem of the unindentified texture. The error doesn´t help in a project with thousand of images, you can´t find the failure manually, it can be a png, a region, etc... ,error should give to the user the path to the failing resource.

@akien-mga akien-mga modified the milestones: 3.2, 4.0 Dec 13, 2019
@akien-mga
Copy link
Member

akien-mga commented Jan 25, 2022

Seems to be fixed in 3.4.2 (no error).

Edit: Actually I can reproduce it, but for some reason the error was not shown in the Output panel and only in the console:

ERROR: Image width must be greater than 0.
   at: create (core/image.cpp:1736)
ERROR: Condition "dsize == 0" is true.
   at: blit_rect (core/image.cpp:2231)

@akien-mga akien-mga modified the milestones: 4.0, 3.4 Jan 25, 2022
@akien-mga akien-mga reopened this Jan 25, 2022
@akien-mga akien-mga removed this from the 3.4 milestone Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants