mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-20 06:58:20 +00:00
Fix names of external images not being loaded in editor
The entire `CEditorImage` was being overwritten when loading external images, which was causing the already loaded image name to be cleared, due to the changed order of operations (regression from #7008). This is fixed by using `CImageInfo` to load the image and only copying the relevant members to the `CEditorImage`.
This commit is contained in:
parent
d4fed2360e
commit
97ae362bd6
|
@ -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;
|
||||||
|
|
Loading…
Reference in a new issue