Merge pull request #7322 from Robyt3/Editor-External-Image-Name-Fix

Fix names of external images not being loaded in editor
This commit is contained in:
Dennis Felsing 2023-10-08 10:59:53 +00:00 committed by GitHub
commit f7d23844db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -503,10 +503,13 @@ bool CEditorMap::Load(const char *pFileName, int StorageType, const std::functio
str_format(aBuf, sizeof(aBuf), "mapres/%s.png", pImg->m_aName); str_format(aBuf, sizeof(aBuf), "mapres/%s.png", pImg->m_aName);
// load external // load external
CEditorImage ImgInfo(m_pEditor); CImageInfo ImgInfo;
if(m_pEditor->Graphics()->LoadPNG(&ImgInfo, aBuf, IStorage::TYPE_ALL)) if(m_pEditor->Graphics()->LoadPNG(&ImgInfo, aBuf, IStorage::TYPE_ALL))
{ {
*pImg = ImgInfo; pImg->m_Width = ImgInfo.m_Width;
pImg->m_Height = ImgInfo.m_Height;
pImg->m_Format = ImgInfo.m_Format;
pImg->m_pData = ImgInfo.m_pData;
int TextureLoadFlag = m_pEditor->Graphics()->HasTextureArrays() ? IGraphics::TEXLOAD_TO_2D_ARRAY_TEXTURE : IGraphics::TEXLOAD_TO_3D_TEXTURE; int TextureLoadFlag = m_pEditor->Graphics()->HasTextureArrays() ? IGraphics::TEXLOAD_TO_2D_ARRAY_TEXTURE : IGraphics::TEXLOAD_TO_3D_TEXTURE;
if(ImgInfo.m_Width % 16 != 0 || ImgInfo.m_Height % 16 != 0) if(ImgInfo.m_Width % 16 != 0 || ImgInfo.m_Height % 16 != 0)
TextureLoadFlag = 0; TextureLoadFlag = 0;