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: 2e03ca4a5b

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
This commit is contained in:
Christoph Lendenfeld
2024-07-16 12:59:42 +02:00
committed by Christoph Lendenfeld
parent 471a148666
commit b2cedb891e

View File

@@ -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<Curve *>(custom->data), bone_mat, outline_color, custom);
ctx, static_cast<Curve *>(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<Curve *>(custom->data), bone_mat, color, custom);
ctx, static_cast<Curve *>(custom->data), bone_mat, color, wire_width, custom);
}
}