Armature drawing code refactor #106232

Manually merged
Sybren A. Stüvel merged 3 commits from dr.sybren/blender:anim/armature-drawing-refactor into main 2023-07-21 15:04:10 +02:00
Showing only changes of commit 1617d38b1c - Show all commits

View File

@ -128,9 +128,9 @@ class ArmatureBoneDrawStrategy {
const int select_id) const = 0;
/** Should the relationship line between this bone and its parent be drawn? */
virtual bool use_bone_relation_to_parent(const EditBone *ebone,
const bPoseChannel *pchan,
const int boneflag) const
virtual bool should_draw_relation_to_parent(const EditBone *ebone,
dr.sybren marked this conversation as resolved Outdated

not sure about the function name. "use" is raising the question what it is used for.
The comment explains it but I think calling it e.g. should_draw_relation_to_parent would make it clear within the function name itself

not sure about the function name. "use" is raising the question what it is used for. The comment explains it but I think calling it e.g. `should_draw_relation_to_parent` would make it clear within the function name itself
const bPoseChannel *pchan,
const int boneflag) const
{
if (ebone && ebone->parent) {
/* Always draw for unconnected bones, regardless of selection,
@ -1822,12 +1822,14 @@ static void draw_bone_relations(ArmatureDrawContext *ctx,
const short constflag)
{
if (ebone && ebone->parent) {
if (ctx->do_relations && draw_strategy.use_bone_relation_to_parent(ebone, pchan, boneflag)) {
if (ctx->do_relations && draw_strategy.should_draw_relation_to_parent(ebone, pchan, boneflag))
{
draw_bone_bone_relationship_line(ctx, ebone->head, ebone->parent->head, ebone->parent->tail);
}
}
else if (pchan && pchan->parent) {
if (ctx->do_relations && draw_strategy.use_bone_relation_to_parent(ebone, pchan, boneflag)) {
if (ctx->do_relations && draw_strategy.should_draw_relation_to_parent(ebone, pchan, boneflag))
{
draw_bone_bone_relationship_line(
ctx, pchan->pose_head, pchan->parent->pose_head, pchan->parent->pose_tail);
}