You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Issue description:
Impossible to create a new instance of a custom texture implemented via script which inherits Texture:
extendsTextureclass_nameCustomTexture
Extending ImageTexture works in contrast:
extendsImageTextureclass_nameCustomImageTexture
Steps to reproduce:
Create a global script to just extend Texture.
Create a Sprite and try to assign a new custom texture from the inspector.
Workaround:
Extend ImageTexture instead. The reason for extending from Texture directly is to achieve better efficiency and flexibility by using the VisualServer API directly. This is possible to do via C++ but seems like not possible in GDScript, so this caught be off guard.
Not every texture is based on an image, as it can be procedurally generated (like NoiseTexture), so using ImageTexture is not a perfect option for this.
If that's expected, than perhaps that's documentation issue. From the Texture description:
Texture is a base for other resources. It cannot be used directly.
Perhaps this is what directly means here, so needs clarification.
That said, I'm not sure whether it's really possible to extend Texture via script in the first place, because I see no virtual methods.
The issue with suggested workaround is also not usable in practice (extending ImageTexture), I've just tested this.
Look at https://github.com/Maujoe/godot-custom-gradient-texture for concrete use case, which aims to replicate the functionality proposed in #31655. The plugin doesn't connect the gradient changed signal, but even if you do, then it's very difficult to update the texture by modifying the gradient directly from within the inspector (no way to drag the gradient sliders). I suspect the issue is with ImageTexture.create_from_image(), which somehow forces the inspector to update itself immediately, losing focus?
Godot version:
3.2.2-stable
OS/device including version:
Windows 10
Issue description:
Impossible to create a new instance of a custom texture implemented via script which inherits
Texture
:Extending
ImageTexture
works in contrast:Steps to reproduce:
Texture
.Sprite
and try to assign a new custom texture from the inspector.Workaround:
Extend
ImageTexture
instead. The reason for extending fromTexture
directly is to achieve better efficiency and flexibility by using theVisualServer
API directly. This is possible to do via C++ but seems like not possible in GDScript, so this caught be off guard.Not every texture is based on an image, as it can be procedurally generated (like
NoiseTexture
), so usingImageTexture
is not a perfect option for this.If that's expected, than perhaps that's documentation issue. From the
Texture
description:Perhaps this is what directly means here, so needs clarification.
That said, I'm not sure whether it's really possible to extend
Texture
via script in the first place, because I see no virtual methods.Minimal reproduction project:
texture_base_extend.zip
The text was updated successfully, but these errors were encountered: