Don't set the label shader if the specified material name is considered empty (#364)

For labels linking to a variable for the shader, this prevents the label from still being rendered, drawing the tiled square grid (notexture)
This commit is contained in:
smallmodel 2024-09-27 18:30:03 +02:00 committed by GitHub
parent 51afcd7b96
commit facabc09f5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -166,7 +166,13 @@ void UILabel::LabelLayoutShader(Event *ev)
void UILabel::LabelLayoutTileShader(Event *ev)
{
m_sCurrentShaderName = ev->GetString(1);
setMaterial(uWinMan.RegisterShader(m_sCurrentShaderName));
if (m_sCurrentShaderName.length() > 1) {
setMaterial(uWinMan.RegisterShader(m_sCurrentShaderName));
} else {
// Added in 2.0
// Don't set the material if the shader name is considered empty
m_sCurrentShaderName = "";
}
m_flags |= WF_TILESHADER;
}