Skip to content

Commit

Permalink
Merge pull request godotengine#52131 from nekomatata/fix-blend-tree-r…
Browse files Browse the repository at this point in the history
…eset

Fix AnimationBlendTree reset on resource loading
  • Loading branch information
fire authored Aug 26, 2021
2 parents 22cae39 + aae50da commit 98d55ba
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scene/animation/animation_blend_tree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1124,6 +1124,7 @@ void AnimationNodeBlendTree::_get_property_list(List<PropertyInfo> *p_list) cons
void AnimationNodeBlendTree::reset_state() {
graph_offset = Vector2();
nodes.clear();
_initialize_node_tree();
emit_changed();
emit_signal(SNAME("tree_changed"));
}
Expand Down Expand Up @@ -1162,7 +1163,7 @@ void AnimationNodeBlendTree::_bind_methods() {
BIND_CONSTANT(CONNECTION_ERROR_CONNECTION_EXISTS);
}

AnimationNodeBlendTree::AnimationNodeBlendTree() {
void AnimationNodeBlendTree::_initialize_node_tree() {
Ref<AnimationNodeOutput> output;
output.instantiate();
Node n;
Expand All @@ -1172,5 +1173,9 @@ AnimationNodeBlendTree::AnimationNodeBlendTree() {
nodes["output"] = n;
}

AnimationNodeBlendTree::AnimationNodeBlendTree() {
_initialize_node_tree();
}

AnimationNodeBlendTree::~AnimationNodeBlendTree() {
}
2 changes: 2 additions & 0 deletions scene/animation/animation_blend_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ class AnimationNodeBlendTree : public AnimationRootNode {
void _tree_changed();
void _node_changed(const StringName &p_node);

void _initialize_node_tree();

protected:
static void _bind_methods();
bool _set(const StringName &p_name, const Variant &p_value);
Expand Down

0 comments on commit 98d55ba

Please sign in to comment.