all textures use relative path except embedded, this is fix for it

pull/2523/head
Mike Samsonov 2019-06-27 17:59:55 +01:00
parent 07779a7ae1
commit 6d07473550
2 changed files with 3 additions and 2 deletions

View File

@ -1642,7 +1642,7 @@ namespace Assimp {
out_tex->pcData = reinterpret_cast<aiTexel*>(const_cast<Video&>(video).RelinquishContent());
// try to extract a hint from the file extension
const std::string& filename = video.FileName().empty() ? video.RelativeFilename() : video.FileName();
const std::string& filename = video.RelativeFilename().empty() ? video.FileName() : video.RelativeFilename();
std::string ext = BaseImporter::GetExtension(filename);
if (ext == "jpeg") {
@ -1653,7 +1653,7 @@ namespace Assimp {
memcpy(out_tex->achFormatHint, ext.c_str(), ext.size());
}
out_tex->mFilename.Set(video.FileName().c_str());
out_tex->mFilename.Set(filename.c_str());
return static_cast<unsigned int>(textures.size() - 1);
}

View File

@ -241,6 +241,7 @@ TEST_F(utFBXImporterExporter, importEmbeddedAsciiTest) {
aiString path;
aiTextureMapMode modes[2];
EXPECT_EQ(aiReturn_SUCCESS, mat->GetTexture(aiTextureType_DIFFUSE, 0, &path, nullptr, nullptr, nullptr, nullptr, modes));
ASSERT_STREQ(path.C_Str(), "..\\..\\..\\Desktop\\uv_test.png");
ASSERT_EQ(1, scene->mNumTextures);
ASSERT_TRUE(scene->mTextures[0]->pcData);