1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

-Fix blend tree rename, closes #20210

-Fixed activity lines in blend tree
This commit is contained in:
Juan Linietsky
2018-08-23 16:44:10 -03:00
parent adc0188d9f
commit bffaa835fc
5 changed files with 79 additions and 16 deletions

View File

@@ -650,8 +650,9 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) {
blend_tree->get_node_connections(&conns);
for (List<AnimationNodeBlendTree::NodeConnection>::Element *E = conns.front(); E; E = E->next()) {
float activity = 0;
StringName path = AnimationTreeEditor::get_singleton()->get_base_path() + E->get().input_node;
if (AnimationTreeEditor::get_singleton()->get_tree() && !AnimationTreeEditor::get_singleton()->get_tree()->is_state_invalid()) {
activity = blend_tree->get_connection_activity(E->get().input_node, E->get().input_index);
activity = AnimationTreeEditor::get_singleton()->get_tree()->get_connection_activity(path, E->get().input_index);
}
graph->set_connection_activity(E->get().output_node, 0, E->get().input_node, E->get().input_index, activity);
}
@@ -777,6 +778,30 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
visible_properties[i]->set_object_and_property(visible_properties[i]->get_edited_object(), new_name);
}
}
//recreate connections
graph->clear_connections();
List<AnimationNodeBlendTree::NodeConnection> connections;
blend_tree->get_node_connections(&connections);
for (List<AnimationNodeBlendTree::NodeConnection>::Element *E = connections.front(); E; E = E->next()) {
StringName from = E->get().output_node;
StringName to = E->get().input_node;
int to_idx = E->get().input_index;
graph->connect_node(from, 0, to, to_idx);
}
//update animations
for (Map<StringName, ProgressBar *>::Element *E = animations.front(); E; E = E->next()) {
if (E->key() == prev_name) {
animations[new_name] = animations[prev_name];
animations.erase(prev_name);
break;
}
}
}
void AnimationNodeBlendTreeEditor::_node_renamed_focus_out(Node *le, Ref<AnimationNode> p_node) {