fix for own regression, face index ranges still need checking in some places.

This commit is contained in:
Campbell Barton 2013-07-14 23:41:33 +00:00
parent 878608d1cf
commit 3c4c2478b6
3 changed files with 35 additions and 10 deletions

@ -566,7 +566,12 @@ 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);
BMFace *efa;
if (UNLIKELY(index >= em->bm->totface))
return DM_DRAW_OPTION_NORMAL;
efa = EDBM_face_at_index(em, index);
if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
return DM_DRAW_OPTION_SKIP;
@ -922,7 +927,13 @@ static int tex_mat_set_face_editmesh_cb(void *userData, int index)
/* editmode face hiding */
TexMatCallback *data = (TexMatCallback *)userData;
Mesh *me = (Mesh *)data->me;
BMFace *efa = EDBM_face_at_index(me->edit_btmesh, index);
BMEditMesh *em = me->edit_btmesh;
BMFace *efa;
if (UNLIKELY(index >= em->bm->totface))
return DM_DRAW_OPTION_NORMAL;
efa = EDBM_face_at_index(em, index);
return !BM_elem_flag_test(efa, BM_ELEM_HIDDEN);
}

@ -3049,24 +3049,38 @@ static void draw_em_indices(BMEditMesh *em)
static DMDrawOption draw_em_fancy__setFaceOpts(void *userData, int index)
{
BMFace *efa = EDBM_face_at_index(userData, index);
BMEditMesh *em = userData;
BMFace *efa;
if (UNLIKELY(index >= em->bm->totface))
return DM_DRAW_OPTION_NORMAL;
efa = EDBM_face_at_index(em, index);
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
GPU_enable_material(efa->mat_nr + 1, NULL);
return DM_DRAW_OPTION_NORMAL;
}
else
else {
return DM_DRAW_OPTION_SKIP;
}
}
static DMDrawOption draw_em_fancy__setGLSLFaceOpts(void *userData, int index)
{
BMFace *efa = EDBM_face_at_index(userData, index);
BMEditMesh *em = userData;
BMFace *efa;
if (BM_elem_flag_test(efa, BM_ELEM_HIDDEN))
return DM_DRAW_OPTION_SKIP;
else
if (UNLIKELY(index >= em->bm->totface))
return DM_DRAW_OPTION_NORMAL;
efa = EDBM_face_at_index(em, index);
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
return DM_DRAW_OPTION_NORMAL;
}
else {
return DM_DRAW_OPTION_SKIP;
}
}
static void draw_em_fancy(Scene *scene, ARegion *ar, View3D *v3d,

@ -237,7 +237,7 @@ static int build_hull(SkinOutput *so, Frame **frames, int totframe)
/* Deselect all faces so that only new hull output faces are
* selected after the operator is run */
BM_mesh_elem_hflag_disable_all(bm, BM_ALL, BM_ELEM_SELECT, 0);
BM_mesh_elem_hflag_disable_all(bm, BM_ALL_NOLOOP, BM_ELEM_SELECT, false);
BMO_op_initf(bm, &op, (BMO_FLAG_DEFAULTS & ~BMO_FLAG_RESPECT_HIDE),
"convex_hull input=%hv", BM_ELEM_TAG);
@ -288,7 +288,7 @@ static int build_hull(SkinOutput *so, Frame **frames, int totframe)
/* Remove triangles that would fill the original frames -- skip if
* frame is partially detached */
BM_mesh_elem_hflag_disable_all(bm, BM_ALL, BM_ELEM_TAG, FALSE);
BM_mesh_elem_hflag_disable_all(bm, BM_ALL_NOLOOP, BM_ELEM_TAG, false);
for (i = 0; i < totframe; i++) {
Frame *frame = frames[i];
if (!frame->detached) {