bmesh: BM_verts_in_face was using bmesh operator flag which is no longer ensured to be available,

use internal apiflag instead, Thanks to Nicholas Bishop for spotting.

also quiet some warnings.
This commit is contained in:
Campbell Barton 2012-11-19 00:54:55 +00:00
parent eb1fccd8a5
commit cdc4037f0d
11 changed files with 34 additions and 29 deletions

View File

@ -8367,10 +8367,10 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
{
Object *ob;
for (ob = main->object.first; ob; ob = ob->id.next) {
if (ob->step_height == 0.0) {
ob->step_height = 0.150;
ob->jump_speed = 10.0;
ob->fall_speed = 55.0;
if (ob->step_height == 0.0f) {
ob->step_height = 0.15f;
ob->jump_speed = 10.0f;
ob->fall_speed = 55.0f;
}
}
}

View File

@ -99,7 +99,7 @@ BMFace *BM_face_create_quad_tri_v(BMesh *bm, BMVert **verts, int len, const BMFa
if (nodouble) {
/* check if face exists or overlaps */
is_overlap = BM_face_exists(bm, verts, len, &f);
is_overlap = BM_face_exists(verts, len, &f);
}
/* make new face */

View File

@ -311,7 +311,7 @@ BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, const int len,
if (nodouble) {
/* Check if face already exists */
overlap = BM_face_exists(bm, verts, len, &f);
overlap = BM_face_exists(verts, len, &f);
if (overlap) {
return f;
}

View File

@ -56,11 +56,16 @@ int bmesh_elem_check(void *element, const char htype);
int bmesh_radial_length(BMLoop *l);
int bmesh_disk_count(BMVert *v);
/* NOTE: ensure different parts of the API do not conflict
/**
* Internal BMHeader.api_flag
* \note Ensure different parts of the API do not conflict
* on using these internal flags!*/
#define _FLAG_JF 1 /* join faces */
#define _FLAG_MF 2 /* make face */
#define _FLAG_MV 2 /* make face, vertex */
enum {
_FLAG_JF = (1 << 0), /* join faces */
_FLAG_MF = (1 << 1), /* make face */
_FLAG_MV = (1 << 1), /* make face, vertex */
_FLAG_OVERLAP = (1 << 2) /* general overlap flag */
};
#define BM_ELEM_API_FLAG_ENABLE(element, f) ((element)->head.api_flag |= (f))
#define BM_ELEM_API_FLAG_DISABLE(element, f) ((element)->head.api_flag &= ~(f))

View File

@ -39,8 +39,6 @@
#include "bmesh.h"
#include "intern/bmesh_private.h"
#define BM_OVERLAP (1 << 13)
/**
* Returns whether or not a given vertex is
* is part of a given edge.
@ -240,7 +238,7 @@ int BM_vert_in_face(BMFace *f, BMVert *v)
* Compares the number of vertices in an array
* that appear in a given face
*/
int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len)
int BM_verts_in_face(BMFace *f, BMVert **varr, int len)
{
BMLoop *l_iter, *l_first;
@ -251,7 +249,7 @@ int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len)
int i, count = 0;
for (i = 0; i < len; i++) {
BMO_elem_flag_enable(bm, varr[i], BM_OVERLAP);
BM_ELEM_API_FLAG_ENABLE(varr[i], _FLAG_OVERLAP);
}
#ifdef USE_BMESH_HOLES
@ -266,14 +264,16 @@ int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len)
#endif
do {
if (BMO_elem_flag_test(bm, l_iter->v, BM_OVERLAP)) {
if (BM_ELEM_API_FLAG_TEST(l_iter->v, _FLAG_OVERLAP)) {
count++;
}
} while ((l_iter = l_iter->next) != l_first);
}
for (i = 0; i < len; i++) BMO_elem_flag_disable(bm, varr[i], BM_OVERLAP);
for (i = 0; i < len; i++) {
BM_ELEM_API_FLAG_DISABLE(varr[i], _FLAG_OVERLAP);
}
return count;
}
@ -1217,7 +1217,7 @@ BMEdge *BM_edge_find_double(BMEdge *e)
* \returns TRUE for overlap
*
*/
int BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_overlapface)
int BM_face_exists_overlap(BMVert **varr, int len, BMFace **r_overlapface)
{
BMIter viter;
BMFace *f;
@ -1225,7 +1225,7 @@ int BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_overlap
for (i = 0; i < len; i++) {
BM_ITER_ELEM (f, &viter, varr[i], BM_FACES_OF_VERT) {
amount = BM_verts_in_face(bm, f, varr, len);
amount = BM_verts_in_face(f, varr, len);
if (amount >= len) {
if (r_overlapface) {
*r_overlapface = f;
@ -1247,7 +1247,7 @@ int BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_overlap
* there is a face with exactly those vertices
* (and only those vertices).
*/
int BM_face_exists(BMesh *bm, BMVert **varr, int len, BMFace **r_existface)
int BM_face_exists(BMVert **varr, int len, BMFace **r_existface)
{
BMIter viter;
BMFace *f;
@ -1255,7 +1255,7 @@ int BM_face_exists(BMesh *bm, BMVert **varr, int len, BMFace **r_existface)
for (i = 0; i < len; i++) {
BM_ITER_ELEM (f, &viter, varr[i], BM_FACES_OF_VERT) {
amount = BM_verts_in_face(bm, f, varr, len);
amount = BM_verts_in_face(f, varr, len);
if (amount == len && amount == f->len) {
if (r_existface) {
*r_existface = f;

View File

@ -28,7 +28,7 @@
*/
int BM_vert_in_face(BMFace *f, BMVert *v);
int BM_verts_in_face(BMesh *bm, BMFace *f, BMVert **varr, int len);
int BM_verts_in_face(BMFace *f, BMVert **varr, int len);
int BM_edge_in_face(BMFace *f, BMEdge *e);
int BM_edge_in_loop(BMEdge *e, BMLoop *l);
@ -77,9 +77,9 @@ BMLoop *BM_face_find_longest_loop(BMFace *f);
BMEdge *BM_edge_exists(BMVert *v1, BMVert *v2);
BMEdge *BM_edge_find_double(BMEdge *e);
int BM_face_exists_overlap(BMesh *bm, BMVert **varr, int len, BMFace **r_existface);
int BM_face_exists_overlap(BMVert **varr, int len, BMFace **r_existface);
int BM_face_exists(BMesh *bm, BMVert **varr, int len, BMFace **r_existface);
int BM_face_exists(BMVert **varr, int len, BMFace **r_existface);
int BM_face_exists_multi(BMVert **varr, BMEdge **earr, int len);
int BM_face_exists_multi_edge(BMEdge **earr, int len);

View File

@ -20,7 +20,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
/** \file blender/bmesh/operators/bmesh_bevel.c
/** \file blender/bmesh/operators/bmo_bevel.c
* \ingroup bmesh
*/

View File

@ -769,7 +769,7 @@ static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, E
verts[i] = node->v;
}
if (BM_face_exists(bm, verts, i, &f)) {
if (BM_face_exists(verts, i, &f)) {
if (!BMO_elem_flag_test(bm, f, FACE_IGNORE)) {
BLI_ghash_remove(gh, endv, NULL, NULL);
continue;

View File

@ -119,7 +119,7 @@ static void hull_output_triangles(BMesh *bm, GHash *hull_triangles)
};
BMFace *f, *example = NULL;
if (BM_face_exists(bm, t->v, 3, &f)) {
if (BM_face_exists(t->v, 3, &f)) {
/* If the operator is run with "use_existing_faces"
* disabled, but an output face in the hull is the
* same as a face in the existing mesh, it should not

View File

@ -489,7 +489,7 @@ static void edbm_tagged_loop_pairs_do_fill_faces(BMesh *bm, UnorderedLoopPair *u
}
/* face should never exist */
BLI_assert(BM_face_exists(bm, f_verts, f_verts[3] ? 4 : 3, &f) == FALSE);
BLI_assert(BM_face_exists(f_verts, f_verts[3] ? 4 : 3, &f) == FALSE);
f = BM_face_create_quad_tri_v(bm, f_verts, f_verts[3] ? 4 : 3, f_example, FALSE);

View File

@ -1790,7 +1790,7 @@ static PyObject *bpy_bmfaceseq_new(BPy_BMElemSeq *self, PyObject *args)
}
/* check if the face exists */
if (BM_face_exists(bm, vert_array, vert_seq_len, NULL)) {
if (BM_face_exists(vert_array, vert_seq_len, NULL)) {
PyErr_SetString(PyExc_ValueError,
"faces.new(verts): face already exists");
goto cleanup;
@ -2012,7 +2012,7 @@ static PyObject *bpy_bmfaceseq_get__method(BPy_BMElemSeq *self, PyObject *args)
return NULL;
}
if (BM_face_exists(bm, vert_array, vert_seq_len, &f)) {
if (BM_face_exists(vert_array, vert_seq_len, &f)) {
ret = BPy_BMFace_CreatePyObject(bm, f);
}
else {