godotengine / godotengine/godot

StyleBoxTexture don't support custom texture

Open
#88,136 3 comments 0 reactions 0 assignees View on GitHub
topic:2d topic:gui topic:rendering
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

4.3.dev3 and 4.2.stable

### System information

Godot v4.3.dev3 - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1650 () - Intel(R) Core(TM) i5-10400F CPU @ 2.90GHz (12 Threads)

### Issue description

StyleBoxTexture can't use custom texture to render. When it uses custom texture, it renders as all white. Also haven ‘t output anything when use print(), seems don' t call the ProxyTexture2D.draw() method.

The custom ProxyTexture2D script:
![屏幕截图 2024-02-09 162602](https://github.com/godotengine/godot/assets/99076011/8139a9f4-19d7-4cff-83b1-d181415fceb5)

The scene:
![屏幕截图 2024-02-09 162538 拷贝](https://github.com/godotengine/godot/assets/99076011/a9c58b85-316f-4199-923e-ef80cdb5b383)
![屏幕截图 2024-02-09 162545](https://github.com/godotengine/godot/assets/99076011/0974bc72-175e-47d1-ba5b-d28ab55215cb)

Only render properly when use custom StyleBox like that:
![屏幕截图 2024-02-09 165123](https://github.com/godotengine/godot/assets/99076011/906ba967-66f3-49bc-b79c-46fa36a22abb)
![屏幕截图 2024-02-09 165229](https://github.com/godotengine/godot/assets/99076011/1e302ae6-5b25-4c51-9313-5381b38ea96f)

So, it should make StyleBoxTexture to call Texture.draw() properly?

### Steps to reproduce

1. Write a custom 2d texture script.
2. Make a scene and add a Panel control to the scene.
3. Set the Panel control's "theme overrides/panel" property to a StyleBoxTexture.
4. Set the StyleBoxTexture resource's texture to a custom 2d texture.
5. Run the project, then see the panel render as all white.

### Minimal reproduction project (MRP)

[StyleBoxTextureIssue.zip](https://github.com/godotengine/godot/files/14240495/StyleBoxTextureIssue.zip)

Open the scene and switch the Panel control's "theme overrides/panel" property to different style box resources in "res://resource/style_box/" folder. Run the project to see the result.

Contributor guide

Open the contributing guide

Research direction

Open the attached StyleBoxTextureIssue.zip and reproduce the Panel rendering issue by switching the style box resources in res://resource/style_box/. Start by tracing how StyleBoxTexture handles the custom ProxyTexture2D, then compare it with the custom StyleBox reproduction. Done means a custom 2D texture renders correctly instead of appearing white.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.