From 2a68d9a9a889390828cacda2489d2f8c2009e511 Mon Sep 17 00:00:00 2001 From: Christoph Lendenfeld Date: Tue, 22 Jul 2025 17:38:27 +0200 Subject: [PATCH] Refactor: Remove TODO and use constexpr when converting edit bones No functional changes. This deals with the TODO `/* TODO(sergey): How to ensure this is a constexpr? */` by just making it a `constexpr`. The line in question was `square_f(0.000001f)` so the constexpr is just `0.000001f * 0.000001f` Pull Request: https://projects.blender.org/blender/blender/pulls/142872 --- source/blender/editors/armature/armature_utils.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/armature/armature_utils.cc b/source/blender/editors/armature/armature_utils.cc index 7d15a4e9efb..79c6e8ad3f1 100644 --- a/source/blender/editors/armature/armature_utils.cc +++ b/source/blender/editors/armature/armature_utils.cc @@ -667,11 +667,11 @@ void ED_armature_from_edit(Main *bmain, bArmature *arm) arm->act_bone = nullptr; /* Remove zero sized bones, this gives unstable rest-poses. */ + constexpr float bone_length_threshold = 0.000001f * 0.000001f; for (eBone = static_cast(arm->edbo->first); eBone; eBone = neBone) { float len_sq = len_squared_v3v3(eBone->head, eBone->tail); neBone = eBone->next; - /* TODO(sergey): How to ensure this is a `constexpr`? */ - if (len_sq <= square_f(0.000001f)) { /* FLT_EPSILON is too large? */ + if (len_sq <= bone_length_threshold) { /* FLT_EPSILON is too large? */ /* Find any bones that refer to this bone */ LISTBASE_FOREACH (EditBone *, fBone, arm->edbo) { if (fBone->parent == eBone) {