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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2013-07-24 23:58:16 +0400
committerCampbell Barton <ideasman42@gmail.com>2013-07-24 23:58:16 +0400
commit2d2f5f59d72060dd0e56ed5d03addac129f64a94 (patch)
tree74b3d431fdece27cc34fef09e83428171694a10d /source
parent19496ab62a55a02e930eff3d7b735d9540bf01dd (diff)
dyn-topo: maintain materials for new faces.
also minor optimization for BM_edge_in_face(), check edges radial loops rather then the faces edges since normally there are 0-2 faces attached to an edge compared to 3+ edges in a face.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/pbvh_bmesh.c7
-rw-r--r--source/blender/bmesh/intern/bmesh_queries.c18
2 files changed, 13 insertions, 12 deletions
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index c6a5552dbf7..cd21f8ad968 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -294,7 +294,7 @@ static BMVert *pbvh_bmesh_vert_create(PBVH *bvh, int node_index,
static BMFace *pbvh_bmesh_face_create(PBVH *bvh, int node_index,
BMVert *v_tri[3], BMEdge *e_tri[3],
- const BMFace *UNUSED(example))
+ const BMFace *f_example)
{
BMFace *f;
void *val = SET_INT_IN_POINTER(node_index);
@@ -302,9 +302,10 @@ static BMFace *pbvh_bmesh_face_create(PBVH *bvh, int node_index,
/* ensure we never add existing face */
BLI_assert(BM_face_exists(v_tri, 3, NULL) == false);
- /* Note: passing NULL for the 'example' parameter, profiling shows
- * a small performance bump */
f = BM_face_create(bvh->bm, v_tri, e_tri, 3, 0);
+ // BM_elem_attrs_copy(bvh->bm, bvh->bm, f_example, f);
+ f->mat_nr = f_example->mat_nr;
+
if (!BLI_ghash_haskey(bvh->bm_face_to_node, f)) {
BLI_ghash_insert(bvh->nodes[node_index].bm_faces, f, NULL);
diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c
index 8f5e25f5fd7..9dc5ae61d61 100644
--- a/source/blender/bmesh/intern/bmesh_queries.c
+++ b/source/blender/bmesh/intern/bmesh_queries.c
@@ -338,16 +338,16 @@ bool BM_verts_in_face(BMFace *f, BMVert **varr, int len)
*/
bool BM_edge_in_face(BMFace *f, BMEdge *e)
{
- BMLoop *l_iter;
- BMLoop *l_first;
-
- l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+ if (e->l) {
+ BMLoop *l_iter, *l_first;
- do {
- if (l_iter->e == e) {
- return true;
- }
- } while ((l_iter = l_iter->next) != l_first);
+ l_iter = l_first = e->l;
+ do {
+ if (l_iter->f == f) {
+ return true;
+ }
+ } while ((l_iter = l_iter->radial_next) != l_first);
+ }
return false;
}