From 486985762aa71b75ec1d1d0e7bbf0f777065f3a3 Mon Sep 17 00:00:00 2001 From: Martin Poirier Date: Tue, 7 Apr 2009 20:05:32 +0000 Subject: [PATCH] etch-a-ton Use head not tail normal for bone orientation. Simplify roll to normal a bit. --- source/blender/src/editarmature_generate.c | 6 +++--- source/blender/src/editarmature_sketch.c | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/source/blender/src/editarmature_generate.c b/source/blender/src/editarmature_generate.c index ad312f079bd..930ca263499 100644 --- a/source/blender/src/editarmature_generate.c +++ b/source/blender/src/editarmature_generate.c @@ -51,14 +51,14 @@ void setBoneRollFromNormal(EditBone *bone, float *no, float invmat[][4], float t { if (no != NULL && !VecIsNull(no)) { - float tangent[3], cotangent[3], normal[3]; + float tangent[3], vec[3], normal[3]; VECCOPY(normal, no); Mat3MulVecfl(tmat, normal); VecSubf(tangent, bone->tail, bone->head); - Crossf(cotangent, tangent, normal); - Crossf(normal, cotangent, tangent); + Projf(vec, tangent, normal); + VecSubf(normal, normal, vec); Normalize(normal); diff --git a/source/blender/src/editarmature_sketch.c b/source/blender/src/editarmature_sketch.c index 38e44319b47..91aadd07392 100644 --- a/source/blender/src/editarmature_sketch.c +++ b/source/blender/src/editarmature_sketch.c @@ -1011,7 +1011,22 @@ void sk_drawStroke(SK_Stroke *stk, int id, float color[3], int start, int end) } glEnd(); - + +#if 0 + glColor3f(0, 0, 1); + glBegin(GL_LINES); + + for (i = 0; i < stk->nb_points; i++) + { + float *p = stk->points[i].p; + float *no = stk->points[i].no; + glVertex3fv(p); + glVertex3f(p[0] + no[0], p[1] + no[1], p[2] + no[2]); + } + + glEnd(); +#endif + glColor3f(0, 0, 0); glBegin(GL_POINTS); @@ -1961,7 +1976,7 @@ void sk_convertStroke(SK_Stroke *stk) Mat4MulVecfl(invmat, bone->head); Mat4MulVecfl(invmat, bone->tail); - setBoneRollFromNormal(bone, pt->no, invmat, tmat); + setBoneRollFromNormal(bone, head->no, invmat, tmat); } new_parent = bone;