[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [39242] branches/soc-2011-cucumber/source/ gameengine/Converter/BL_BlenderDataConversion.cpp: Sorted out some problems with scrambled UVs caused by the changes made for multiple UV support .
Daniel Stokes
kupomail at gmail.com
Wed Aug 10 07:41:00 CEST 2011
Revision: 39242
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=39242
Author: kupoman
Date: 2011-08-10 05:41:00 +0000 (Wed, 10 Aug 2011)
Log Message:
-----------
Sorted out some problems with scrambled UVs caused by the changes made for multiple UV support.
Modified Paths:
--------------
branches/soc-2011-cucumber/source/gameengine/Converter/BL_BlenderDataConversion.cpp
Modified: branches/soc-2011-cucumber/source/gameengine/Converter/BL_BlenderDataConversion.cpp
===================================================================
--- branches/soc-2011-cucumber/source/gameengine/Converter/BL_BlenderDataConversion.cpp 2011-08-10 04:30:44 UTC (rev 39241)
+++ branches/soc-2011-cucumber/source/gameengine/Converter/BL_BlenderDataConversion.cpp 2011-08-10 05:41:00 UTC (rev 39242)
@@ -768,14 +768,9 @@
material->spec_f = 0.5f;
material->ref = 0.8f;
}
- MT_Point2 uv[4];
- MT_Point2 uv2[4];
+
MT_Point2 uvs[4][MAXTEX];
- const char *uvName = "", *uv2Name = "";
-
- uv2[0]= uv2[1]= uv2[2]= uv2[3]= MT_Point2(0.0f, 0.0f);
-
if( validface ) {
material->ras_mode |= (tface->mode & TF_INVISIBLE)?0:POLY_VIS;
@@ -784,14 +779,12 @@
material->tile = tface->tile;
material->mode = tface->mode;
- uv[0].setValue(tface->uv[0]);
- uv[1].setValue(tface->uv[1]);
- uv[2].setValue(tface->uv[2]);
+ uvs[0][0].setValue(tface->uv[0]);
+ uvs[1][0].setValue(tface->uv[1]);
+ uvs[2][0].setValue(tface->uv[2]);
if (mface->v4)
- uv[3].setValue(tface->uv[3]);
-
- uvName = tfaceName;
+ uvs[3][0].setValue(tface->uv[3]);
}
else {
// nothing at all
@@ -800,7 +793,7 @@
material->transp = TF_SOLID;
material->tile = 0;
- uv[0]= uv[1]= uv[2]= uv[3]= MT_Point2(0.0f, 0.0f);
+ uvs[0][0]= uvs[1][0]= uvs[2][0]= uvs[3][0]= MT_Point2(0.0f, 0.0f);
}
// with ztransp enabled, enforce alpha blending mode
@@ -823,66 +816,43 @@
// get uv sets
if(validmat)
{
- for (int lay=0; lay<MAX_MTFACE; lay++)
+ for (int vind = 0; vind<material->num_enabled; vind++)
{
- MTF_localLayer& layer = layers[lay];
- if (layer.face == 0) break;
+ BL_Mapping &map = material->mapping[vind];
- uvs[0][lay].setValue(layer.face->uv[0]);
- uvs[1][lay].setValue(layer.face->uv[1]);
- uvs[2][lay].setValue(layer.face->uv[2]);
-
- if (mface->v4)
- uvs[3][lay].setValue(layer.face->uv[3]);
- else
- uvs[3][lay].setValue(0.0f, 0.0f);
- }
+ //If no UVSet is specified, try grabbing one from the UV/Image editor
+ if (map.uvCoName.IsEmpty() && validface)
+ {
+ uvs[0][vind].setValue(tface->uv[0]);
+ uvs[1][vind].setValue(tface->uv[1]);
+ uvs[2][vind].setValue(tface->uv[2]);
- bool isFirstSet = true;
+ if (mface->v4)
+ uvs[3][vind].setValue(tface->uv[3]);
- // only two sets implemented, but any of the eight
- // sets can make up the two layers
- for (int vind = 0; vind<material->num_enabled; vind++)
- {
- BL_Mapping &map = material->mapping[vind];
+ continue;
+ }
- if (map.uvCoName.IsEmpty())
- isFirstSet = false;
- else
+
+ for (int lay=0; lay<MAX_MTFACE; lay++)
{
- for (int lay=0; lay<MAX_MTFACE; lay++)
+ MTF_localLayer& layer = layers[lay];
+ if (layer.face == 0) break;
+
+ if (map.uvCoName.IsEmpty() || strcmp(map.uvCoName.ReadPtr(), layer.name)==0)
{
- MTF_localLayer& layer = layers[lay];
- if (layer.face == 0) break;
+ MT_Point2 uvSet[4];
- if (strcmp(map.uvCoName.ReadPtr(), layer.name)==0)
- {
- MT_Point2 uvSet[4];
+ uvs[0][vind].setValue(layer.face->uv[0]);
+ uvs[1][vind].setValue(layer.face->uv[1]);
+ uvs[2][vind].setValue(layer.face->uv[2]);
- uvSet[0].setValue(layer.face->uv[0]);
- uvSet[1].setValue(layer.face->uv[1]);
- uvSet[2].setValue(layer.face->uv[2]);
+ if (mface->v4)
+ uvs[3][vind].setValue(layer.face->uv[3]);
+ else
+ uvs[3][vind].setValue(0.0f, 0.0f);
- if (mface->v4)
- uvSet[3].setValue(layer.face->uv[3]);
- else
- uvSet[3].setValue(0.0f, 0.0f);
-
- if (isFirstSet)
- {
- uv[0] = uvSet[0]; uv[1] = uvSet[1];
- uv[2] = uvSet[2]; uv[3] = uvSet[3];
- isFirstSet = false;
- uvName = layer.name;
- }
- else if(strcmp(layer.name, uvName) != 0)
- {
- uv2[0] = uvSet[0]; uv2[1] = uvSet[1];
- uv2[2] = uvSet[2]; uv2[3] = uvSet[3];
- map.mapping |= USECUSTOMUV;
- uv2Name = layer.name;
- }
- }
+ break;
}
}
}
More information about the Bf-blender-cvs
mailing list