== Custom Bone Shape Drawing - 'Wireframe' Option ==

In production rigs, such as those for Peach and Plumiferos, custom bone shapes are often simple wireframe shapes (formed with a single line). These are only visible when the armature's drawtype is Wire, which means that this drawtype must be used for the display of those bones. On the other hand, 'normal' bones must also be drawn as wireframes.

I've added a small toggle beside the field for the name of the object to use. This is marked 'W' (this is not great, but it'll have to do for now). 
When activated, that bone's custom bone shape will always draw as a wireframe. As a result, the armature's drawtype doesn't have to be set to 'Wire' to see these bones.
This commit is contained in:
Joshua Leung 2008-01-30 08:10:47 +00:00
parent e7f814b1a3
commit 7d1bc94cad
3 changed files with 19 additions and 11 deletions

@ -155,7 +155,8 @@ typedef enum eBone_Flag {
BONE_UNKEYED = (1<<13), /* set to prevent destruction of its unkeyframed pose (after transform) */
BONE_HINGE_CHILD_TRANSFORM = (1<<14), /* set to prevent hinge child bones from influencing the transform center */
BONE_NO_SCALE = (1<<15), /* No parent scale */
BONE_HIDDEN_PG = (1<<16) /* hidden bone when drawing PoseChannels (for ghost drawing) */
BONE_HIDDEN_PG = (1<<16), /* hidden bone when drawing PoseChannels (for ghost drawing) */
BONE_DRAWWIRE = (1<<17) /* bone should be drawn as OB_WIRE, regardless of draw-types of view+armature */
} eBone_Flag;
#endif

@ -4355,9 +4355,11 @@ static void editing_panel_pose_bones(Object *ob, bArmature *arm)
MEM_freeN(menustr);
ob_arm_bone_pchan_lock(ob, arm, curBone, pchan);
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, REDRAWVIEW3D, "OB:", 220,by,110,19, &pchan->custom, "Object that defines custom draw type for this Bone");
uiDefIDPoinBut(block, test_obpoin_but, ID_OB, REDRAWVIEW3D, "OB:", 220,by,90,19, &pchan->custom, "Object that defines custom draw type for this Bone");
ob_arm_bone_pchan_lock(ob, arm, curBone, NULL);
uiDefButBitI(block, TOG, BONE_DRAWWIRE, B_ARM_RECALCDATA, "W", 309,by,21,19, &curBone->flag, 1.0, 32.0, 0.0, 0.0, "Custom shape of this Bone should always be drawn as a wireframe");
/* Segment, ease in/out buttons */
uiBlockBeginAlign(block);
uiDefButS(block, NUM, B_ARM_RECALCDATA, "Segm: ", -10,by-19,117,19, &curBone->segments, 1.0, 32.0, 0.0, 0.0, "Subdivisions for B-bones");

@ -1521,13 +1521,13 @@ static void draw_pose_channels(Base *base, int dt)
GLfloat tmp;
float smat[4][4], imat[4][4];
int index= -1;
int do_dashed= 1;
int do_dashed= 3;
short flag, constflag;
/* hacky... prevent outline select from drawing dashed helplines */
glGetFloatv(GL_LINE_WIDTH, &tmp);
if (tmp > 1.1) do_dashed= 0;
if (G.vd->flag & V3D_HIDE_HELPLINES) do_dashed= 0;
if (tmp > 1.1) do_dashed &= ~1;
if (G.vd->flag & V3D_HIDE_HELPLINES) do_dashed &= ~2;
/* precalc inverse matrix for drawing screen aligned */
if (arm->drawtype==ARM_ENVELOPE) {
@ -1584,8 +1584,13 @@ static void draw_pose_channels(Base *base, int dt)
/* set color-set to use */
set_pchan_colorset(ob, pchan);
if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM))
draw_custom_bone(pchan->custom, OB_SOLID, arm->flag, flag, index, bone->length);
if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) {
/* BONE_DRAWWIRE case is here too, as sometimes wire overlay won't be done */
if (pchan->bone->flag & BONE_DRAWWIRE)
draw_custom_bone(pchan->custom, OB_WIRE, arm->flag, flag, index, bone->length);
else
draw_custom_bone(pchan->custom, OB_SOLID, arm->flag, flag, index, bone->length);
}
else if (arm->drawtype==ARM_LINE)
; /* nothing in solid */
else if (arm->drawtype==ARM_ENVELOPE)
@ -1674,16 +1679,16 @@ static void draw_pose_channels(Base *base, int dt)
/* extra draw service for pose mode */
constflag= pchan->constflag;
if(pchan->flag & (POSE_ROT|POSE_LOC|POSE_SIZE))
if (pchan->flag & (POSE_ROT|POSE_LOC|POSE_SIZE))
constflag |= PCHAN_HAS_ACTION;
if(pchan->flag & POSE_STRIDE)
if (pchan->flag & POSE_STRIDE)
constflag |= PCHAN_HAS_STRIDE;
/* set color-set to use */
set_pchan_colorset(ob, pchan);
if (pchan->custom && !(arm->flag & ARM_NO_CUSTOM)) {
if (dt < OB_SOLID)
if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) {
if ((dt < OB_SOLID) || (pchan->bone->flag & BONE_DRAWWIRE))
draw_custom_bone(pchan->custom, OB_WIRE, arm->flag, flag, index, bone->length);
}
else if (arm->drawtype==ARM_ENVELOPE) {