diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-06-07 12:02:48 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-06-07 12:02:48 +0400 |
commit | a921ca86f7a008d818f0f6da930c9d25b971ab64 (patch) | |
tree | 0bd18b6f06fcf7a045defbc6606645d12dee88c8 /source/blender/editors/space_view3d/drawarmature.c | |
parent | c714388473115752f32d0f2a7b722d4ef3bf7d57 (diff) |
fix for error in previous commit.
- dupli-group armatures with pose bone objects set would draw with uninitialized color
- also fix old bug - armature were over-riding the constcolor option - so drawing dupli-groups for eg - would ignore the DRAW_CONSTCOLOR flag.
Diffstat (limited to 'source/blender/editors/space_view3d/drawarmature.c')
-rw-r--r-- | source/blender/editors/space_view3d/drawarmature.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index cb8b309dc72..cf8b84b5a56 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -1658,7 +1658,7 @@ static void bone_matrix_translate_y(float mat[][4], float y) /* assumes object is Armature with pose */ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, int dt, const unsigned char ob_wire_col[4], - const short is_ghost, const short is_outline) + const short do_const_color, const short is_outline) { RegionView3D *rv3d = ar->regiondata; Object *ob = base->object; @@ -1828,10 +1828,10 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, } /* prepare colors */ - if (is_ghost) { + if (do_const_color) { /* 13 October 2009, Disabled this to make ghosting show the right colors (Aligorith) */ } - else if (arm->flag & ARM_POSEMODE) + else if (arm->flag & ARM_POSEMODE) set_pchan_colorset(ob, pchan); else { glColor3ubv(ob_wire_col); @@ -1993,12 +1993,22 @@ static void draw_pose_bones(Scene *scene, View3D *v3d, ARegion *ar, Base *base, /* patch for several 3d cards (IBM mostly) that crash on GL_SELECT with text drawing */ if ((G.f & G_PICKSEL) == 0) { float vec[3]; - + unsigned char col[4]; - col[0] = ob_wire_col[0]; - col[1] = ob_wire_col[1]; - col[2] = ob_wire_col[2]; - col[3] = 255; + + if (do_const_color) { + /* so we can draw bone names in current const color */ + float tcol[4]; + glGetFloatv(GL_CURRENT_COLOR, tcol); + rgb_float_to_uchar(col, tcol); + col[3] = 255; + } + else { + col[0] = ob_wire_col[0]; + col[1] = ob_wire_col[1]; + col[2] = ob_wire_col[2]; + col[3] = 255; + } if (v3d->zbuf) glDisable(GL_DEPTH_TEST); @@ -2602,7 +2612,7 @@ int draw_armature(Scene *scene, View3D *v3d, ARegion *ar, Base *base, } } } - draw_pose_bones(scene, v3d, ar, base, dt, ob_wire_col, FALSE, is_outline); + draw_pose_bones(scene, v3d, ar, base, dt, ob_wire_col, (flag & DRAW_CONSTCOLOR), is_outline); arm->flag &= ~ARM_POSEMODE; if (ob->mode & OB_MODE_POSE) |