Commit: 3fedfb15261a1ae8d5c9920f3d37b83256b36de8 Author: Philipp Oeser Date: Fri Feb 28 13:36:17 2020 +0100 Branches: blender-v2.82-release https://developer.blender.org/rB3fedfb15261a1ae8d5c9920f3d37b83256b36de8
Fix bone envelopes displaying wrong when armature is scaled Object Scale was not taken into account. This lead to reports like T74247 where the user scaled the envelope distance and radii to the supposedly right values inthe viewport, but these were actually 'wrong' under the hood. Assigning weights from bone envelopes seemed like it would fail, but this code would actually take the armature scaling into account when checking envelope distance and weight. ref T74247 Maniphest Tasks: T74247 Differential Revision: https://developer.blender.org/D6964 =================================================================== M source/blender/draw/engines/overlay/overlay_armature.c =================================================================== diff --git a/source/blender/draw/engines/overlay/overlay_armature.c b/source/blender/draw/engines/overlay/overlay_armature.c index f9fd06f2c13..0c690a3b861 100644 --- a/source/blender/draw/engines/overlay/overlay_armature.c +++ b/source/blender/draw/engines/overlay/overlay_armature.c @@ -432,10 +432,11 @@ static void drw_shgroup_bone_envelope_distance(ArmatureDrawContext *ctx, mul_m4_v4(ctx->ob->obmat, tail_sph); mul_m4_v4(ctx->ob->obmat, xaxis); sub_v3_v3(xaxis, head_sph); - head_sph[3] = *radius_head; - head_sph[3] += *distance; - tail_sph[3] = *radius_tail; - tail_sph[3] += *distance; + float obscale = mat4_to_scale(ctx->ob->obmat); + head_sph[3] = *radius_head * obscale; + head_sph[3] += *distance * obscale; + tail_sph[3] = *radius_tail * obscale; + tail_sph[3] += *distance * obscale; DRW_buffer_add_entry(ctx->envelope_distance, head_sph, tail_sph, xaxis); } } @@ -457,8 +458,9 @@ static void drw_shgroup_bone_envelope(ArmatureDrawContext *ctx, mul_m4_v4(ctx->ob->obmat, head_sph); mul_m4_v4(ctx->ob->obmat, tail_sph); mul_m4_v4(ctx->ob->obmat, xaxis); - head_sph[3] = *radius_head; - tail_sph[3] = *radius_tail; + float obscale = mat4_to_scale(ctx->ob->obmat); + head_sph[3] = *radius_head * obscale; + tail_sph[3] = *radius_tail * obscale; if (head_sph[3] < 0.0f || tail_sph[3] < 0.0f) { BoneInstanceData inst_data; _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs