Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-07-15 03:41:33 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-07-15 03:41:33 +0400
commit3c4c2478b60602b179009c9da5c3aecb5bcd0632 (patch)
treeb1af308cfc7cd7c53412be64d02b1d94d25bc8a6
parent878608d1cf62efa72208af619f9ed4750917868a (diff)
fix for own regression, face index ranges still need checking in some places.
-rw-r--r--source/blender/editors/space_view3d/drawmesh.c15
-rw-r--r--source/blender/editors/space_view3d/drawobject.c26
-rw-r--r--source/blender/modifiers/intern/MOD_skin.c4
3 files changed, 35 insertions, 10 deletions
diff --git a/source/blender/editors/space_view3d/drawmesh.c b/source/blender/editors/space_view3d/drawmesh.c
index 7525b799067..cffcc738b5a 100644
--- a/source/blender/editors/space_view3d/drawmesh.c
+++ b/source/blender/editors/space_view3d/drawmesh.c
@@ -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);
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 54a3260439e..5c46040a2f9 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -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,
diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c
index 6c2bd25f0a5..daf0e5c9dc3 100644
--- a/source/blender/modifiers/intern/MOD_skin.c
+++ b/source/blender/modifiers/intern/MOD_skin.c
@@ -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) {