all textures use relative path except embedded, this is fix for it
parent
07779a7ae1
commit
6d07473550
|
@ -1642,7 +1642,7 @@ namespace Assimp {
|
||||||
out_tex->pcData = reinterpret_cast<aiTexel*>(const_cast<Video&>(video).RelinquishContent());
|
out_tex->pcData = reinterpret_cast<aiTexel*>(const_cast<Video&>(video).RelinquishContent());
|
||||||
|
|
||||||
// try to extract a hint from the file extension
|
// 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);
|
std::string ext = BaseImporter::GetExtension(filename);
|
||||||
|
|
||||||
if (ext == "jpeg") {
|
if (ext == "jpeg") {
|
||||||
|
@ -1653,7 +1653,7 @@ namespace Assimp {
|
||||||
memcpy(out_tex->achFormatHint, ext.c_str(), ext.size());
|
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);
|
return static_cast<unsigned int>(textures.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,6 +241,7 @@ TEST_F(utFBXImporterExporter, importEmbeddedAsciiTest) {
|
||||||
aiString path;
|
aiString path;
|
||||||
aiTextureMapMode modes[2];
|
aiTextureMapMode modes[2];
|
||||||
EXPECT_EQ(aiReturn_SUCCESS, mat->GetTexture(aiTextureType_DIFFUSE, 0, &path, nullptr, nullptr, nullptr, nullptr, modes));
|
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_EQ(1, scene->mNumTextures);
|
||||||
ASSERT_TRUE(scene->mTextures[0]->pcData);
|
ASSERT_TRUE(scene->mTextures[0]->pcData);
|
||||||
|
|
Loading…
Reference in New Issue