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>2012-10-30 15:40:36 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-10-30 15:40:36 +0400
commite09a1bc7cff068484ec43bb3383d4981e998c0cf (patch)
treef3acbab27f318a0e5ad9779c3996346f023c11fd /source/blender/blenkernel/intern/deform.c
parentb4e484e21189e4b30b20439f41f6ba1c15bb7581 (diff)
minor changes to select similar,
- replace ngon_fake_area() with generic call to BM_face_calc_area(). - add defvert_find_shared() utility function.
Diffstat (limited to 'source/blender/blenkernel/intern/deform.c')
-rw-r--r--source/blender/blenkernel/intern/deform.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 82938ed1d39..7c13ca388e0 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -790,3 +790,23 @@ void defvert_clear(MDeformVert *dvert)
dvert->totweight = 0;
}
+
+/**
+ * \return The first group index shared by both deform verts
+ * or -1 if none are found.
+ */
+int defvert_find_shared(const MDeformVert *dvert_a, const MDeformVert *dvert_b)
+{
+ if (dvert_a->totweight && dvert_b->totweight) {
+ MDeformWeight *dw = dvert_a->dw;
+ unsigned int i;
+
+ for (i = dvert_a->totweight; i != 0; i--, dw++) {
+ if (dw->weight > 0.0f && defvert_find_weight(dvert_b, dw->def_nr) > 0.0f) {
+ return dw->def_nr;
+ }
+ }
+ }
+
+ return -1;
+}