[Bf-blender-cvs] [4b7fc26] master: Don't assign wrong datalayers to gpuattribs in edit mode.

Antony Riakiotakis noreply at git.blender.org
Fri Nov 14 12:09:08 CET 2014


Commit: 4b7fc26baed8389ecb9d0d350229b9b64ce47d03
Author: Antony Riakiotakis
Date:   Fri Nov 14 12:08:41 2014 +0100
Branches: master
https://developer.blender.org/rB4b7fc26baed8389ecb9d0d350229b9b64ce47d03

Don't assign wrong datalayers to gpuattribs in edit mode.

layer index was being obtained for loop data types but we referenced
Tessface data types

NULLing those out since only the data offsets are used in edit mode and
address sanitizer complains about freed memory access.

Also minor comment in texpainting

===================================================================

M	source/blender/blenkernel/intern/DerivedMesh.c
M	source/blender/editors/sculpt_paint/paint_image_proj.c

===================================================================

diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 81c03d8..6276277 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -2960,7 +2960,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
 				a = attribs->tottface++;
 
 				if (layer != -1) {
-					attribs->tface[a].array = tfdata->layers[layer].data;
+					attribs->tface[a].array = NULL;
 					attribs->tface[a].em_offset = ldata->layers[layer].offset;
 				}
 				else {
@@ -3007,7 +3007,7 @@ void DM_vertex_attributes_from_gpu(DerivedMesh *dm, GPUVertexAttribs *gattribs,
 				a = attribs->totmcol++;
 
 				if (layer != -1) {
-					attribs->mcol[a].array = tfdata->layers[layer].data;
+					attribs->mcol[a].array = NULL;
 					/* odd, store the offset for a different layer type here, but editmode draw code expects it */
 					attribs->mcol[a].em_offset = ldata->layers[layer].offset;
 				}
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 4c7d681..9cc1906 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -1053,6 +1053,8 @@ static void uv_image_outset(float (*orig_uv)[2], float (*outset_uv)[2], const fl
 	}
 
 	if (is_quad) {
+		/* here we just use the orthonormality property (a1, a2) dot (a2, -a1) = 0
+		 * to get normals from the edge directions based on the winding */
 		if (cw) {
 			no1[0] = -dir4[1] - dir1[1];
 			no1[1] = dir4[0] + dir1[0];
@@ -2543,7 +2545,6 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
 			float seam_subsection[4][2];
 			float fac1, fac2, ftot;
 
-
 			if (outset_uv[0][0] == FLT_MAX) /* first time initialize */
 				uv_image_outset(tf_uv_pxoffset, outset_uv, ps->seam_bleed_px, ibuf->x, ibuf->y, mf->v4 != 0, (ps->faceWindingFlags[face_index] & PROJ_FACE_WINDING_CW) == 0);




More information about the Bf-blender-cvs mailing list