diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2013-02-23 08:15:47 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2013-02-23 08:15:47 +0400 |
commit | 87ab62246333171ee11b43e348eab5f5b764f52f (patch) | |
tree | c18a5938326e01488b56ef84c16b7c2c74b1dbc1 /source/gameengine | |
parent | e4febef1fb659199b4ab73e3c6ef93edf54243dc (diff) |
BGE: Fix for bug #34377 "Multi UV mesh's materials not backwards compatible and Odd UV Coord behavior" reported by Alex Mairs (ctbm). The problem was the unused texture slot was still trying to be used. Now unused texture slots' mappings are set to DISABLE so they don't mess up the rest of the conversion process.
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Converter/BL_BlenderDataConversion.cpp | 75 |
1 files changed, 40 insertions, 35 deletions
diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index 1c160097e2c..7387092391d 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -691,44 +691,49 @@ static bool ConvertMaterial( #endif /// -------------------------------- // mapping methods - material->mapping[i].mapping |= ( mttmp->texco & TEXCO_REFL )?USEREFL:0; - - if (mttmp->texco & TEXCO_OBJECT) { - material->mapping[i].mapping |= USEOBJ; - if (mttmp->object) - material->mapping[i].objconame = mttmp->object->id.name; - } - else if (mttmp->texco &TEXCO_REFL) - material->mapping[i].mapping |= USEREFL; - else if (mttmp->texco &(TEXCO_ORCO|TEXCO_GLOB)) - material->mapping[i].mapping |= USEORCO; - else if (mttmp->texco &TEXCO_UV) - { - STR_String uvName = mttmp->uvname; + if (mat->septex & (1 << i)) { + // If this texture slot isn't in use, set it to disabled to prevent multi-uv problems + material->mapping[i].mapping = DISABLE; + } else { + material->mapping[i].mapping |= ( mttmp->texco & TEXCO_REFL )?USEREFL:0; + + if (mttmp->texco & TEXCO_OBJECT) { + material->mapping[i].mapping |= USEOBJ; + if (mttmp->object) + material->mapping[i].objconame = mttmp->object->id.name; + } + else if (mttmp->texco &TEXCO_REFL) + material->mapping[i].mapping |= USEREFL; + else if (mttmp->texco &(TEXCO_ORCO|TEXCO_GLOB)) + material->mapping[i].mapping |= USEORCO; + else if (mttmp->texco &TEXCO_UV) + { + STR_String uvName = mttmp->uvname; - if (!uvName.IsEmpty()) - material->mapping[i].uvCoName = mttmp->uvname; + if (!uvName.IsEmpty()) + material->mapping[i].uvCoName = mttmp->uvname; + else + material->mapping[i].uvCoName = ""; + material->mapping[i].mapping |= USEUV; + } + else if (mttmp->texco &TEXCO_NORM) + material->mapping[i].mapping |= USENORM; + else if (mttmp->texco &TEXCO_TANGENT) + material->mapping[i].mapping |= USETANG; else - material->mapping[i].uvCoName = ""; - material->mapping[i].mapping |= USEUV; + material->mapping[i].mapping |= DISABLE; + + material->mapping[i].scale[0] = mttmp->size[0]; + material->mapping[i].scale[1] = mttmp->size[1]; + material->mapping[i].scale[2] = mttmp->size[2]; + material->mapping[i].offsets[0] = mttmp->ofs[0]; + material->mapping[i].offsets[1] = mttmp->ofs[1]; + material->mapping[i].offsets[2] = mttmp->ofs[2]; + + material->mapping[i].projplane[0] = mttmp->projx; + material->mapping[i].projplane[1] = mttmp->projy; + material->mapping[i].projplane[2] = mttmp->projz; } - else if (mttmp->texco &TEXCO_NORM) - material->mapping[i].mapping |= USENORM; - else if (mttmp->texco &TEXCO_TANGENT) - material->mapping[i].mapping |= USETANG; - else - material->mapping[i].mapping |= DISABLE; - - material->mapping[i].scale[0] = mttmp->size[0]; - material->mapping[i].scale[1] = mttmp->size[1]; - material->mapping[i].scale[2] = mttmp->size[2]; - material->mapping[i].offsets[0] = mttmp->ofs[0]; - material->mapping[i].offsets[1] = mttmp->ofs[1]; - material->mapping[i].offsets[2] = mttmp->ofs[2]; - - material->mapping[i].projplane[0] = mttmp->projx; - material->mapping[i].projplane[1] = mttmp->projy; - material->mapping[i].projplane[2] = mttmp->projz; /// -------------------------------- switch (mttmp->blendtype) { |