diff options
author | Mitchell Stokes <mogurijin@gmail.com> | 2013-03-02 22:05:52 +0400 |
---|---|---|
committer | Mitchell Stokes <mogurijin@gmail.com> | 2013-03-02 22:05:52 +0400 |
commit | db6d34daada73edf013f94f3cc545f46e8707ecb (patch) | |
tree | 40eb4950f676a1430a7d20aae4a3b2a20055cb22 /source/gameengine | |
parent | c718f0d658173a126836657b7ca1fc32662a8847 (diff) |
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.
Diffstat (limited to 'source/gameengine')
-rw-r--r-- | source/gameengine/Converter/BL_BlenderDataConversion.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
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 <math.h> +#include <vector> +#include <algorithm> #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<STR_String> found_layers; + for (int vind = 0; vind<MAXTEX; vind++) { BL_Mapping &map = material->mapping[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; } } |