From fdc441f0c2debfa67209488bbebe1b01502274f2 Mon Sep 17 00:00:00 2001 From: Ryan <73148864+Ryan-000@users.noreply.github.com> Date: Tue, 28 Apr 2026 16:22:08 -0400 Subject: [PATCH] Use correct name in events, and clean all state https://github.com/godotengine/godot/pull/110369 changed the names from itos(index), to custom names however the "animation_node_removed" signal was not updated to reflect that change. Also its safer to clear all the state when removing, rather than just the name. --- scene/animation/animation_blend_space_1d.cpp | 5 +++-- scene/animation/animation_blend_space_1d.h | 6 ++++++ scene/animation/animation_blend_space_2d.cpp | 5 +++-- scene/animation/animation_blend_space_2d.h | 6 ++++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/scene/animation/animation_blend_space_1d.cpp b/scene/animation/animation_blend_space_1d.cpp index 6128ecb7895f..b79f0867a78e 100644 --- a/scene/animation/animation_blend_space_1d.cpp +++ b/scene/animation/animation_blend_space_1d.cpp @@ -247,6 +247,7 @@ void AnimationNodeBlendSpace1D::remove_blend_point(int p_point) { ERR_FAIL_INDEX(p_point, blend_points_used); ERR_FAIL_COND(blend_points[p_point].node.is_null()); + String removed_name = blend_points[p_point].name; _remove_node(blend_points[p_point].node); for (int i = p_point; i < blend_points_used - 1; i++) { @@ -255,10 +256,10 @@ void AnimationNodeBlendSpace1D::remove_blend_point(int p_point) { blend_points_used--; - blend_points[blend_points_used].name = StringName(); + blend_points[blend_points_used].reset(); lengths_dirty = true; - emit_signal(SNAME("animation_node_removed"), get_instance_id(), itos(p_point)); + emit_signal(SNAME("animation_node_removed"), get_instance_id(), removed_name); _tree_changed(); } diff --git a/scene/animation/animation_blend_space_1d.h b/scene/animation/animation_blend_space_1d.h index 8329b753f035..998b8f65bfd1 100644 --- a/scene/animation/animation_blend_space_1d.h +++ b/scene/animation/animation_blend_space_1d.h @@ -58,6 +58,12 @@ class AnimationNodeBlendSpace1D : public AnimationRootNode { StringName name; Ref node; float position = 0.0; + + void reset() { + name = StringName(); + node = Ref(); + position = 0.0; + } }; BlendPoint blend_points[MAX_BLEND_POINTS]; diff --git a/scene/animation/animation_blend_space_2d.cpp b/scene/animation/animation_blend_space_2d.cpp index befe42ad0b1b..a9d44a542610 100644 --- a/scene/animation/animation_blend_space_2d.cpp +++ b/scene/animation/animation_blend_space_2d.cpp @@ -166,6 +166,7 @@ void AnimationNodeBlendSpace2D::remove_blend_point(int p_point) { ERR_FAIL_INDEX(p_point, blend_points_used); ERR_FAIL_COND(blend_points[p_point].node.is_null()); + String removed_name = blend_points[p_point].name; _remove_node(blend_points[p_point].node); for (int i = 0; i < triangles.size(); i++) { @@ -190,10 +191,10 @@ void AnimationNodeBlendSpace2D::remove_blend_point(int p_point) { } blend_points_used--; - blend_points[blend_points_used].name = StringName(); + blend_points[blend_points_used].reset(); lengths_dirty = true; - emit_signal(SNAME("animation_node_removed"), get_instance_id(), itos(p_point)); + emit_signal(SNAME("animation_node_removed"), get_instance_id(), removed_name); _tree_changed(); } diff --git a/scene/animation/animation_blend_space_2d.h b/scene/animation/animation_blend_space_2d.h index f7f9839004cb..593d7edba6f8 100644 --- a/scene/animation/animation_blend_space_2d.h +++ b/scene/animation/animation_blend_space_2d.h @@ -58,6 +58,12 @@ class AnimationNodeBlendSpace2D : public AnimationRootNode { StringName name; Ref node; Vector2 position; + + void reset() { + name = StringName(); + node = Ref(); + position = Vector2(); + } }; BlendPoint blend_points[MAX_BLEND_POINTS];