From 3c91fbf6befbc69de45ee1e4bba57fee95b9bb1a Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 4 May 2017 00:16:31 +1000 Subject: Draw Manager: Use color-sets for solid pose-bones --- source/blender/draw/intern/draw_armature.c | 32 ++++++++++++++++++++---------- source/blender/makesdna/DNA_action_types.h | 3 ++- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c index ec44de60645..cff8c0d010f 100644 --- a/source/blender/draw/intern/draw_armature.c +++ b/source/blender/draw/intern/draw_armature.c @@ -212,6 +212,9 @@ static void UNUSED_FUNCTION(DRW_shgroup_bone_relationship_lines)(const float hea /* -------------------------------------------------------------------- */ /** \name Drawing Theme Helpers + * + * Note, this section is duplicate of code in 'drawarmature.c'. + * * \{ */ /* global here is reset before drawing each bone */ @@ -512,7 +515,9 @@ static void update_color(const float const_color[4]) #undef NO_ALPHA } -static const float *get_bone_solid_color(const EditBone *eBone, const bPoseChannel *pchan, const bArmature *arm) +static const float *get_bone_solid_color( + const EditBone *eBone, const bPoseChannel *pchan, const bArmature *arm, + const int boneflag, const short constflag) { if (g_theme.const_color) return g_theme.bone_solid_color; @@ -545,12 +550,18 @@ static const float *get_bone_solid_color(const EditBone *eBone, const bPoseChann UNUSED_VARS(eBone, pchan, arm); #endif + if (arm->flag & ARM_POSEMODE) { + float *disp_color = (float *)pchan->disp_solid_color; + set_pchan_color(PCHAN_COLOR_SOLID, boneflag, constflag, disp_color); + disp_color[3] = 1.0; + return disp_color; + } + return g_theme.bone_solid_color; } static const float *get_bone_wire_color( - const EditBone *eBone, const bPoseChannel *pchan, - const bArmature *arm, + const EditBone *eBone, const bPoseChannel *pchan, const bArmature *arm, const int boneflag, const short constflag) { if (g_theme.const_color) @@ -575,9 +586,10 @@ static const float *get_bone_wire_color( } } else if (arm->flag & ARM_POSEMODE) { - set_pchan_color(PCHAN_COLOR_NORMAL, boneflag, constflag, (float *)pchan->disp_color); - ((float *)pchan->disp_color)[3] = 1.0; - return pchan->disp_color; + float *disp_color = (float *)pchan->disp_wire_color; + set_pchan_color(PCHAN_COLOR_NORMAL, boneflag, constflag, disp_color); + disp_color[3] = 1.0; + return disp_color; #if 0 @@ -845,7 +857,7 @@ static void draw_points( } } else if (arm->flag & ARM_POSEMODE) { - col_solid_root = col_solid_tail = get_bone_solid_color(eBone, pchan, arm); + col_solid_root = col_solid_tail = get_bone_solid_color(eBone, pchan, arm, boneflag, constflag); col_wire_root = col_wire_tail = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag); } @@ -895,7 +907,7 @@ static void draw_bone_custom_shape( const int boneflag, const short constflag, const int select_id) { - const float *col_solid = get_bone_solid_color(eBone, pchan, arm); + const float *col_solid = get_bone_solid_color(eBone, pchan, arm, boneflag, constflag); const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag); const float (*disp_mat)[4] = pchan->custom_tx ? pchan->custom_tx->disp_mat : pchan->disp_mat; @@ -972,7 +984,7 @@ static void draw_bone_box( const int boneflag, const short constflag, const int select_id) { - const float *col_solid = get_bone_solid_color(eBone, pchan, arm); + const float *col_solid = get_bone_solid_color(eBone, pchan, arm, boneflag, constflag); const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag); if (select_id != -1) { @@ -1016,7 +1028,7 @@ static void draw_bone_octahedral( const int boneflag, const short constflag, const int select_id) { - const float *col_solid = get_bone_solid_color(eBone, pchan, arm); + const float *col_solid = get_bone_solid_color(eBone, pchan, arm, boneflag, constflag); const float *col_wire = get_bone_wire_color(eBone, pchan, arm, boneflag, constflag); if (select_id != -1) { diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index 4a42d178d05..51d6b000739 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -261,7 +261,8 @@ typedef struct bPoseChannel { struct bPoseChannel *bbone_prev; /* next/prev bones to use as handle references when calculating bbones (optional) */ struct bPoseChannel *bbone_next; - float disp_color[4]; /* for display only */ + float disp_solid_color[4]; /* for display only */ + float disp_wire_color[4]; void *temp; /* use for outliner */ void *bbone_matrices; /* Used to cache each bbone's segment matrix. */ -- cgit v1.2.3