From 43763f0b875753d0bfec7561ee4f1440c07fef2d Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 14 Jun 2011 09:19:32 +0000 Subject: [PATCH] be more tolerant to broken UV links --- pandatool/src/daeegg/daeMaterials.cxx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pandatool/src/daeegg/daeMaterials.cxx b/pandatool/src/daeegg/daeMaterials.cxx index e1441681d6..eb6ea0c585 100755 --- a/pandatool/src/daeegg/daeMaterials.cxx +++ b/pandatool/src/daeegg/daeMaterials.cxx @@ -155,7 +155,15 @@ process_texture_bucket(const string semantic, const FCDEffectStandard* effect_co const FCDEffectParameterInt* uvset = effect_common->GetTexture(bucket, tx)->GetSet(); if (uvset != NULL) { daeegg_cat.debug() << "Texture has uv name '" << FROM_FSTRING(uvset->GetSemantic()) << "'\n"; - egg_texture->set_uv_name(FROM_FSTRING(uvset->GetSemantic())); + string uvset_semantic (FROM_FSTRING(uvset->GetSemantic())); + + // Only set the UV name if this UV set actually exists. + for (int i = 0; i < _materials[semantic]->_uvsets.size(); ++i) { + if (_materials[semantic]->_uvsets[i]->_semantic == uvset_semantic) { + egg_texture->set_uv_name(uvset_semantic); + break; + } + } } // Apply sampler stuff if (sampler != NULL) {