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
This commit is contained in:
2014-11-14 12:08:41 +01:00
parent 60ffc08547
commit 4b7fc26bae
2 changed files with 4 additions and 3 deletions

View File

@@ -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;
}

View File

@@ -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);