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:
authorJulian Eisel <julian@blender.org>2020-07-01 18:25:04 +0300
committerJulian Eisel <julian@blender.org>2020-07-01 18:25:04 +0300
commit889c4ca9c26d770af02cedef972d65eb173bdb5e (patch)
tree6f46156146db1b3f09d92c6eaa1f44ba8a584ed4 /source/blender/bmesh/intern/bmesh_interp.c
parent87df15190210eb84ef52e5dccc2932918f912da5 (diff)
parent0829cebeb024095c268f190c34daa8ae9a5a224c (diff)
Merge branch 'asset-uuid--archived' into asset-engine--archivedasset-engine--archived
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_interp.c')
-rw-r--r--source/blender/bmesh/intern/bmesh_interp.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c
index 27c03f0a84f..82502227a9a 100644
--- a/source/blender/bmesh/intern/bmesh_interp.c
+++ b/source/blender/bmesh/intern/bmesh_interp.c
@@ -744,9 +744,21 @@ void BM_loop_interp_from_face(
float co[2];
int i;
- /* convert the 3d coords into 2d for projection */
- BLI_assert(BM_face_is_normal_valid(f_src));
- axis_dominant_v3_to_m3(axis_mat, f_src->no);
+ /* Convert the 3d coords into 2d for projection. */
+ float axis_dominant[3];
+ if (!is_zero_v3(f_src->no)) {
+ BLI_assert(BM_face_is_normal_valid(f_src));
+ copy_v3_v3(axis_dominant, f_src->no);
+ }
+ else {
+ /* Rare case in which all the vertices of the face are aligned.
+ * Get a random axis that is orthogonal to the tangent. */
+ float vec[3];
+ BM_face_calc_tangent_auto(f_src, vec);
+ ortho_v3_v3(axis_dominant, vec);
+ normalize_v3(axis_dominant);
+ }
+ axis_dominant_v3_to_m3(axis_mat, axis_dominant);
i = 0;
l_iter = l_first = BM_FACE_FIRST_LOOP(f_src);