Page MenuHome

no_face_mapping.diff

File Metadata

Author
Campbell Barton (campbellbarton)
Created
Nov 13 2013, 5:18 PM

no_face_mapping.diff

Index: source/blender/editors/space_view3d/drawmesh.c
===================================================================
--- source/blender/editors/space_view3d/drawmesh.c (revision 52732)
+++ source/blender/editors/space_view3d/drawmesh.c (working copy)
@@ -565,49 +565,59 @@
static DMDrawOption draw_tface_mapped__set_draw(void *userData, int index)
{
- Mesh *me = (Mesh *)userData;
+ if (UNLIKELY(index == -1)) {
+ return draw_tface__set_draw(NULL, FALSE, 0);
+ }
+ else {
+ Mesh *me = (Mesh *)userData;
- /* array checked for NULL before calling */
- MPoly *mpoly = &me->mpoly[index];
+ /* array checked for NULL before calling */
+ MPoly *mpoly = &me->mpoly[index];
- BLI_assert(index >= 0 && index < me->totpoly);
+ BLI_assert(index >= 0 && index < me->totpoly);
- if (mpoly->flag & ME_HIDE) {
- return DM_DRAW_OPTION_SKIP;
- }
- else {
- MTexPoly *tpoly = (me->mtpoly) ? &me->mtpoly[index] : NULL;
- MTFace mtf = {{{0}}};
- int matnr = mpoly->mat_nr;
+ if (mpoly->flag & ME_HIDE) {
+ return DM_DRAW_OPTION_SKIP;
+ }
+ else {
+ MTexPoly *tpoly = (me->mtpoly) ? &me->mtpoly[index] : NULL;
+ MTFace mtf = {{{0}}};
+ int matnr = mpoly->mat_nr;
- if (tpoly) {
- ME_MTEXFACE_CPY(&mtf, tpoly);
+ if (tpoly) {
+ ME_MTEXFACE_CPY(&mtf, tpoly);
+ }
+
+ return draw_tface__set_draw(&mtf, (me->mloopcol != NULL), matnr);
}
-
- return draw_tface__set_draw(&mtf, (me->mloopcol != NULL), matnr);
}
}
static DMDrawOption draw_em_tf_mapped__set_draw(void *userData, int index)
{
- drawEMTFMapped_userData *data = userData;
- BMEditMesh *em = data->em;
- BMFace *efa = EDBM_face_at_index(em, index);
-
- if (efa == NULL || BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
- return DM_DRAW_OPTION_SKIP;
+ if (UNLIKELY(index == -1)) {
+ return draw_tface__set_draw_legacy(NULL, FALSE, 0);
}
else {
- MTFace mtf = {{{0}}};
- int matnr = efa->mat_nr;
+ drawEMTFMapped_userData *data = userData;
+ BMEditMesh *em = data->em;
+ BMFace *efa = EDBM_face_at_index(em, index);
- if (data->has_mtface) {
- MTexPoly *tpoly = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
- ME_MTEXFACE_CPY(&mtf, tpoly);
+ if (efa == NULL || BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
+ return DM_DRAW_OPTION_SKIP;
}
+ else {
+ MTFace mtf = {{{0}}};
+ int matnr = efa->mat_nr;
- return draw_tface__set_draw_legacy(data->has_mtface ? &mtf : NULL,
- data->has_mcol, matnr);
+ if (data->has_mtface) {
+ MTexPoly *tpoly = CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_MTEXPOLY);
+ ME_MTEXFACE_CPY(&mtf, tpoly);
+ }
+
+ return draw_tface__set_draw_legacy(data->has_mtface ? &mtf : NULL,
+ data->has_mcol, matnr);
+ }
}
}
@@ -752,6 +762,12 @@
{
drawTFace_userData *data = userData;
+ /* covers -1 */
+ if (cur_index == next_index)
+ return 0;
+ if (cur_index == -1 || next_index == -1)
+ return 1;
+
if (data->mf && data->mf[cur_index].mat_nr != data->mf[next_index].mat_nr)
return 0;
@@ -765,6 +781,12 @@
{
drawEMTFMapped_userData *data = userData;
+ /* covers -1 */
+ if (cur_index == next_index)
+ return 0;
+ if (cur_index == -1 || next_index == -1)
+ return 1;
+
if (data->mf && data->mf[cur_index].mat_nr != data->mf[next_index].mat_nr)
return 0;

Event Timeline