diff --git a/scene/animation/animation_blend_space_1d.cpp b/scene/animation/animation_blend_space_1d.cpp index 6128ecb7895f..8d3370fe2421 100644 --- a/scene/animation/animation_blend_space_1d.cpp +++ b/scene/animation/animation_blend_space_1d.cpp @@ -166,6 +166,8 @@ void AnimationNodeBlendSpace1D::add_blend_point(const Ref &p_ #else ERR_FAIL_COND(p_name == StringName()); #endif + ERR_FAIL_COND(p_name.is_empty() || String(p_name).contains_char('.') || String(p_name).contains_char('/')); + ERR_FAIL_COND_MSG(find_blend_point_by_name(p_name) != -1, "Blend point name must be unique."); if (p_at_index == -1 || p_at_index == blend_points_used) { p_at_index = blend_points_used; } else { @@ -220,6 +222,8 @@ void AnimationNodeBlendSpace1D::set_blend_point_name(int p_point, const StringNa ERR_FAIL_INDEX(p_point, blend_points_used); String new_name = p_name; ERR_FAIL_COND(new_name.is_empty() || new_name.contains_char('.') || new_name.contains_char('/')); + int existing_index = find_blend_point_by_name(p_name); + ERR_FAIL_COND_MSG(existing_index != -1 && existing_index != p_point, "Blend point name must be unique."); String old_name = blend_points[p_point].name; if (new_name != old_name) { diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp index befe42ad0b1b..9f79d5a4c153 100644 --- a/scene/animation/animation_blend_space_2d.cpp +++ b/scene/animation/animation_blend_space_2d.cpp @@ -78,6 +78,8 @@ void AnimationNodeBlendSpace2D::add_blend_point(const Ref &p_ ERR_FAIL_COND(p_name == StringName()); #endif + ERR_FAIL_COND(p_name.is_empty() || String(p_name).contains_char('.') || String(p_name).contains_char('/')); + ERR_FAIL_COND_MSG(find_blend_point_by_name(p_name) != -1, "Blend point name must be unique."); if (p_at_index == -1 || p_at_index == blend_points_used) { p_at_index = blend_points_used; } else { @@ -139,6 +141,8 @@ void AnimationNodeBlendSpace2D::set_blend_point_name(int p_point, const StringNa ERR_FAIL_INDEX(p_point, blend_points_used); String new_name = p_name; ERR_FAIL_COND(new_name.is_empty() || new_name.contains_char('.') || new_name.contains_char('/')); + int existing_index = find_blend_point_by_name(p_name); + ERR_FAIL_COND_MSG(existing_index != -1 && existing_index != p_point, "Blend point name must be unique."); String old_name = blend_points[p_point].name; if (new_name != old_name) {