From 8ecccddf1c380282e6806304dee77b488cb4e65f Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Thu, 4 Jul 2024 08:40:52 +0200 Subject: [PATCH] Fix: Bone wire width not working with curve objects The issue was that the wire width was not passed to the shader when the object was of type curve. This resulted in the bone wire thicker than expected and not responding to the parameter. Pull Request: https://projects.blender.org/blender/blender/pulls/124053 --- source/blender/draw/engines/overlay/overlay_armature.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/blender/draw/engines/overlay/overlay_armature.cc b/source/blender/draw/engines/overlay/overlay_armature.cc index 54474466774..67d3efbda2d 100644 --- a/source/blender/draw/engines/overlay/overlay_armature.cc +++ b/source/blender/draw/engines/overlay/overlay_armature.cc @@ -928,6 +928,7 @@ static void drw_shgroup_custom_bone_curve(const ArmatureDrawContext *ctx, Curve *curve, const float (*bone_mat)[4], const float outline_color[4], + const float wire_width, Object *custom) { using namespace blender::draw; @@ -951,7 +952,8 @@ static void drw_shgroup_custom_bone_curve(const ArmatureDrawContext *ctx, DRWCallBuffer *buf = custom_bone_instance_shgroup(ctx, ctx->custom_wire, loose_edges); OVERLAY_bone_instance_data_set_color_hint(&inst_data, outline_color); - OVERLAY_bone_instance_data_set_color(&inst_data, outline_color); + inst_data.color_a = encode_2f_to_float(outline_color[0], outline_color[1]); + inst_data.color_b = encode_2f_to_float(outline_color[2], wire_width / WIRE_WIDTH_COMPRESSION); DRW_buffer_add_entry_struct(buf, inst_data.mat); } @@ -980,7 +982,7 @@ static void drw_shgroup_bone_custom_solid(const ArmatureDrawContext *ctx, if (ELEM(custom->type, OB_CURVES_LEGACY, OB_FONT, OB_SURF)) { drw_shgroup_custom_bone_curve( - ctx, static_cast(custom->data), bone_mat, outline_color, custom); + ctx, static_cast(custom->data), bone_mat, outline_color, wire_width, custom); } } @@ -999,7 +1001,7 @@ static void drw_shgroup_bone_custom_wire(const ArmatureDrawContext *ctx, if (ELEM(custom->type, OB_CURVES_LEGACY, OB_FONT, OB_SURF)) { drw_shgroup_custom_bone_curve( - ctx, static_cast(custom->data), bone_mat, color, custom); + ctx, static_cast(custom->data), bone_mat, color, wire_width, custom); } }