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-09-25 04:20:42 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-09-25 04:20:42 +0400
commitb0bf816ececfaf56281e1539577656df3c995aa0 (patch)
tree0e289fc19194472a88e08528efb9e8fb9947d9a1 /source/blender/blenkernel/intern/anim.c
parent687cacfdd0aec599e56f7f5e2ed69f0bf6c61b4e (diff)
fix [#32646] Duplifaces can have wrong orientation with ngons
concave ngons could flip the dupliface, now use the faces normal when calculating the dupli-face.
Diffstat (limited to 'source/blender/blenkernel/intern/anim.c')
-rw-r--r--source/blender/blenkernel/intern/anim.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c
index 1b301ba43b3..8dbffc5628b 100644
--- a/source/blender/blenkernel/intern/anim.c
+++ b/source/blender/blenkernel/intern/anim.c
@@ -1140,21 +1140,17 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
float *v3;
/* float *v4; */ /* UNUSED */
float cent[3], quat[4], mat[3][3], mat3[3][3], tmat[4][4], obmat[4][4];
+ float f_no[3];
MLoop *loopstart = mloop + mp->loopstart;
- if (mp->totloop < 3) {
- /* highly unlikely but to be safe */
+ if (UNLIKELY(mp->totloop < 3)) {
continue;
}
else {
+ BKE_mesh_calc_poly_normal(mp, mloop + mp->loopstart, mvert, f_no);
v1 = mvert[(mv1 = loopstart[0].v)].co;
v2 = mvert[(mv2 = loopstart[1].v)].co;
v3 = mvert[(mv3 = loopstart[2].v)].co;
-#if 0
- if (mp->totloop > 3) {
- v4 = mvert[(mv4 = loopstart[3].v)].co;
- }
-#endif
}
/* translation */
@@ -1170,7 +1166,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa
copy_v3_v3(obmat[3], cent);
/* rotation */
- tri_to_quat(quat, v1, v2, v3);
+ tri_to_quat_ex(quat, v1, v2, v3, f_no);
quat_to_mat3(mat, quat);
/* scale */