Page MenuHome

bone_drawing_01a.patch

bone_drawing_01a.patch

Index: blender/blenloader/intern/readfile.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/blenloader/intern/readfile.c,v
retrieving revision 1.285
diff -u -r1.285 readfile.c
--- blender/blenloader/intern/readfile.c 13 Aug 2006 14:18:15 -0000 1.285
+++ blender/blenloader/intern/readfile.c 18 Aug 2006 11:51:26 -0000
@@ -5582,10 +5582,15 @@
if(main->versionfile <= 242) {
Scene *sce;
+ bArmature *arm;
for(sce= main->scene.first; sce; sce= sce->id.next) {
if (sce->toolsettings->select_thresh == 0.0f)
sce->toolsettings->select_thresh= 0.01f;
+ }
+
+ for(arm= main->armature.first; arm; arm= arm->id.next) {
+ arm->flag |= ARM_DRAWCSHAPE;
}
}
Index: blender/include/butspace.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/include/butspace.h,v
retrieving revision 1.87
diff -u -r1.87 butspace.h
--- blender/include/butspace.h 13 Aug 2006 14:18:15 -0000 1.87
+++ blender/include/butspace.h 14 Aug 2006 05:06:07 -0000
@@ -464,6 +464,8 @@
#define B_ARM_RECALCDATA 2301
#define B_ARM_STRIDE 2302
+#define B_ARM_CUSTCOLOR 2303
+
/* *********************** */
#define B_CAMBUTS 2500
Index: blender/makesdna/DNA_action_types.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_action_types.h,v
retrieving revision 1.28
diff -u -r1.28 DNA_action_types.h
--- blender/makesdna/DNA_action_types.h 6 May 2006 15:26:52 -0000 1.28
+++ blender/makesdna/DNA_action_types.h 14 Aug 2006 11:08:53 -0000
@@ -77,6 +77,8 @@
float *path; /* totpath x 3 x float */
struct Object *custom; /* draws custom object instead of this channel */
+ float custom_colour[3]; /* rgb - colour of bone as assigned by user*/
+ float pad3;
} bPoseChannel;
Index: blender/makesdna/DNA_armature_types.h
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/makesdna/DNA_armature_types.h,v
retrieving revision 1.28
diff -u -r1.28 DNA_armature_types.h
--- blender/makesdna/DNA_armature_types.h 23 Feb 2006 14:45:59 -0000 1.28
+++ blender/makesdna/DNA_armature_types.h 13 Aug 2006 11:02:37 -0000
@@ -95,6 +95,8 @@
#define ARM_DONT_USE 0x080
#define ARM_MIRROR_EDIT 0x100
#define ARM_AUTO_IK 0x200
+#define ARM_DRAWCSHAPE 0x400
+#define ARM_DRAWCCOLOR 0x800
/* armature->drawtype */
#define ARM_OCTA 0
Index: blender/src/buttons_editing.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/buttons_editing.c,v
retrieving revision 1.266
diff -u -r1.266 buttons_editing.c
--- blender/src/buttons_editing.c 18 Aug 2006 06:08:21 -0000 1.266
+++ blender/src/buttons_editing.c 18 Aug 2006 09:28:08 -0000
@@ -2928,8 +2928,10 @@
uiDefButI(block, ROW, REDRAWVIEW3D, "B-Bone", 155, 100,70,20, &arm->drawtype, 0, ARM_B_BONE, 0, 0, "Draw bones as boxes, showing subdivision and b-splines");
uiDefButI(block, ROW, REDRAWVIEW3D, "Envelope", 225, 100,85,20, &arm->drawtype, 0, ARM_ENVELOPE, 0, 0, "Draw bones as extruded spheres, showing deformation influence volume");
- uiDefButBitI(block, TOG, ARM_DRAWAXES, REDRAWVIEW3D, "Draw Axes", 10, 80,150,20, &arm->flag, 0, 0, 0, 0, "Draw bone axes");
- uiDefButBitI(block, TOG, ARM_DRAWNAMES, REDRAWVIEW3D, "Draw Names", 160,80,150,20, &arm->flag, 0, 0, 0, 0, "Draw bone names");
+ uiDefButBitI(block, TOG, ARM_DRAWAXES, REDRAWVIEW3D, "Axes", 10, 80,75,20, &arm->flag, 0, 0, 0, 0, "Draw bone axes");
+ uiDefButBitI(block, TOG, ARM_DRAWNAMES, REDRAWVIEW3D, "Names", 85,80,75,20, &arm->flag, 0, 0, 0, 0, "Draw bone names");
+ uiDefButBitI(block, TOG, ARM_DRAWCSHAPE, REDRAWVIEW3D, "Shaped", 160, 80,75,20, &arm->flag, 0, 0, 0, 0, "Draw custom bone shapes");
+ uiDefButBitI(block, TOG, ARM_DRAWCCOLOR, REDRAWVIEW3D, "Colors", 235,80,75,20, &arm->flag, 0, 0, 0, 0, "Draw custom bone colors");
uiDefButS(block, NUM, REDRAWVIEW3D, "Ghost: ", 10,60,150,20, &arm->ghostep, 0.0f, 30.0f, 0, 0, "Draw Ghosts around current frame, for current Action");
uiDefButS(block, NUM, REDRAWVIEW3D, "Step: ", 160,60,150,20, &arm->ghostsize, 1.0f, 20.0f, 0, 0, "How many frames between Ghost instances");
@@ -3109,22 +3111,24 @@
uiDefButF(block, NUM,B_ARM_RECALCDATA, "Out:", 220, by-19, 110, 19, &curBone->ease2, 0.0, 2.0, 10.0, 0.0, "Second length of Bezier handle");
/* bone types */
- uiDefButBitI(block, TOG, BONE_HINGE, B_ARM_RECALCDATA, "Hinge", -10,by-38,80,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Don't inherit rotation or scale from parent Bone");
- uiDefButBitI(block, TOGN, BONE_NO_DEFORM, B_ARM_RECALCDATA, "Deform", 70, by-38, 80, 19, &curBone->flag, 0.0, 0.0, 0.0, 0.0, "Indicate if Bone deforms geometry");
- uiDefButBitI(block, TOG, BONE_MULT_VG_ENV, B_ARM_RECALCDATA, "Mult", 150,by-38,80,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Multiply Bone Envelope with VertexGroup");
- uiDefIDPoinBut(block, test_obpoin_but, ID_OB, REDRAWVIEW3D, "OB:", 230,by-38,100,19, &pchan->custom, "Object that defines custom draw type for this Bone");
+ uiDefButBitI(block, TOG, BONE_HINGE, B_ARM_RECALCDATA, "Hinge", -10,by-38,113,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Don't inherit rotation or scale from parent Bone");
+ uiDefButBitI(block, TOGN, BONE_NO_DEFORM, B_ARM_RECALCDATA, "Deform", 104, by-38, 113, 19, &curBone->flag, 0.0, 0.0, 0.0, 0.0, "Indicate if Bone deforms geometry");
+ uiDefButBitI(block, TOG, BONE_MULT_VG_ENV, B_ARM_RECALCDATA, "Mult", 217,by-38,113,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Multiply Bone Envelope with VertexGroup");
+
+ uiDefIDPoinBut(block, test_obpoin_but, ID_OB, REDRAWVIEW3D, "OB:", -10,by-57,170,19, &pchan->custom, "Object that defines custom draw type for this Bone");
+ uiDefButF(block, COL, REDRAWVIEW3D, "", 160,by-57,170,29, &(pchan->custom_colour[0]), 0, 0, 0, B_ARM_CUSTCOLOR, "Custom colour for drawing this Bone");
/* layers */
uiBlockBeginAlign(block);
for(a=0; a<8; a++) {
short dx= 21;
- but= uiDefButBitS(block, TOG, 1<<a, REDRAWVIEW3D, "", -10+a*dx, by-57, dx, 15, &curBone->layer, 0, 0, 0, 0, "");
+ but= uiDefButBitS(block, TOG, 1<<a, REDRAWVIEW3D, "", -10+a*dx, by-76, dx, 15, &curBone->layer, 0, 0, 0, 0, "");
uiButSetFunc(but, armature_layer_cb, &curBone->layer, (void *)(1<<a));
}
uiBlockBeginAlign(block);
for(a=8; a<16; a++) {
short dx= 21;
- but= uiDefButBitS(block, TOG, 1<<a, REDRAWVIEW3D, "", -6+a*dx, by-57, dx, 15, &curBone->layer, 0, 0, 0, 0, "");
+ but= uiDefButBitS(block, TOG, 1<<a, REDRAWVIEW3D, "", -6+a*dx, by-76, dx, 15, &curBone->layer, 0, 0, 0, 0, "");
uiButSetFunc(but, armature_layer_cb, &curBone->layer, (void *)(1<<a));
}
uiBlockEndAlign(block);
@@ -3137,13 +3141,13 @@
if(pose_channel_in_IK_chain(ob, pchan)) {
uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, BONE_IK_NO_XDOF, B_ARM_RECALCDATA, "Lock X Rot", -10,by-60,114,19, &pchan->ikflag, 0.0, 0.0, 0.0, 0.0, "Disable X DoF for IK");
+ uiDefButBitS(block, TOG, BONE_IK_NO_XDOF, B_ARM_RECALCDATA, "Lock X Rot", -10,by-80,114,19, &pchan->ikflag, 0.0, 0.0, 0.0, 0.0, "Disable X DoF for IK");
if ((pchan->ikflag & BONE_IK_NO_XDOF)==0) {
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Stiff X:", -10, by-80, 114, 19, &pchan->stiffness[0], 0.0, 0.99, 1.0, 0.0, "Resistance to bending for X axis");
- uiDefButBitS(block, TOG, BONE_IK_XLIMIT, B_ARM_RECALCDATA, "Limit X", -10,by-100,114,19, &pchan->ikflag, 0.0, 0.0, 0.0, 0.0, "Limit rotation over X axis");
+ uiDefButF(block, NUM, B_ARM_RECALCDATA, "Stiff X:", -10, by-100, 114, 19, &pchan->stiffness[0], 0.0, 0.99, 1.0, 0.0, "Resistance to bending for X axis");
+ uiDefButBitS(block, TOG, BONE_IK_XLIMIT, B_ARM_RECALCDATA, "Limit X", -10,by-120,114,19, &pchan->ikflag, 0.0, 0.0, 0.0, 0.0, "Limit rotation over X axis");
if ((pchan->ikflag & BONE_IK_XLIMIT)) {
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Min X:", -10, by-120, 114, 19, &pchan->limitmin[0], -180.0, 0.0, 1000, 1, "Minimum X limit");
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Max X:", -10, by-140, 114, 19, &pchan->limitmax[0], 0.0, 180.0f, 1000, 1, "Maximum X limit");
+ uiDefButF(block, NUM, B_ARM_RECALCDATA, "Min X:", -10, by-140, 114, 19, &pchan->limitmin[0], -180.0, 0.0, 1000, 1, "Minimum X limit");
+ uiDefButF(block, NUM, B_ARM_RECALCDATA, "Max X:", -10, by-160, 114, 19, &pchan->limitmax[0], 0.0, 180.0f, 1000, 1, "Maximum X limit");
zerolimit = 0;
}
zerodof = 0;
@@ -3151,13 +3155,13 @@
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, BONE_IK_NO_YDOF, B_ARM_RECALCDATA, "Lock Y Rot", 104,by-60,113,19, &pchan->ikflag, 0.0, 0.0, 0.0, 0.0, "Disable Y DoF for IK");
+ uiDefButBitS(block, TOG, BONE_IK_NO_YDOF, B_ARM_RECALCDATA, "Lock Y Rot", 104,by-80,113,19, &pchan->ikflag, 0.0, 0.0, 0.0, 0.0, "Disable Y DoF for IK");
if ((pchan->ikflag & BONE_IK_NO_YDOF)==0) {
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Stiff Y:", 104, by-80, 114, 19, &pchan->stiffness[1], 0.0, 0.99, 1.0, 0.0, "Resistance to twisting over Y axis");
- uiDefButBitS(block, TOG, BONE_IK_YLIMIT, B_ARM_RECALCDATA, "Limit Y", 104,by-100,113,19, &pchan->ikflag, 0.0, 0.0, 0.0, 0.0, "Limit rotation over Y axis");
+ uiDefButF(block, NUM, B_ARM_RECALCDATA, "Stiff Y:", 104, by-100, 114, 19, &pchan->stiffness[1], 0.0, 0.99, 1.0, 0.0, "Resistance to twisting over Y axis");
+ uiDefButBitS(block, TOG, BONE_IK_YLIMIT, B_ARM_RECALCDATA, "Limit Y", 104,by-120,113,19, &pchan->ikflag, 0.0, 0.0, 0.0, 0.0, "Limit rotation over Y axis");
if ((pchan->ikflag & BONE_IK_YLIMIT)) {
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Min Y:", 104, by-120, 113, 19, &pchan->limitmin[1], -180.0, 0.0, 1000, 1, "Minimum Y limit");
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Max Y:", 104, by-140, 113, 19, &pchan->limitmax[1], 0.0, 180.0, 1000, 1, "Maximum Y limit");
+ uiDefButF(block, NUM, B_ARM_RECALCDATA, "Min Y:", 104, by-140, 113, 19, &pchan->limitmin[1], -180.0, 0.0, 1000, 1, "Minimum Y limit");
+ uiDefButF(block, NUM, B_ARM_RECALCDATA, "Max Y:", 104, by-160, 113, 19, &pchan->limitmax[1], 0.0, 180.0, 1000, 1, "Maximum Y limit");
zerolimit = 0;
}
zerodof = 0;
@@ -3165,31 +3169,31 @@
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, BONE_IK_NO_ZDOF, B_ARM_RECALCDATA, "Lock Z Rot", 217,by-60,113,19, &pchan->ikflag, 0.0, 0.0, 0.0, 0.0, "Disable Z DoF for IK");
+ uiDefButBitS(block, TOG, BONE_IK_NO_ZDOF, B_ARM_RECALCDATA, "Lock Z Rot", 217,by-80,113,19, &pchan->ikflag, 0.0, 0.0, 0.0, 0.0, "Disable Z DoF for IK");
if ((pchan->ikflag & BONE_IK_NO_ZDOF)==0) {
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Stiff Z:", 217, by-80, 114, 19, &pchan->stiffness[2], 0.0, 0.99, 1.0, 0.0, "Resistance to bending for Z axis");
- uiDefButBitS(block, TOG, BONE_IK_ZLIMIT, B_ARM_RECALCDATA, "Limit Z", 217,by-100,113,19, &pchan->ikflag, 0.0, 0.0, 0.0, 0.0, "Limit rotation over Z axis");
+ uiDefButF(block, NUM, B_ARM_RECALCDATA, "Stiff Z:", 217, by-100, 114, 19, &pchan->stiffness[2], 0.0, 0.99, 1.0, 0.0, "Resistance to bending for Z axis");
+ uiDefButBitS(block, TOG, BONE_IK_ZLIMIT, B_ARM_RECALCDATA, "Limit Z", 217,by-120,113,19, &pchan->ikflag, 0.0, 0.0, 0.0, 0.0, "Limit rotation over Z axis");
if ((pchan->ikflag & BONE_IK_ZLIMIT)) {
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Min Z:", 217, by-120, 113, 19, &pchan->limitmin[2], -180.0, 0.0, 1000, 1, "Minimum Z limit");
- uiDefButF(block, NUM, B_ARM_RECALCDATA, "Max Z:", 217, by-140, 113, 19, &pchan->limitmax[2], 0.0, 180.0, 1000, 1, "Maximum Z limit");
+ uiDefButF(block, NUM, B_ARM_RECALCDATA, "Min Z:", 217, by-140, 113, 19, &pchan->limitmin[2], -180.0, 0.0, 1000, 1, "Minimum Z limit");
+ uiDefButF(block, NUM, B_ARM_RECALCDATA, "Max Z:", 217, by-160, 113, 19, &pchan->limitmax[2], 0.0, 180.0, 1000, 1, "Maximum Z limit");
zerolimit = 0;
}
zerodof = 0;
}
uiBlockEndAlign(block);
- by -= (zerodof)? 82: (zerolimit)? 122: 162;
+ by -= (zerodof)? 82: (zerolimit)? 142: 182;
uiDefButF(block, NUM, B_ARM_RECALCDATA, "Stretch:", -10, by, 113, 19, &pchan->ikstretch, 0.0, 1.0, 1.0, 0.0, "Allow scaling of the bone for IK");
by -= 20;
}
else {
- but= uiDefButBitS(block, TOG, POSE_STRIDE, B_ARM_STRIDE, "Stride Root", -10, by-60, 113, 19, &pchan->flag, 0.0, 0.0, 0, 0, "Set this PoseChannel to define the Stride distance");
+ but= uiDefButBitS(block, TOG, POSE_STRIDE, B_ARM_STRIDE, "Stride Root", -10, by-80, 113, 19, &pchan->flag, 0.0, 0.0, 0, 0, "Set this PoseChannel to define the Stride distance");
uiButSetFunc(but, validate_stridebutton_cb, pchan, NULL);
- uiDefBut(block, LABEL, 0, "(DoF only for IK chains)", 110,by-60, 190, 19, 0, 0, 0, 0, 0, "");
- by -= 82;
+ uiDefBut(block, LABEL, 0, "(DoF only for IK chains)", 110,by-80, 190, 19, 0, 0, 0, 0, 0, "");
+ by -= 102;
}
Index: blender/src/drawarmature.c
===================================================================
RCS file: /cvsroot/bf-blender/blender/source/blender/src/drawarmature.c,v
retrieving revision 1.36
diff -u -r1.36 drawarmature.c
--- blender/src/drawarmature.c 28 Jan 2006 18:33:17 -0000 1.36
+++ blender/src/drawarmature.c 18 Aug 2006 11:11:58 -0000
@@ -333,7 +333,7 @@
/* *************** Armature drawing, bones ******************* */
-static void draw_bone_points(int dt, int armflag, unsigned int boneflag, int id)
+static void draw_bone_points(int dt, int armflag, unsigned int boneflag, int id, float custom_colour[3])
{
/* Draw root point if we are not connected */
if (!(boneflag & BONE_CONNECTED)){
@@ -345,11 +345,32 @@
if (boneflag & BONE_ROOTSEL) BIF_ThemeColor(TH_VERTEX_SELECT);
else BIF_ThemeColor(TH_VERTEX);
}
+ else if((armflag & ARM_POSEMODE) &&
+ (armflag & ARM_DRAWCCOLOR)) {
+ float ncol[3];
+ VECCOPY(ncol, custom_colour);
+ if (boneflag & BONE_ROOTSEL) {
+ ncol[0] = 1.16f - ncol[0];
+ ncol[1] = 1.16f - ncol[1];
+ ncol[2] = 1.16f - ncol[2];
+ CLAMP(ncol[0], 0.0f, 1.0f);
+ CLAMP(ncol[1], 0.0f, 1.0f);
+ CLAMP(ncol[2], 0.0f, 1.0f);
+ }
+ glColor3f(ncol[0], ncol[1], ncol[2]);
+ }
}
else
BIF_ThemeColor(TH_BONE_SOLID);
- if(dt>OB_WIRE) draw_bonevert_solid();
+ if(dt>OB_WIRE) {
+ if (armflag & ARM_DRAWCCOLOR) {
+ float ncol[3];
+ VECCOPY(ncol, custom_colour);
+ glColor4f(ncol[0], ncol[1], ncol[2], 0.8);
+ }
+ draw_bonevert_solid();
+ }
else draw_bonevert();
}
@@ -362,13 +383,34 @@
if (boneflag & BONE_TIPSEL) BIF_ThemeColor(TH_VERTEX_SELECT);
else BIF_ThemeColor(TH_VERTEX);
}
+ else if((armflag & ARM_POSEMODE) &&
+ (armflag & ARM_DRAWCCOLOR)) {
+ float ncol[3];
+ VECCOPY(ncol, custom_colour);
+ if (boneflag & BONE_ROOTSEL) {
+ ncol[0] = 1.16f - ncol[0];
+ ncol[1] = 1.16f - ncol[1];
+ ncol[2] = 1.16f - ncol[2];
+ CLAMP(ncol[0], 0.0f, 1.0f);
+ CLAMP(ncol[1], 0.0f, 1.0f);
+ CLAMP(ncol[2], 0.0f, 1.0f);
+ }
+ glColor3f(ncol[0], ncol[1], ncol[2]);
+ }
}
else {
BIF_ThemeColor(TH_BONE_SOLID);
}
glTranslatef(0.0, 1.0, 0.0);
- if(dt>OB_WIRE) draw_bonevert_solid();
+ if(dt>OB_WIRE) {
+ if (armflag & ARM_DRAWCCOLOR) {
+ float ncol[3];
+ VECCOPY(ncol, custom_colour);
+ glColor4f(ncol[0], ncol[1], ncol[2], 0.8);
+ }
+ draw_bonevert_solid();
+ }
else draw_bonevert();
glTranslatef(0.0, -1.0, 0.0);
@@ -548,10 +590,33 @@
else BIF_ThemeColor(TH_VERTEX);
}
else if(armflag & ARM_POSEMODE) {
- /* in black or selection color */
- if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
- else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
- else BIF_ThemeColor(TH_WIRE);
+ if (armflag & ARM_DRAWCCOLOR) {
+ float ncol[3];
+ VECCOPY(ncol, pchan->custom_colour);
+ if (boneflag & BONE_ACTIVE) {
+ ncol[0] = 1.16f - ncol[0];
+ ncol[1] = 1.16f - ncol[1];
+ ncol[2] = 1.16f - ncol[2];
+ CLAMP(ncol[0], 0.0f, 1.0f);
+ CLAMP(ncol[1], 0.0f, 1.0f);
+ CLAMP(ncol[2], 0.0f, 1.0f);
+ }
+ else if (boneflag & BONE_SELECTED) {
+ ncol[0] = 1.0f - ncol[0];
+ ncol[1] = 1.0f - ncol[1];
+ ncol[2] = 1.0f - ncol[2];
+ CLAMP(ncol[0], 0.0f, 1.0f);
+ CLAMP(ncol[1], 0.0f, 1.0f);
+ CLAMP(ncol[2], 0.0f, 1.0f);
+ }
+ glColor3f(ncol[0], ncol[1], ncol[2]);
+ }
+ else {
+ /* in black or selection color */
+ if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
+ else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
+ else BIF_ThemeColor(TH_WIRE);
+ }
}
/* Draw root point if we are not connected */
@@ -673,9 +738,32 @@
else BIF_ThemeColorShade(TH_BONE_SOLID, -30);
}
else if(armflag & ARM_POSEMODE) {
- if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 10);
- else if (boneflag & BONE_SELECTED) BIF_ThemeColorShade(TH_BONE_POSE, -30);
- else BIF_ThemeColorShade(TH_BONE_SOLID, -30);
+ if (armflag & ARM_DRAWCCOLOR) {
+ float ncol[3];
+ VECCOPY(ncol, pchan->custom_colour);
+ if (boneflag & BONE_ACTIVE) {
+ ncol[0] = 1.03f - ncol[0];
+ ncol[1] = 1.03f - ncol[1];
+ ncol[2] = 1.03f - ncol[2];
+ CLAMP(ncol[0], 0.0f, 1.0f);
+ CLAMP(ncol[1], 0.0f, 1.0f);
+ CLAMP(ncol[2], 0.0f, 1.0f);
+ }
+ else if (boneflag & BONE_SELECTED) {
+ ncol[0] = 0.88f - ncol[0];
+ ncol[1] = 0.88f - ncol[1];
+ ncol[2] = 0.88f - ncol[2];
+ CLAMP(ncol[0], 0.0f, 1.0f);
+ CLAMP(ncol[1], 0.0f, 1.0f);
+ CLAMP(ncol[2], 0.0f, 1.0f);
+ }
+ glColor3f(ncol[0], ncol[1], ncol[2]);
+ }
+ else {
+ if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 10);
+ else if (boneflag & BONE_SELECTED) BIF_ThemeColorShade(TH_BONE_POSE, -30);
+ else BIF_ThemeColorShade(TH_BONE_SOLID, -30);
+ }
}
else if(dt==OB_SOLID)
@@ -707,9 +795,35 @@
else BIF_ThemeColor(TH_BONE_SOLID);
}
else if(armflag & ARM_POSEMODE) {
- if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
- else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
- else BIF_ThemeColor(TH_BONE_SOLID);
+ if (armflag & ARM_DRAWCCOLOR) {
+ float ncol[3];
+
+ VECCOPY(ncol, pchan->custom_colour);
+
+ if (boneflag & BONE_ACTIVE) {
+ ncol[0] = 1.16f - ncol[0];
+ ncol[1] = 1.16f - ncol[1];
+ ncol[2] = 1.16f - ncol[2];
+ CLAMP(ncol[0], 0.0f, 1.0f);
+ CLAMP(ncol[1], 0.0f, 1.0f);
+ CLAMP(ncol[2], 0.0f, 1.0f);
+ }
+ else if (boneflag & BONE_SELECTED) {
+ ncol[0] = 1.0f - ncol[0];
+ ncol[1] = 1.0f - ncol[1];
+ ncol[2] = 1.0f - ncol[2];
+ CLAMP(ncol[0], 0.0f, 1.0f);
+ CLAMP(ncol[1], 0.0f, 1.0f);
+ CLAMP(ncol[2], 0.0f, 1.0f);
+ }
+
+ glColor4f(ncol[0], ncol[1], ncol[2], 0.8);
+ }
+ else {
+ if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
+ else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
+ else BIF_ThemeColor(TH_BONE_SOLID);
+ }
}
else if(dt==OB_SOLID)
@@ -782,9 +896,35 @@
glLineWidth(4.0);
if(armflag & ARM_POSEMODE) {
/* outline in black or selection color */
- if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
- else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
- else BIF_ThemeColor(TH_WIRE);
+ if ((armflag & ARM_DRAWCCOLOR) && (pchan)) {
+ float ncol[3];
+
+ VECCOPY(ncol, pchan->custom_colour);
+
+ if (boneflag & BONE_ACTIVE) {
+ ncol[0] = 1.16f - ncol[0];
+ ncol[1] = 1.16f - ncol[1];
+ ncol[2] = 1.16f - ncol[2];
+ CLAMP(ncol[0], 0.0f, 1.0f);
+ CLAMP(ncol[1], 0.0f, 1.0f);
+ CLAMP(ncol[2], 0.0f, 1.0f);
+ }
+ else if (boneflag & BONE_SELECTED) {
+ ncol[0] = 1.0f - ncol[0];
+ ncol[1] = 1.0f - ncol[1];
+ ncol[2] = 1.0f - ncol[2];
+ CLAMP(ncol[0], 0.0f, 1.0f);
+ CLAMP(ncol[1], 0.0f, 1.0f);
+ CLAMP(ncol[2], 0.0f, 1.0f);
+ }
+
+ glColor3f(ncol[0], ncol[1], ncol[2]);
+ }
+ else {
+ if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
+ else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
+ else BIF_ThemeColor(TH_WIRE);
+ }
}
else if (armflag & ARM_EDITMODE) {
BIF_ThemeColor(TH_WIRE);
@@ -829,15 +969,24 @@
glLoadName (id & 0xFFFF); // object tag, for bordersel optim
if(armflag & ARM_POSEMODE) {
- /* inner part in background color or constraint */
- if(constflag) {
- if(constflag & PCHAN_HAS_STRIDE) glColor3ub(0, 0, 200);
- else if(constflag & PCHAN_HAS_TARGET) glColor3ub(255, 150, 0);
- else if(constflag & PCHAN_HAS_IK) glColor3ub(255, 255, 0);
- else if(constflag & PCHAN_HAS_CONST) glColor3ub(0, 255, 120);
- else BIF_ThemeColor(TH_BONE_POSE); // PCHAN_HAS_ACTION
+ /* inner part in custom or default */
+ if ((armflag & ARM_DRAWCCOLOR) && (pchan)) {
+ /* inner part in custom */
+ float ncol[3];
+ VECCOPY(ncol, pchan->custom_colour);
+ glColor3f(ncol[0], ncol[1], ncol[2]);
+ }
+ else {
+ /* inner part in background color or constraint */
+ if(constflag) {
+ if(constflag & PCHAN_HAS_STRIDE) glColor3ub(0, 0, 200);
+ else if(constflag & PCHAN_HAS_TARGET) glColor3ub(255, 150, 0);
+ else if(constflag & PCHAN_HAS_IK) glColor3ub(255, 255, 0);
+ else if(constflag & PCHAN_HAS_CONST) glColor3ub(0, 255, 120);
+ else BIF_ThemeColor(TH_BONE_POSE); // PCHAN_HAS_ACTION
+ }
+ else BIF_ThemeColor(TH_BACK);
}
- else BIF_ThemeColor(TH_BACK);
}
}
@@ -924,19 +1073,48 @@
/* draw points only if... */
if(armflag & ARM_EDITMODE) {
/* move to unitspace */
+ float ecol[3];
+ ecol[0] = ecol[1] = ecol[2] = 0.0f;
+
glPushMatrix();
glScalef(length, length, length);
- draw_bone_points(dt, armflag, boneflag, id);
+ draw_bone_points(dt, armflag, boneflag, id, ecol);
glPopMatrix();
length*= 0.95f; // make vertices visible
}
/* colors for modes */
if (armflag & ARM_POSEMODE) {
- if(dt==OB_WIRE) {
- if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
- else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
- else BIF_ThemeColor(TH_WIRE);
+ if(dt<=OB_WIRE) {
+ if ((armflag & ARM_DRAWCCOLOR) && (pchan)) {
+ float ncol[3];
+
+ VECCOPY(ncol, pchan->custom_colour);
+
+ if (boneflag & BONE_ACTIVE) {
+ ncol[0] = 1.16f - ncol[0];
+ ncol[1] = 1.16f - ncol[1];
+ ncol[2] = 1.16f - ncol[2];
+ CLAMP(ncol[0], 0.0f, 1.0f);
+ CLAMP(ncol[1], 0.0f, 1.0f);
+ CLAMP(ncol[2], 0.0f, 1.0f);
+ }
+ else if (boneflag & BONE_SELECTED) {
+ ncol[0] = 1.0f - ncol[0];
+ ncol[1] = 1.0f - ncol[1];
+ ncol[2] = 1.0f - ncol[2];
+ CLAMP(ncol[0], 0.0f, 1.0f);
+ CLAMP(ncol[1], 0.0f, 1.0f);
+ CLAMP(ncol[2], 0.0f, 1.0f);
+ }
+
+ glColor3f(ncol[0], ncol[1], ncol[2]);
+ }
+ else {
+ if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
+ else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
+ else BIF_ThemeColor(TH_WIRE);
+ }
}
else
BIF_ThemeColor(TH_BONE_SOLID);
@@ -959,9 +1137,29 @@
if(dt > OB_WIRE) {
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_LIGHTING);
- BIF_ThemeColor(TH_BONE_SOLID);
- draw_b_bone_boxes(OB_SOLID, pchan, xwidth, length, zwidth);
+ if ((armflag & ARM_DRAWCCOLOR) && (pchan)) {
+ /* draw custom bone colours */
+ float ncol[3];
+
+ glEnable(GL_BLEND);
+
+ VECCOPY(ncol, pchan->custom_colour);
+ glColor4f(ncol[0], ncol[1], ncol[2], 0.8); // slightly lighter in colour?
+
+ draw_b_bone_boxes(OB_SOLID, pchan, xwidth, length, zwidth);
+ glDisable(GL_BLEND);
+
+ /* restore colors */
+ if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
+ else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
+ else BIF_ThemeColor(TH_WIRE);
+ }
+ else {
+ BIF_ThemeColor(TH_BONE_SOLID);
+
+ draw_b_bone_boxes(OB_SOLID, pchan, xwidth, length, zwidth);
+ }
/* disable solid drawing */
glDisable(GL_COLOR_MATERIAL);
@@ -969,7 +1167,7 @@
}
else { // wire
if (armflag & ARM_POSEMODE){
- if(constflag) {
+ if ((constflag) && (!(armflag & ARM_DRAWCCOLOR))) {
glEnable(GL_BLEND);
if(constflag & PCHAN_HAS_STRIDE) glColor4ub(0, 0, 200, 80);
@@ -993,7 +1191,7 @@
}
}
-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, int constflag, unsigned int id, float length, float custom_colour[3])
{
/* Draw a 3d octahedral bone, we use normalized space based on length,
@@ -1011,16 +1209,47 @@
/* colors for posemode */
if (armflag & ARM_POSEMODE) {
if(dt==OB_WIRE) {
- if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
- else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
- else BIF_ThemeColor(TH_WIRE);
+ if (armflag & ARM_DRAWCCOLOR) {
+ float ncol[3];
+ VECCOPY(ncol, custom_colour);
+ if (boneflag & BONE_ACTIVE) {
+ ncol[0] = 1.16f - ncol[0];
+ ncol[1] = 1.16f - ncol[1];
+ ncol[2] = 1.16f - ncol[2];
+ CLAMP(ncol[0], 0.0f, 1.0f);
+ CLAMP(ncol[1], 0.0f, 1.0f);
+ CLAMP(ncol[2], 0.0f, 1.0f);
+ }
+ else if (boneflag & BONE_SELECTED) {
+ ncol[0] = 1.0f - ncol[0];
+ ncol[1] = 1.0f - ncol[1];
+ ncol[2] = 1.0f - ncol[2];
+ CLAMP(ncol[0], 0.0f, 1.0f);
+ CLAMP(ncol[1], 0.0f, 1.0f);
+ CLAMP(ncol[2], 0.0f, 1.0f);
+ }
+ glColor3f(ncol[0], ncol[1], ncol[2]);
+ }
+ else {
+ if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
+ else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
+ else BIF_ThemeColor(TH_WIRE);
+ }
}
else
BIF_ThemeColor(TH_BONE_SOLID);
}
-
- draw_bone_points(dt, armflag, boneflag, id);
+ if ((armflag & ARM_DRAWCCOLOR)) {
+ float ncol[3];
+ VECCOPY(ncol, custom_colour);
+ draw_bone_points(dt, armflag, boneflag, id, ncol);
+ }
+ else {
+ float ncol[3];
+ ncol[0] = ncol[1] = ncol[2] = 0.0f;
+ draw_bone_points(dt, armflag, boneflag, id, ncol);
+ }
/* now draw the bone itself */
@@ -1036,7 +1265,7 @@
else if (boneflag & BONE_SELECTED) BIF_ThemeColorShade(TH_EDGE_SELECT, -20);
else BIF_ThemeColor(TH_WIRE);
}
- else if (armflag & ARM_POSEMODE){
+ else if (armflag & ARM_POSEMODE) {
if(constflag) {
glEnable(GL_BLEND);
@@ -1058,9 +1287,33 @@
draw_bone_octahedral();
}
else { /* solid */
+ if (armflag & ARM_POSEMODE) {
+ if(armflag & ARM_DRAWCCOLOR) {
+ /* draw custom bone colours */
+ float ncol[3];
+
+ glEnable(GL_BLEND);
+
+ VECCOPY(ncol, custom_colour);
+ glColor4f(ncol[0], ncol[1], ncol[2], 0.8);
+
+ draw_bone_solid_octahedral();
+ glDisable(GL_BLEND);
- BIF_ThemeColor(TH_BONE_SOLID);
- draw_bone_solid_octahedral();
+ /* restore colors */
+ if (boneflag & BONE_ACTIVE) BIF_ThemeColorShade(TH_BONE_POSE, 40);
+ else if (boneflag & BONE_SELECTED) BIF_ThemeColor(TH_BONE_POSE);
+ else BIF_ThemeColor(TH_WIRE);
+ }
+ else {
+ BIF_ThemeColor(TH_BONE_SOLID);
+ draw_bone_solid_octahedral();
+ }
+ }
+ else {
+ BIF_ThemeColor(TH_BONE_SOLID);
+ draw_bone_solid_octahedral();
+ }
}
/* disable solid drawing */
@@ -1378,7 +1631,7 @@
if(bone->parent && (bone->parent->flag & BONE_HIDDEN_P))
flag &= ~BONE_CONNECTED;
- if(pchan->custom)
+ if((pchan->custom) && (arm->flag & ARM_DRAWCSHAPE))
draw_custom_bone(pchan->custom, OB_SOLID, arm->flag, flag, index, bone->length);
else if(arm->drawtype==ARM_LINE)
; /* nothing in solid */
@@ -1387,7 +1640,15 @@
else if(arm->drawtype==ARM_B_BONE)
draw_b_bone(OB_SOLID, arm->flag, flag, 0, index, pchan, NULL);
else {
- draw_bone(OB_SOLID, arm->flag, flag, 0, index, bone->length);
+ if (arm->flag & ARM_DRAWCCOLOR)
+ draw_bone(OB_SOLID, arm->flag, flag, 0, index, bone->length, pchan->custom_colour);
+ else {
+ float tmpColour[3];
+ tmpColour[0] = 0.5; // for now
+ tmpColour[1] = 0.5; // for now
+ tmpColour[2] = 0.5; // for now
+ draw_bone(OB_SOLID, arm->flag, flag, 0, index, bone->length, tmpColour);
+ }
}
glPopMatrix();
}
@@ -1465,7 +1726,7 @@
if(pchan->flag & POSE_STRIDE)
constflag |= PCHAN_HAS_STRIDE;
- if(pchan->custom) {
+ if((pchan->custom) && (arm->flag & ARM_DRAWCSHAPE)) {
if(dt<OB_SOLID)
draw_custom_bone(pchan->custom, OB_WIRE, arm->flag, flag, index, bone->length);
}
@@ -1478,7 +1739,15 @@
else if(arm->drawtype==ARM_B_BONE)
draw_b_bone(OB_WIRE, arm->flag, flag, constflag, index, pchan, NULL);
else {
- draw_bone(OB_WIRE, arm->flag, flag, constflag, index, bone->length);
+ if (arm->flag & ARM_DRAWCCOLOR)
+ draw_bone(OB_WIRE, arm->flag, flag, 0, index, bone->length, pchan->custom_colour);
+ else {
+ float tmpColour[3];
+ tmpColour[0] = 0.5; // for now
+ tmpColour[1] = 0.5; // for now
+ tmpColour[2] = 0.5; // for now
+ draw_bone(OB_WIRE, arm->flag, flag, 0, index, bone->length, tmpColour);
+ }
}
if(arm->drawtype!=ARM_ENVELOPE)
@@ -1616,7 +1885,9 @@
else if(arm->drawtype==ARM_B_BONE)
draw_b_bone(OB_SOLID, arm->flag, flag, 0, index, NULL, eBone);
else {
- draw_bone(OB_SOLID, arm->flag, flag, 0, index, eBone->length);
+ float tmpColour[3];
+ tmpColour[0] = tmpColour[1] = tmpColour[2] = 0.5f;
+ draw_bone(OB_SOLID, arm->flag, flag, 0, index, eBone->length, tmpColour);
}
glPopMatrix();
@@ -1658,8 +1929,11 @@
draw_line_bone(arm->flag, flag, 0, index, NULL, eBone);
else if(arm->drawtype==ARM_B_BONE)
draw_b_bone(OB_WIRE, arm->flag, flag, 0, index, NULL, eBone);
- else
- draw_bone(OB_WIRE, arm->flag, flag, 0, index, eBone->length);
+ else {
+ float tmpColour[3];
+ tmpColour[0] = tmpColour[1] = tmpColour[2] = 0.5f;
+ draw_bone(OB_WIRE, arm->flag, flag, 0, index, eBone->length, tmpColour);
+ }
glPopMatrix();
}

File Metadata

Mime Type
text/x-diff
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
55/02/042e991e557389179f521a464367

Event Timeline