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
This commit is contained in:
Christoph Lendenfeld
2024-07-04 08:40:52 +02:00
committed by Christoph Lendenfeld
parent 508d08c687
commit 8ecccddf1c

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);
}
}