Fix material text icons with some techsets causing issues when rendering

This commit is contained in:
Jan 2021-08-20 17:49:36 +02:00
parent 4ab20ae8f5
commit e84e0774a6

View File

@ -161,7 +161,12 @@ namespace Components
Materials::ImageNameLength = 4 + length; Materials::ImageNameLength = 4 + length;
std::string image(imagePtr, length); std::string image(imagePtr, length);
return Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_MATERIAL, image.data()).material; auto* material = Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_MATERIAL, image.data()).material;
if(material == nullptr || material->techniqueSet == nullptr || material->techniqueSet->name == nullptr || strcmp(material->techniqueSet->name, "2d") != 0)
return Game::DB_FindXAssetHeader(Game::XAssetType::ASSET_TYPE_MATERIAL, "default").material;
return material;
} }
Materials::ImageNameLength = 4; Materials::ImageNameLength = 4;