[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43114] trunk/blender/source/blender/ modifiers/intern/MOD_util.c: bugfix - get_texture_coords() used by wave/ warp/ weight modifiers could initialize a verts coords from the 4th UV of a triangle face .

Campbell Barton ideasman42 at gmail.com
Wed Jan 4 05:56:14 CET 2012


Revision: 43114
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43114
Author:   campbellbarton
Date:     2012-01-04 04:56:06 +0000 (Wed, 04 Jan 2012)
Log Message:
-----------
bugfix - get_texture_coords() used by wave/warp/weight modifiers could initialize a verts coords from the 4th UV of a triangle face.

Modified Paths:
--------------
    trunk/blender/source/blender/modifiers/intern/MOD_util.c

Modified: trunk/blender/source/blender/modifiers/intern/MOD_util.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_util.c	2012-01-04 04:14:57 UTC (rev 43113)
+++ trunk/blender/source/blender/modifiers/intern/MOD_util.c	2012-01-04 04:56:06 UTC (rev 43114)
@@ -107,36 +107,19 @@
 
 			/* verts are given the UV from the first face that uses them */
 			for(i = 0, mf = mface; i < numFaces; ++i, ++mf, ++tf) {
-				if(!done[mf->v1]) {
-					texco[mf->v1][0] = tf->uv[0][0];
-					texco[mf->v1][1] = tf->uv[0][1];
-					texco[mf->v1][2] = 0;
-					done[mf->v1] = 1;
-				}
-				if(!done[mf->v2]) {
-					texco[mf->v2][0] = tf->uv[1][0];
-					texco[mf->v2][1] = tf->uv[1][1];
-					texco[mf->v2][2] = 0;
-					done[mf->v2] = 1;
-				}
-				if(!done[mf->v3]) {
-					texco[mf->v3][0] = tf->uv[2][0];
-					texco[mf->v3][1] = tf->uv[2][1];
-					texco[mf->v3][2] = 0;
-					done[mf->v3] = 1;
-				}
-				if(!done[mf->v4]) {
-					texco[mf->v4][0] = tf->uv[3][0];
-					texco[mf->v4][1] = tf->uv[3][1];
-					texco[mf->v4][2] = 0;
-					done[mf->v4] = 1;
-				}
-			}
+				unsigned int fidx= mf->v4 ? 3:2;
 
-			/* remap UVs from [0, 1] to [-1, 1] */
-			for(i = 0; i < numVerts; ++i) {
-				texco[i][0] = texco[i][0] * 2 - 1;
-				texco[i][1] = texco[i][1] * 2 - 1;
+				do {
+					unsigned int vidx = *(&mf->v1 + fidx);
+
+					if (done[vidx] == 0) {
+						/* remap UVs from [0, 1] to [-1, 1] */
+						texco[vidx][0] = (tf->uv[fidx][0] * 2.0f) - 1.0f;
+						texco[vidx][1] = (tf->uv[fidx][1] * 2.0f) - 1.0f;
+						done[vidx] = 1;
+					}
+
+				} while (fidx--);
 			}
 
 			MEM_freeN(done);



More information about the Bf-blender-cvs mailing list