From db6d34daada73edf013f94f3cc545f46e8707ecb Mon Sep 17 00:00:00 2001 From: Mitchell Stokes Date: Sat, 2 Mar 2013 18:05:52 +0000 Subject: BGE: Fix for bugs #34428, #20856, #20281. These were all multi-uv bugs caused by the BGE keeping too much uv information. When setting up shaders the BGE assumes each UV layer is unique, but the converter would store duplicates. --- source/gameengine/Converter/BL_BlenderDataConversion.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/gameengine/Converter') diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index f861b105ba3..e3fd662e16f 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -35,6 +35,8 @@ #endif #include +#include +#include #include "BL_BlenderDataConversion.h" #include "KX_BlenderGL.h" @@ -506,12 +508,17 @@ static void GetUVs(BL_Material *material, MTF_localLayer *layers, MFace *mface, uvs[0][0] = uvs[1][0] = uvs[2][0] = uvs[3][0] = MT_Point2(0.f, 0.f); } + vector found_layers; + for (int vind = 0; vindmapping[vind]; if (!(map.mapping & USEUV)) continue; + if (std::find(found_layers.begin(), found_layers.end(), map.uvCoName) != found_layers.end()) + continue; + //If no UVSet is specified, try grabbing one from the UV/Image editor if (map.uvCoName.IsEmpty() && tface) { @@ -544,6 +551,7 @@ static void GetUVs(BL_Material *material, MTF_localLayer *layers, MFace *mface, uvs[3][unit].setValue(0.0f, 0.0f); ++unit; + found_layers.push_back(map.uvCoName); break; } } -- cgit v1.2.3