From 12025de1799ef8d743e2543823cacdac185bdbdf Mon Sep 17 00:00:00 2001 From: Par Winzell Date: Thu, 24 Jan 2019 16:56:04 -0800 Subject: [PATCH] Don't discriminate textures only by FBX logical name. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We don't want to use the logical texture name from the FBX to distinguish separate textures. It seems entirely valid for distinct textures to have the same name. It's not completely clear what's best to use instead, but adding fileLocation seems reasonable. It can be blank, for textures that don't exist on the filesystem –– but that's a pretty weird edge case, and even then we have both 'usage' and 'name' to distinguish. --- src/raw/RawModel.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/raw/RawModel.cpp b/src/raw/RawModel.cpp index 2a7fe12..2c8b4d1 100644 --- a/src/raw/RawModel.cpp +++ b/src/raw/RawModel.cpp @@ -100,7 +100,9 @@ int RawModel::AddTexture( return -1; } for (size_t i = 0; i < textures.size(); i++) { - if (StringUtils::CompareNoCase(textures[i].name, name) == 0 && textures[i].usage == usage) { + // we allocate the struct even if the implementing image file is missing + if (StringUtils::CompareNoCase(textures[i].fileLocation, fileLocation) == 0 && + StringUtils::CompareNoCase(textures[i].name, name) == 0 && textures[i].usage == usage) { return (int)i; } }