Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions scene/animation/animation_blend_space_1d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand All @@ -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();
}

Expand Down
6 changes: 6 additions & 0 deletions scene/animation/animation_blend_space_1d.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ class AnimationNodeBlendSpace1D : public AnimationRootNode {
StringName name;
Ref<AnimationRootNode> node;
float position = 0.0;

void reset() {
name = StringName();
node = Ref<AnimationRootNode>();
position = 0.0;
}
};

BlendPoint blend_points[MAX_BLEND_POINTS];
Expand Down
5 changes: 3 additions & 2 deletions scene/animation/animation_blend_space_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand All @@ -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();
}

Expand Down
6 changes: 6 additions & 0 deletions scene/animation/animation_blend_space_2d.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ class AnimationNodeBlendSpace2D : public AnimationRootNode {
StringName name;
Ref<AnimationRootNode> node;
Vector2 position;

void reset() {
name = StringName();
node = Ref<AnimationRootNode>();
position = Vector2();
}
};

BlendPoint blend_points[MAX_BLEND_POINTS];
Expand Down
Loading