Read int from uvwsrc

Previously was reading a uint, which always failed. Since the output was never checked, this
seemed to work, and works fine for most models since they only use UV channel 0.
kimkulling/fix_invalid_delete_issue-5307^2
julianknodt 2023-10-16 22:37:35 -07:00 committed by Kim Kulling
parent 4535e37fc6
commit 9efbbe0a69
1 changed files with 5 additions and 1 deletions

View File

@ -559,7 +559,11 @@ void glTF2Exporter::GetMatTex(const aiMaterial &mat, Ref<Texture> &texture, unsi
aiString tex;
// Read texcoord (UV map index)
mat.Get(AI_MATKEY_UVWSRC(tt, slot), texCoord);
// Note: must be an int to be successful.
int tmp = 0;
const auto ok = mat.Get(AI_MATKEY_UVWSRC(tt, slot), tmp);
if (ok == aiReturn_SUCCESS) texCoord = tmp;
if (mat.Get(AI_MATKEY_TEXTURE(tt, slot), tex) == AI_SUCCESS) {
std::string path = tex.C_Str();