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

Cannot load image texture to sprite #23574

Closed
ssj71 opened this issue Nov 7, 2018 · 6 comments
Closed

Cannot load image texture to sprite #23574

ssj71 opened this issue Nov 7, 2018 · 6 comments
Labels

Comments

@ssj71
Copy link

ssj71 commented Nov 7, 2018

Godot version:
3.1 alpha 2

OS/device including version:
Ubuntu Linux 16.04 (using i3wm)

Issue description:
when trying to load an image in my resources (icon.png) into a new texture in a sprite the image property remains empty and the following error appears in the output window:

Set texture

 drivers/gles3/rasterizer_storage_gles3.cpp:1035 - Condition ' !texture->active ' is true. returned: Ref<Image>()
 drivers/gles3/rasterizer_storage_gles3.cpp:1035 - Condition ' !texture->active ' is true. returned: Ref<Image>()
 drivers/gles3/rasterizer_storage_gles3.cpp:1035 - Condition ' !texture->active ' is true. returned: Ref<Image>()
 drivers/gles3/rasterizer_storage_gles3.cpp:1035 - Condition ' !texture->active ' is true. returned: Ref<Image>()
 drivers/gles3/rasterizer_storage_gles3.cpp:1035 - Condition ' !texture->active ' is true. returned: Ref<Image>()
 drivers/gles3/rasterizer_storage_gles3.cpp:1035 - Condition ' !texture->active ' is true. returned: Ref<Image>()
 drivers/gles3/rasterizer_storage_gles3.cpp:1035 - Condition ' !texture->active ' is true. returned: Ref<Image>()
 drivers/gles3/rasterizer_storage_gles3.cpp:1035 - Condition ' !texture->active ' is true. returned: Ref<Image>()
 scene/resources/texture.cpp:191 - Condition ' p_image.is_null() ' is true.
 drivers/gles3/rasterizer_storage_gles3.cpp:1035 - Condition ' !texture->active ' is true. returned: Ref<Image>()
 drivers/gles3/rasterizer_storage_gles3.cpp:1035 - Condition ' !texture->active ' is true. returned: Ref<Image>()
 drivers/gles3/rasterizer_storage_gles3.cpp:1035 - Condition ' !texture->active ' is true. returned: Ref<Image>()
 drivers/gles3/rasterizer_storage_gles3.cpp:1035 - Condition ' !texture->active ' is true. returned: Ref<Image>()

I can load the image into an animated sprite frame but not into a sprite. The error still occurred when I tried GLES2 as well. The expected behavior is that the image loads and shows in the sprite. I can just drag the image from the filesystem, but I'd expect this way to work as well...

This bug happens in a more complex scene as well. I'm really trying to add a sprite as a child note to a rigidbody, but found that it occurs regardless of the parent or siblings.

Steps to reproduce:

  1. Create new project
  2. add node2d as root to scene
  3. add sprite as child of the root
  4. in the inspector create a new ImageTexture
  5. in the inspector for the new imageTexture, click load image and select any image
  6. observe the error in the window.

Minimal reproduction project:
godot_mwe.zip

@clayjohn
Copy link
Member

clayjohn commented Nov 7, 2018

When adding an image to a sprite, you should not add an ImageTexture. To add an image to a sprite, click beside "Texture" in the sprite and select "Load" then, in the inspector, select the image you would like to use.

You are having an issue because you are trying to create an ImageTexture and then add an image inside it. However, I can confirm the error messages you receive when you do so. The error messages should be more helpful.

@ssj71
Copy link
Author

ssj71 commented Nov 7, 2018

Ok. Thanks, sorry for the noise. So an imagetexture cannot be used in a sprite or a local image file cannot be used in an imagetexture?

@clayjohn
Copy link
Member

clayjohn commented Nov 7, 2018

ImageTexture is more of internal class for converting between Images and Textures. You could use it through GDscript. But there is no reason to use it to assign an Image to a Sprite.

@ssj71
Copy link
Author

ssj71 commented Nov 7, 2018

I'm just wondering if it should not show in the list in sprite when you click on the texture property. Or if load was at the top or said "Load Image" it could be helpful. Just some thoughts.

Thanks for the info, should I close this issue or change it to something like "error message unclear when adding imagetexture to sprite"?

@Zylann
Copy link
Contributor

Zylann commented Nov 7, 2018

You should choose to Load a texture from a file, because Godot can have imported that texture either as a StreamTexture or an ImageTexture. So technically, you can set an ImageTexture, it normally happens under the hood. But the inspector is quite generic and shows you all compatible texture types anyways, including those that don't work out of the box. That means you could also choose New Texture for example, and end up with the same problem, because textures are supposed to either be the result of an import, or created in a few steps from GDScript.

You are not the first one to fall in that trap so I believe a choice should be made to make this clear^^

@Chaosus
Copy link
Member

Chaosus commented Apr 17, 2019

Not detectable in current master, closed by bugsquad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants