Added a 0 check for button textures.

This commit is contained in:
maverickdgg 2023-01-16 14:51:06 +08:00
parent 1e351366af
commit cdb5102630
1 changed files with 5 additions and 5 deletions

View File

@ -236,14 +236,14 @@ namespace SHADE
auto material = renderable->GetModifiableMaterial(); auto material = renderable->GetModifiableMaterial();
if(!comp.isHovered && !comp.isClicked) if(!comp.isHovered && !comp.isClicked)
if (SHAssetManager::GetType(comp.GetDefaultTexture()) == AssetType::TEXTURE) if (comp.GetDefaultTexture() != 0 && SHAssetManager::GetType(comp.GetDefaultTexture()) == AssetType::TEXTURE)
{ {
material->SetProperty("data.textureIndex", comp.GetDefaultTexture()); material->SetProperty("data.textureIndex", comp.GetDefaultTexture());
//SHLOG_INFO("SETTING DEFAULT TEXTURE") //SHLOG_INFO("SETTING DEFAULT TEXTURE")
} }
else if (comp.isClicked) else if (comp.isClicked)
{ {
if (SHAssetManager::GetType(comp.GetClickedTexture()) == AssetType::TEXTURE) if (comp.GetClickedTexture() != 0 && SHAssetManager::GetType(comp.GetClickedTexture()) == AssetType::TEXTURE)
{ {
material->SetProperty("data.textureIndex", comp.GetClickedTexture()); material->SetProperty("data.textureIndex", comp.GetClickedTexture());
//SHLOG_INFO("SETTING CLICKED TEXTURE") //SHLOG_INFO("SETTING CLICKED TEXTURE")
@ -251,7 +251,7 @@ namespace SHADE
} }
else else
{ {
if (SHAssetManager::GetType(comp.GetHoveredTexture()) == AssetType::TEXTURE) if (comp.GetHoveredTexture() != 0 && SHAssetManager::GetType(comp.GetHoveredTexture()) == AssetType::TEXTURE)
{ {
material->SetProperty("data.textureIndex", comp.GetHoveredTexture()); material->SetProperty("data.textureIndex", comp.GetHoveredTexture());
//SHLOG_INFO("SETTING HOVERED TEXTURE") //SHLOG_INFO("SETTING HOVERED TEXTURE")
@ -357,7 +357,7 @@ namespace SHADE
auto material = renderable->GetModifiableMaterial(); auto material = renderable->GetModifiableMaterial();
if (comp.GetValue() == false) if (comp.GetValue() == false)
{ {
if (SHAssetManager::GetType(comp.GetDefaultTexture()) == AssetType::TEXTURE) if (comp.GetDefaultTexture()!= 0 && SHAssetManager::GetType(comp.GetDefaultTexture()) == AssetType::TEXTURE)
{ {
material->SetProperty("data.textureIndex", comp.GetDefaultTexture()); material->SetProperty("data.textureIndex", comp.GetDefaultTexture());
//SHLOG_INFO("SETTING DEFAULT TEXTURE") //SHLOG_INFO("SETTING DEFAULT TEXTURE")
@ -365,7 +365,7 @@ namespace SHADE
} }
else else
{ {
if (SHAssetManager::GetType(comp.GetToggledTexture()) == AssetType::TEXTURE) if (comp.GetToggledTexture() != 0 && SHAssetManager::GetType(comp.GetToggledTexture()) == AssetType::TEXTURE)
{ {
material->SetProperty("data.textureIndex", comp.GetToggledTexture()); material->SetProperty("data.textureIndex", comp.GetToggledTexture());
//SHLOG_INFO("SETTING DEFAULT TEXTURE") //SHLOG_INFO("SETTING DEFAULT TEXTURE")