diff --git a/code/glTF/glTFExporter.cpp b/code/glTF/glTFExporter.cpp index 3caea7de9..4ebe53c00 100644 --- a/code/glTF/glTFExporter.cpp +++ b/code/glTF/glTFExporter.cpp @@ -352,6 +352,8 @@ void glTFExporter::GetMatColorOrTex(const aiMaterial* mat, glTF::TexProperty& pr if (path[0] == '*') { // embedded aiTexture* tex = mScene->mTextures[atoi(&path[1])]; + + prop.texture->source->name = tex->mFilename.C_Str(); uint8_t* data = reinterpret_cast(tex->pcData); prop.texture->source->SetData(data, tex->mWidth, *mAsset); diff --git a/code/glTF/glTFImporter.cpp b/code/glTF/glTFImporter.cpp index 45c0e42a9..bba48dc30 100644 --- a/code/glTF/glTFImporter.cpp +++ b/code/glTF/glTFImporter.cpp @@ -680,6 +680,7 @@ void glTFImporter::ImportEmbeddedTextures(glTF::Asset& r) size_t length = img.GetDataLength(); void* data = img.StealData(); + tex->mFilename = img.name; tex->mWidth = static_cast(length); tex->mHeight = 0; tex->pcData = reinterpret_cast(data); diff --git a/code/glTF2/glTF2Exporter.cpp b/code/glTF2/glTF2Exporter.cpp index 7a7d581cb..b240a5ea9 100644 --- a/code/glTF2/glTF2Exporter.cpp +++ b/code/glTF2/glTF2Exporter.cpp @@ -351,6 +351,8 @@ void glTF2Exporter::GetMatTex(const aiMaterial* mat, Ref& texture, aiTe if (path[0] == '*') { // embedded aiTexture* tex = mScene->mTextures[atoi(&path[1])]; + + texture->source->name = tex->mFilename.C_Str(); // The asset has its own buffer, see Image::SetData texture->source->SetData(reinterpret_cast (tex->pcData), tex->mWidth, *mAsset); diff --git a/code/glTF2/glTF2Importer.cpp b/code/glTF2/glTF2Importer.cpp index e5052d4d6..af98076a7 100644 --- a/code/glTF2/glTF2Importer.cpp +++ b/code/glTF2/glTF2Importer.cpp @@ -1248,6 +1248,7 @@ void glTF2Importer::ImportEmbeddedTextures(glTF2::Asset &r) { size_t length = img.GetDataLength(); void *data = img.StealData(); + tex->mFilename = img.name; tex->mWidth = static_cast(length); tex->mHeight = 0; tex->pcData = reinterpret_cast(data);