From b2cedb891e4c71962ce1febe62afdecfa9376b8a Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Tue, 16 Jul 2024 12:59:42 +0200 Subject: [PATCH] Fix #124686: Armature wire width not working with curves This was originally fixed in 8ecccddf1c but for some reason the merge to main didn't include those changes merge commit: 2e03ca4a5b231741cf7cff2fb89b8379470b6654 The issue was that the wire width was not passed to the shader when using curve objects. This PR is just the cherry picked changes from the original commit. Pull Request: https://projects.blender.org/blender/blender/pulls/124774 --- 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); } }