From f20cd49c30834401e438dbd0675b6d41ab4d25c5 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 30 Oct 2019 03:18:48 +1100 Subject: Fix bones without parents missing head vertex When the connected was enabled for a parentless bone the head vertex wasn't displayed and couldn't be selected. --- source/blender/draw/intern/draw_armature.c | 44 ++++++++++++++++-------------- 1 file changed, 24 insertions(+), 20 deletions(-) (limited to 'source/blender/draw/intern/draw_armature.c') diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c index 5cd6a4a1286..e16dfb5004b 100644 --- a/source/blender/draw/intern/draw_armature.c +++ b/source/blender/draw/intern/draw_armature.c @@ -1350,7 +1350,8 @@ static void draw_points(const EditBone *eBone, bone_hint_color_shade(col_hint_tail, (g_theme.const_color) ? col_solid_tail : col_wire_tail); /* Draw root point if we are not connected to our parent */ - if ((BONE_FLAG(eBone, pchan) & BONE_CONNECTED) == 0) { + if (!(eBone ? (eBone->parent && (eBone->flag & BONE_CONNECTED)) : + (pchan->bone->parent && (pchan->bone->flag & BONE_CONNECTED)))) { if (select_id != -1) { DRW_select_load_id(select_id | BONESEL_ROOT); } @@ -1518,29 +1519,32 @@ static void draw_bone_line(EditBone *eBone, const float *col_head = no_display; const float *col_tail = col_bone; - if (eBone) { - if (eBone->flag & BONE_TIPSEL) { - col_tail = g_theme.vertex_select_color; - } - if (boneflag & BONE_SELECTED) { - col_bone = g_theme.edge_select_color; - } - col_wire = g_theme.wire_color; + if (g_theme.const_color != NULL) { + col_wire = no_display; /* actually shrink the display. */ + col_bone = col_head = col_tail = g_theme.const_color; } - - /* Draw root point if we are not connected to our parent */ - if ((BONE_FLAG(eBone, pchan) & BONE_CONNECTED) == 0) { + else { if (eBone) { - col_head = (eBone->flag & BONE_ROOTSEL) ? g_theme.vertex_select_color : col_bone; - } - else if (pchan) { - col_head = col_bone; + if (eBone->flag & BONE_TIPSEL) { + col_tail = g_theme.vertex_select_color; + } + if (boneflag & BONE_SELECTED) { + col_bone = g_theme.edge_select_color; + } + col_wire = g_theme.wire_color; } - } - if (g_theme.const_color != NULL) { - col_wire = no_display; /* actually shrink the display. */ - col_bone = col_head = col_tail = g_theme.const_color; + /* Draw root point if we are not connected to our parent. */ + if (!(eBone ? (eBone->parent && (eBone->flag & BONE_CONNECTED)) : + (pchan->bone->parent && (pchan->bone->flag & BONE_CONNECTED)))) { + + if (eBone) { + col_head = (eBone->flag & BONE_ROOTSEL) ? g_theme.vertex_select_color : col_bone; + } + else { + col_head = col_bone; + } + } } if (select_id == -1) { -- cgit v1.2.3