Index: release/scripts/ui/properties_data_bone.py =================================================================== --- release/scripts/ui/properties_data_bone.py (revision 28295) +++ release/scripts/ui/properties_data_bone.py (working copy) @@ -204,8 +204,9 @@ sub = col.column() sub.active = (not bone.parent or not bone.connected) sub.prop(bone, "local_location", text="Local Location") + + sub.prop(bone, "wireframe_color", text="Wireframe Color") - class BONE_PT_display(BoneButtonsPanel): bl_label = "Display" Index: release/scripts/ui/properties_object.py =================================================================== --- release/scripts/ui/properties_object.py (revision 28295) +++ release/scripts/ui/properties_object.py (working copy) @@ -200,6 +200,12 @@ split = layout.split() col = split.column() + + col.prop(ob, "wireframe_color", text="Wireframe Color") + + split = layout.split() + col = split.column() + col.prop(ob, "max_draw_type", text="Type") if wide_ui: Index: source/blender/editors/armature/editarmature.c =================================================================== --- source/blender/editors/armature/editarmature.c (revision 28295) +++ source/blender/editors/armature/editarmature.c (working copy) @@ -87,6 +87,17 @@ #include "reeb.h" #endif +static float bone_colors[] = +{ + 0.26f, 0.97f, 0.32f, + 0.97f, 0.14f, 0.15f, + 0.20f, 0.21f, 0.97f, + 0.97f, 0.97f, 0.20f, + 0.20f, 0.97f, 0.97f, + 0.97f, 0.20f, 0.97f, +}; +#define MAX_BONE_COLORS 6 + /* ************* XXX *************** */ static int okee() {return 0;} static void BIF_undo_push(const char *msg) {} @@ -217,6 +228,11 @@ eBone->segments = curBone->segments; eBone->layer = curBone->layer; + eBone->wirc[0] = curBone->wirc[0]; + eBone->wirc[1] = curBone->wirc[1]; + eBone->wirc[2] = curBone->wirc[2]; + eBone->wirc[3] = curBone->wirc[3]; + if(curBone->prop) eBone->prop= IDP_CopyProperty(curBone->prop); @@ -340,7 +356,12 @@ newBone->rad_tail= eBone->rad_tail; newBone->segments= eBone->segments; newBone->layer = eBone->layer; - + + newBone->wirc[0] = eBone->wirc[0]; + newBone->wirc[1] = eBone->wirc[1]; + newBone->wirc[2] = eBone->wirc[2]; + newBone->wirc[3] = eBone->wirc[3]; + if(eBone->prop) newBone->prop= IDP_CopyProperty(eBone->prop); } @@ -2315,6 +2336,8 @@ /* default bone add, returns it selected, but without tail set */ EditBone *ED_armature_edit_bone_add(bArmature *arm, char *name) { + int cindex; + EditBone *bone= MEM_callocN(sizeof(EditBone), "eBone"); BLI_strncpy(bone->name, name, 32); @@ -2334,6 +2357,13 @@ bone->segments= 1; bone->layer= arm->layer; + srand ( time(NULL) ); + cindex = rand() % MAX_BONE_COLORS; + bone->wirc[0] = bone_colors[ ( cindex * 3 ) ]; + bone->wirc[1] = bone_colors[ ( cindex * 3 ) + 1 ]; + bone->wirc[2] = bone_colors[ ( cindex * 3 ) + 2 ]; + bone->wirc[3] = 1.0f; + return bone; } @@ -2343,6 +2373,7 @@ Object *obedit= scene->obedit; // XXX get from context float obmat[3][3], curs[3], viewmat[3][3], totmat[3][3], imat[3][3]; EditBone *bone; + int cindex; VECCOPY(curs, give_cursor(scene, v3d)); @@ -2363,6 +2394,13 @@ /* Create a bone */ bone= ED_armature_edit_bone_add(obedit->data, "Bone"); + srand ( time(NULL) ); + cindex = rand() % MAX_BONE_COLORS; + bone->wirc[0] = bone_colors[ ( cindex * 3 ) ]; + bone->wirc[1] = bone_colors[ ( cindex * 3 ) + 1 ]; + bone->wirc[2] = bone_colors[ ( cindex * 3 ) + 2 ]; + bone->wirc[3] = 1.0f; + VECCOPY(bone->head, curs); if (rv3d && (U.flag & USER_ADD_VIEWALIGNED)) @@ -3334,6 +3372,7 @@ EditBone *newbone, *ebone, *flipbone, *first=NULL; int a, totbone= 0, do_extrude; int forked = RNA_boolean_get(op->ptr, "forked"); + int cindex; obedit= CTX_data_edit_object(C); arm= obedit->data; @@ -3390,6 +3429,13 @@ totbone++; newbone = MEM_callocN(sizeof(EditBone), "extrudebone"); + srand ( time(NULL) ); + cindex = rand() % MAX_BONE_COLORS; + newbone->wirc[0] = bone_colors[ ( cindex * 3 ) ]; + newbone->wirc[1] = bone_colors[ ( cindex * 3 ) + 1 ]; + newbone->wirc[2] = bone_colors[ ( cindex * 3 ) + 2 ]; + newbone->wirc[3] = 1.0f; + if (do_extrude==1) { VECCOPY (newbone->head, ebone->tail); VECCOPY (newbone->tail, newbone->head); Index: source/blender/editors/include/ED_armature.h =================================================================== --- source/blender/editors/include/ED_armature.h (revision 28295) +++ source/blender/editors/include/ED_armature.h (working copy) @@ -76,6 +76,9 @@ float oldlength; /* for envelope scaling */ short segments; + + float wirc[4]; // wireframe color + } EditBone; #define BONESEL_ROOT 0x10000000 Index: source/blender/editors/space_view3d/drawarmature.c =================================================================== --- source/blender/editors/space_view3d/drawarmature.c (revision 28295) +++ source/blender/editors/space_view3d/drawarmature.c (working copy) @@ -1189,7 +1189,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, EditBone *ebone) { /* Draw a 3d octahedral bone, we use normalized space based on length, @@ -1226,7 +1226,12 @@ if (armflag & ARM_EDITMODE) { if (boneflag & BONE_DRAW_ACTIVE) UI_ThemeColor(TH_EDGE_SELECT); else if (boneflag & BONE_SELECTED) UI_ThemeColorShade(TH_EDGE_SELECT, -20); - else UI_ThemeColor(TH_WIRE); + else { + if ( ebone ) + glColor3f( ebone->wirc[0], ebone->wirc[1], ebone->wirc[2] ); + else + UI_ThemeColor(TH_WIRE); + } } else if (armflag & ARM_POSEMODE) { if (constflag) { @@ -1250,7 +1255,12 @@ if (armflag & ARM_POSEMODE) set_pchan_glColor(PCHAN_COLOR_SOLID, armflag, boneflag, constflag); else - UI_ThemeColor(TH_BONE_SOLID); + { + if ( ebone ) + glColor3f( ebone->wirc[0], ebone->wirc[1], ebone->wirc[2] ); + else + UI_ThemeColor(TH_BONE_SOLID); + } draw_bone_solid_octahedral(); } @@ -1648,7 +1658,7 @@ 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); + draw_bone(OB_SOLID, arm->flag, flag, 0, index, bone->length, NULL); glPopMatrix(); } @@ -1832,7 +1842,7 @@ 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); + draw_bone(OB_WIRE, arm->flag, flag, constflag, index, bone->length, NULL); glPopMatrix(); } @@ -1980,7 +1990,7 @@ 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); + draw_bone(OB_SOLID, arm->flag, flag, 0, index, eBone->length, eBone); } glPopMatrix(); @@ -2028,7 +2038,7 @@ 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); + draw_bone(OB_WIRE, arm->flag, flag, 0, index, eBone->length, eBone); glPopMatrix(); } Index: source/blender/editors/space_view3d/drawobject.c =================================================================== --- source/blender/editors/space_view3d/drawobject.c (revision 28295) +++ source/blender/editors/space_view3d/drawobject.c (working copy) @@ -119,6 +119,12 @@ static void draw_empty_sphere(float size); static void draw_empty_cone(float size); +static char is_color_modified( Object *ob ) +{ + if ( ob->wirc[0] == 0.0f && ob->wirc[1] == 0.0f && ob->wirc[2] == 0.0f ) + return 0; + return 1; +} /* ************* only use while object drawing ************** * or after running ED_view3d_init_mats_rv3d @@ -2668,8 +2674,12 @@ else { if(ob->dtx & OB_DRAWWIRE && flag==DRAW_CONSTCOLOR) glColor3ub(80,80,80); - else - UI_ThemeColor(TH_WIRE); + else { + if ( is_color_modified( ob ) ) + glColor3f( ob->wirc[0], ob->wirc[1], ob->wirc[2] ); + else + UI_ThemeColor(TH_WIRE); + } } } } @@ -5357,10 +5367,14 @@ static void drawWireExtra(Scene *scene, RegionView3D *rv3d, Object *ob) { + char notselected = 0; + if(ob!=scene->obedit && (ob->flag & SELECT)) { if(ob==OBACT) { - if(ob->flag & OB_FROMGROUP) UI_ThemeColor(TH_GROUP_ACTIVE); - else UI_ThemeColor(TH_ACTIVE); + if(ob->flag & OB_FROMGROUP) + UI_ThemeColor(TH_GROUP_ACTIVE); + else + UI_ThemeColor(TH_ACTIVE); } else if(ob->flag & OB_FROMGROUP) UI_ThemeColorShade(TH_GROUP_ACTIVE, -16); @@ -5371,10 +5385,14 @@ if(ob->flag & OB_FROMGROUP) UI_ThemeColor(TH_GROUP); else { - if(ob->dtx & OB_DRAWWIRE) { - glColor3ub(80,80,80); - } else { - UI_ThemeColor(TH_WIRE); + if ( is_color_modified( ob ) ) + glColor3f( ob->wirc[0], ob->wirc[1], ob->wirc[2] ); + else { + if(ob->dtx & OB_DRAWWIRE) { + glColor3ub(80,80,80); + } else { + UI_ThemeColor(TH_WIRE); + } } } } @@ -5620,8 +5638,14 @@ if( (!scene->obedit) && (G.moving & G_TRANSFORM_OBJ) && (base->flag & (SELECT+BA_WAS_SEL))) UI_ThemeColor(TH_TRANSFORM); else { - if(ob->type==OB_LAMP) UI_ThemeColor(TH_LAMP); - else UI_ThemeColor(TH_WIRE); + if(ob->type==OB_LAMP) + UI_ThemeColor(TH_LAMP); + else { + if ( is_color_modified( ob ) ) + glColor3f( ob->wirc[0], ob->wirc[1], ob->wirc[2] ); + else + UI_ThemeColor(TH_WIRE); + } if((scene->basact)==base) { if(base->flag & (SELECT+BA_WAS_SEL)) UI_ThemeColor(TH_ACTIVE); @@ -5718,6 +5742,16 @@ } } + // this code ends up setting the wireframe color of a non selected object + // since most everything gets overridden by specific traits + // this seemed to give me a desirable result + if ( ( is_color_modified( ob ) && ( scene->basact ) != base ) && ( !base->flag & (SELECT+BA_WAS_SEL) ) ) + { + // make sure color state is returned to normal after object draw + glPushAttrib( GL_CURRENT_BIT ); + glColor3f( ob->wirc[0], ob->wirc[1], ob->wirc[2] ); + } + switch( ob->type) { case OB_MESH: empty_object= draw_mesh_object(scene, ar, v3d, rv3d, base, dt, flag); @@ -5872,8 +5906,12 @@ if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) { drawaxes(rv3d, rv3d->viewmatob, 1.0, flag, OB_ARROWS); } - } + } + // put color back to previous + if ( is_color_modified( ob ) ) + glPushAttrib( GL_CURRENT_BIT ); + if((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { if(ob->soft /*&& flag & OB_SBMOTION*/){ Index: source/blender/makesdna/DNA_armature_types.h =================================================================== --- source/blender/makesdna/DNA_armature_types.h (revision 28295) +++ source/blender/makesdna/DNA_armature_types.h (working copy) @@ -69,6 +69,8 @@ int layer; /* layers that bone appears on */ short segments; /* for B-bones */ short pad[3]; + + float wirc[4]; } Bone; typedef struct bArmature { Index: source/blender/makesdna/DNA_object_types.h =================================================================== --- source/blender/makesdna/DNA_object_types.h (revision 28295) +++ source/blender/makesdna/DNA_object_types.h (working copy) @@ -251,6 +251,8 @@ ListBase gpulamp; /* runtime, for lamps only */ ListBase pc_ids; ListBase *duplilist; /* for temporary dupli list storage, only for use by RNA API */ + + float wirc[4]; /* wireframe color AKJ */ } Object; /* Warning, this is not used anymore because hooks are now modifiers */ Index: source/blender/makesrna/intern/rna_armature.c =================================================================== --- source/blender/makesrna/intern/rna_armature.c (revision 28295) +++ source/blender/makesrna/intern/rna_armature.c (working copy) @@ -392,6 +392,12 @@ else RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Bone_name_set"); RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); + prop= RNA_def_property(srna, "wireframe_color", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "wirc"); + RNA_def_property_array(prop, 4); + RNA_def_property_ui_text(prop, "Wireframe Color", "Object wireframe color"); + RNA_def_property_update(prop, 0, "rna_Armature_redraw_data"); + /* flags */ prop= RNA_def_property(srna, "layer", PROP_BOOLEAN, PROP_LAYER_MEMBER); RNA_def_property_boolean_sdna(prop, NULL, "layer", 1); Index: source/blender/makesrna/intern/rna_object.c =================================================================== --- source/blender/makesrna/intern/rna_object.c (revision 28295) +++ source/blender/makesrna/intern/rna_object.c (working copy) @@ -1498,7 +1498,12 @@ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Object_parent_bone_set"); RNA_def_property_ui_text(prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation"); RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, "rna_Object_dependency_update"); - + + prop= RNA_def_property(srna, "wireframe_color", PROP_FLOAT, PROP_COLOR); + RNA_def_property_float_sdna(prop, NULL, "wirc"); + RNA_def_property_ui_text(prop, "Wireframe Color", "Object wireframe color"); + RNA_def_property_update(prop, NC_OBJECT|ND_DRAW, NULL); + /* Track and Up flags */ // XXX: these have been saved here for a bit longer (after old track was removed), since some other tools still refer to this prop= RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);