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>2020-04-06 08:23:01 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-04-06 08:26:27 +0300
commit6526c3ced8b52e5583ff12095e5a9fe30410062e (patch)
tree3ff1c40f365f6c8b6f8f72c95451786b1c553d41 /source/blender/bmesh
parent0ca5b7b69b0349e8d074a4942e75ed5386ff3ada (diff)
Fix displaying edit-mesh measurements with deform modifiers
Resolves regression from 2.7x
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.c25
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.h8
2 files changed, 31 insertions, 2 deletions
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 9ab5106cec2..a40c293f1aa 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -596,6 +596,31 @@ void BM_face_calc_center_bounds(const BMFace *f, float r_cent[3])
}
/**
+ * computes center of face in 3d. uses center of bounding box.
+ */
+void BM_face_calc_center_bounds_vcos(const BMesh *bm,
+ const BMFace *f,
+ float r_cent[3],
+ float const (*vertexCos)[3])
+{
+ /* must have valid index data */
+ BLI_assert((bm->elem_index_dirty & BM_VERT) == 0);
+ (void)bm;
+
+ const BMLoop *l_iter, *l_first;
+ float min[3], max[3];
+
+ INIT_MINMAX(min, max);
+
+ l_iter = l_first = BM_FACE_FIRST_LOOP(f);
+ do {
+ minmax_v3v3_v3(min, max, vertexCos[BM_elem_index_get(l_iter->v)]);
+ } while ((l_iter = l_iter->next) != l_first);
+
+ mid_v3_v3v3(r_cent, min, max);
+}
+
+/**
* computes the center of a face, using the mean average
*/
void BM_face_calc_center_median(const BMFace *f, float r_cent[3])
diff --git a/source/blender/bmesh/intern/bmesh_polygon.h b/source/blender/bmesh/intern/bmesh_polygon.h
index 2ae32777a7d..1611bc0b893 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.h
+++ b/source/blender/bmesh/intern/bmesh_polygon.h
@@ -60,10 +60,14 @@ void BM_face_calc_tangent_edge_diagonal(const BMFace *f, float r_plane[3]) ATTR_
void BM_face_calc_tangent_vert_diagonal(const BMFace *f, float r_plane[3]) ATTR_NONNULL();
void BM_face_calc_tangent_auto(const BMFace *f, float r_plane[3]) ATTR_NONNULL();
void BM_face_calc_center_bounds(const BMFace *f, float center[3]) ATTR_NONNULL();
-void BM_face_calc_center_median(const BMFace *f, float center[3]) ATTR_NONNULL();
+void BM_face_calc_center_bounds_vcos(const BMesh *bm,
+ const BMFace *f,
+ float r_center[3],
+ float const (*vertexCos)[3]) ATTR_NONNULL();
+void BM_face_calc_center_median(const BMFace *f, float r_center[3]) ATTR_NONNULL();
void BM_face_calc_center_median_vcos(const BMesh *bm,
const BMFace *f,
- float r_cent[3],
+ float r_center[3],
float const (*vertexCos)[3]) ATTR_NONNULL();
void BM_face_calc_center_median_weighted(const BMFace *f, float center[3]) ATTR_NONNULL();