Merge pull request #52131 from nekomatata/fix-blend-tree-reset

Fix AnimationBlendTree reset on resource loading
This commit is contained in:
K. S. Ernest (iFire) Lee 2021-08-26 10:06:09 -07:00 committed by GitHub
commit 98d55ba66f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -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"));
}
@ -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;
@ -1172,5 +1173,9 @@ AnimationNodeBlendTree::AnimationNodeBlendTree() {
nodes["output"] = n;
}
AnimationNodeBlendTree::AnimationNodeBlendTree() {
_initialize_node_tree();
}
AnimationNodeBlendTree::~AnimationNodeBlendTree() {
}

View File

@ -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);