diff --git a/scene/animation/animation_blend_space_1d.cpp b/scene/animation/animation_blend_space_1d.cpp index 6128ecb789..b79f0867a7 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 8329b753f0..998b8f65bf 100644 --- a/scene/animation/animation_blend_space_1d.h +++ b/scene/animation/animation_blend_space_1d.h @@ -58,6 +58,12 @@ protected: 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 befe42ad0b..a9d44a5426 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 f7f9839004..593d7edba6 100644 --- a/scene/animation/animation_blend_space_2d.h +++ b/scene/animation/animation_blend_space_2d.h @@ -58,6 +58,12 @@ protected: StringName name; Ref node; Vector2 position; + + void reset() { + name = StringName(); + node = Ref(); + position = Vector2(); + } }; BlendPoint blend_points[MAX_BLEND_POINTS];