diff --git a/source/blender/editors/armature/armature_naming.cc b/source/blender/editors/armature/armature_naming.cc index 7c4f77944c8..9f4c9c275f4 100644 --- a/source/blender/editors/armature/armature_naming.cc +++ b/source/blender/editors/armature/armature_naming.cc @@ -22,6 +22,7 @@ #include "BLI_blenlib.h" #include "BLI_ghash.h" +#include "BLI_listbase_wrapper.hh" #include "BLI_string_utils.hh" #include "BLI_utildefines.h" @@ -53,7 +54,7 @@ #include "armature_intern.hh" -using blender::Vector; +using namespace blender; /* -------------------------------------------------------------------- */ /** \name Unique Bone Name Utility (Edit Mode) @@ -66,6 +67,18 @@ static bool editbone_unique_check(void *arg, const char *name) ListBase *lb; void *bone; } *data = static_cast(arg); + + if (data->bone) { + /* This indicates that there is a bone to ignore. This means ED_armature_ebone_find_name() + * cannot be used, as it might return the bone we should be ignoring. */ + for (EditBone *ebone : ListBaseWrapper(data->lb)) { + if (STREQ(ebone->name, name) && ebone != data->bone) { + return true; + } + } + return false; + } + EditBone *dupli = ED_armature_ebone_find_name(data->lb, name); return dupli && dupli != data->bone; }