diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-05-24 19:44:58 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-05-24 19:46:30 +0300 |
commit | a033a7bef9be0ab69edbccbcf49f8af3816fe1eb (patch) | |
tree | 9f755848a94feebcb0523ab18aa00324cf15da91 /source/blender | |
parent | 55c15ad9ded2707d16cb88eea2dc2a62e4ec2359 (diff) |
Fix error accessing tessface color in edit-mode
Was checking for loop-color in poly-layer.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/intern/editderivedmesh.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index 2fffa0dea28..5591ee2a0d4 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -2053,20 +2053,25 @@ static void *emDM_getTessFaceDataArray(DerivedMesh *dm, int type) /* layers are store per face for editmesh, we convert to a temporary * data layer array in the derivedmesh when these are requested */ if (type == CD_MTFACE || type == CD_MCOL) { - const int type_from = (type == CD_MTFACE) ? CD_MTEXPOLY : CD_MLOOPCOL; - int index; const char *bmdata; char *data; - index = CustomData_get_layer_index(&bm->pdata, type_from); + bool has_type_source = false; - if (index != -1) { + if (type == CD_MTFACE) { + has_type_source = CustomData_has_layer(&bm->pdata, CD_MTEXPOLY); + } + else { + has_type_source = CustomData_has_layer(&bm->ldata, CD_MLOOPCOL); + } + + if (has_type_source) { /* offset = bm->pdata.layers[index].offset; */ /* UNUSED */ BMLoop *(*looptris)[3] = bmdm->em->looptris; const int size = CustomData_sizeof(type); int i, j; DM_add_tessface_layer(dm, type, CD_CALLOC, NULL); - index = CustomData_get_layer_index(&dm->faceData, type); + const int index = CustomData_get_layer_index(&dm->faceData, type); dm->faceData.layers[index].flag |= CD_FLAG_TEMPORARY; data = datalayer = DM_get_tessface_data_layer(dm, type); |