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:
Diffstat (limited to 'source/blender/editors/space_view3d/drawarmature.c')
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c76
1 files changed, 30 insertions, 46 deletions
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index fc35ab93f70..3f45e32937d 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -146,7 +146,7 @@ static void cp_shade_color3ub (unsigned char cp[3], const int offset)
}
/* This function sets the gl-color for coloring a certain bone (based on bcolor) */
-static short set_pchan_glColor (short colCode, int boneflag, int constflag)
+static short set_pchan_glColor (short colCode, int boneflag, short constflag)
{
switch (colCode) {
case PCHAN_COLOR_NORMAL:
@@ -697,13 +697,9 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel
vec[0]= - *(si+a) * dirvec[0] + *(co+a) * norvec[0];
vec[1]= - *(si+a) * dirvec[1] + *(co+a) * norvec[1];
vec[2]= - *(si+a) * dirvec[2] + *(co+a) * norvec[2];
-
- vec1[0]= headvec[0] + head*vec[0];
- vec1[1]= headvec[1] + head*vec[1];
- vec1[2]= headvec[2] + head*vec[2];
- vec2[0]= headvec[0] + (head+dist)*vec[0];
- vec2[1]= headvec[1] + (head+dist)*vec[1];
- vec2[2]= headvec[2] + (head+dist)*vec[2];
+
+ madd_v3_v3v3fl(vec1, headvec, vec, head);
+ madd_v3_v3v3fl(vec2, headvec, vec, head + dist);
glColor4ub(255, 255, 255, 50);
glVertex3fv(vec1);
@@ -715,13 +711,9 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel
vec[0]= *(si+a) * dirvec[0] + *(co+a) * norvec[0];
vec[1]= *(si+a) * dirvec[1] + *(co+a) * norvec[1];
vec[2]= *(si+a) * dirvec[2] + *(co+a) * norvec[2];
-
- vec1[0]= tailvec[0] + tail*vec[0];
- vec1[1]= tailvec[1] + tail*vec[1];
- vec1[2]= tailvec[2] + tail*vec[2];
- vec2[0]= tailvec[0] + (tail+dist)*vec[0];
- vec2[1]= tailvec[1] + (tail+dist)*vec[1];
- vec2[2]= tailvec[2] + (tail+dist)*vec[2];
+
+ madd_v3_v3v3fl(vec1, tailvec, vec, tail);
+ madd_v3_v3v3fl(vec2, tailvec, vec, tail + dist);
//glColor4ub(255, 255, 255, 50);
glVertex3fv(vec1);
@@ -733,14 +725,10 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel
vec[0]= - *(si) * dirvec[0] + *(co) * norvec[0];
vec[1]= - *(si) * dirvec[1] + *(co) * norvec[1];
vec[2]= - *(si) * dirvec[2] + *(co) * norvec[2];
-
- vec1[0]= headvec[0] + head*vec[0];
- vec1[1]= headvec[1] + head*vec[1];
- vec1[2]= headvec[2] + head*vec[2];
- vec2[0]= headvec[0] + (head+dist)*vec[0];
- vec2[1]= headvec[1] + (head+dist)*vec[1];
- vec2[2]= headvec[2] + (head+dist)*vec[2];
-
+
+ madd_v3_v3v3fl(vec1, headvec, vec, head);
+ madd_v3_v3v3fl(vec2, headvec, vec, head + dist);
+
//glColor4ub(255, 255, 255, 50);
glVertex3fv(vec1);
//glColor4ub(255, 255, 255, 0);
@@ -752,7 +740,7 @@ static void draw_sphere_bone_dist(float smat[][4], float imat[][4], bPoseChannel
/* smat, imat = mat & imat to draw screenaligned */
-static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
{
float head, tail /*, length*/;
float *headvec, *tailvec, dirvec[3];
@@ -839,21 +827,17 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag,
glLoadName(id | BONESEL_BONE);
glBegin(GL_LINES);
- vec[0]= headvec[0] + norvech[0];
- vec[1]= headvec[1] + norvech[1];
- vec[2]= headvec[2] + norvech[2];
+
+ add_v3_v3v3(vec, headvec, norvech);
glVertex3fv(vec);
- vec[0]= tailvec[0] + norvect[0];
- vec[1]= tailvec[1] + norvect[1];
- vec[2]= tailvec[2] + norvect[2];
+
+ add_v3_v3v3(vec, tailvec, norvect);
glVertex3fv(vec);
- vec[0]= headvec[0] - norvech[0];
- vec[1]= headvec[1] - norvech[1];
- vec[2]= headvec[2] - norvech[2];
+
+ sub_v3_v3v3(vec, headvec, norvech);
glVertex3fv(vec);
- vec[0]= tailvec[0] - norvect[0];
- vec[1]= tailvec[1] - norvect[1];
- vec[2]= tailvec[2] - norvect[2];
+
+ sub_v3_v3v3(vec, tailvec, norvect);
glVertex3fv(vec);
glEnd();
@@ -861,7 +845,7 @@ static void draw_sphere_bone_wire(float smat[][4], float imat[][4], int armflag,
}
/* does wire only for outline selecting */
-static void draw_sphere_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_sphere_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
{
GLUquadricObj *qobj;
float head, tail, length;
@@ -991,7 +975,7 @@ static GLubyte bm_dot5[]= {0x0, 0x0, 0x10, 0x38, 0x7c, 0x38, 0x10, 0x0};
static GLubyte bm_dot7[]= {0x0, 0x38, 0x7C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38};
-static void draw_line_bone(int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
{
float length;
@@ -1125,7 +1109,7 @@ static void draw_b_bone_boxes(int dt, bPoseChannel *pchan, float xwidth, float l
}
}
-static void draw_b_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_b_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
{
float xwidth, length, zwidth;
@@ -1238,7 +1222,7 @@ static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float len
}
}
-static void draw_wire_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
+static void draw_wire_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, bPoseChannel *pchan, EditBone *ebone)
{
Mat4 *bbones = NULL;
int segments = 0;
@@ -1288,7 +1272,7 @@ static void draw_wire_bone(int dt, int armflag, int boneflag, int constflag, uns
draw_wire_bone_segments(pchan, bbones, length, segments);
}
-static void draw_bone(int dt, int armflag, int boneflag, int constflag, unsigned int id, float length)
+static void draw_bone(int dt, int armflag, int boneflag, short constflag, unsigned int id, float length)
{
/* Draw a 3d octahedral bone, we use normalized space based on length,
@@ -1659,7 +1643,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
float smat[4][4], imat[4][4], bmat[4][4];
int index= -1;
short do_dashed= 3, draw_wire= 0;
- short flag, constflag;
+ int flag;
/* being set below */
arm->layer_used= 0;
@@ -1880,6 +1864,7 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
((G.f & G_PICKSEL)==0 || (bone->flag & BONE_UNSELECTABLE)==0) )
{
if (bone->layer & arm->layer) {
+ const short constflag= pchan->constflag;
if ((do_dashed & 1) && (pchan->parent)) {
/* Draw a line from our root to the parent's tip
* - only if V3D_HIDE_HELPLINES is enabled...
@@ -1901,16 +1886,16 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
* - only if temporary chain (i.e. "autoik")
*/
if (arm->flag & ARM_POSEMODE) {
- if (pchan->constflag & PCHAN_HAS_IK) {
+ if (constflag & PCHAN_HAS_IK) {
if (bone->flag & BONE_SELECTED) {
- if (pchan->constflag & PCHAN_HAS_TARGET) glColor3ub(200, 120, 0);
+ if (constflag & PCHAN_HAS_TARGET) glColor3ub(200, 120, 0);
else glColor3ub(200, 200, 50); // add theme!
glLoadName(index & 0xFFFF);
pchan_draw_IK_root_lines(pchan, !(do_dashed & 2));
}
}
- else if (pchan->constflag & PCHAN_HAS_SPLINEIK) {
+ else if (constflag & PCHAN_HAS_SPLINEIK) {
if (bone->flag & BONE_SELECTED) {
glColor3ub(150, 200, 50); // add theme!
@@ -1935,7 +1920,6 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base,
flag |= BONE_DRAW_ACTIVE;
/* extra draw service for pose mode */
- constflag= pchan->constflag;
/* set color-set to use */
set_pchan_colorset(ob, pchan);