General fixes for the AnimationTree editor

This commit is contained in:
Michael Alexsander Silva Dias 2018-12-17 21:03:25 -02:00
parent 0cff752be1
commit b86b497cec
7 changed files with 12 additions and 5 deletions

View File

@ -236,6 +236,8 @@
</theme_item>
<theme_item name="close" type="Texture">
</theme_item>
<theme_item name="close_color" type="Color">
</theme_item>
<theme_item name="close_offset" type="int">
</theme_item>
<theme_item name="comment" type="StyleBox">

View File

@ -1180,7 +1180,7 @@ void FileSystemDock::_make_dir_confirm() {
String dir_name = make_dir_dialog_text->get_text().strip_edges();
if (dir_name.length() == 0) {
EditorNode::get_singleton()->show_warning(TTR("No name provided"));
EditorNode::get_singleton()->show_warning(TTR("No name provided."));
return;
} else if (dir_name.find("/") != -1 || dir_name.find("\\") != -1 || dir_name.find(":") != -1 || dir_name.find("*") != -1 ||
dir_name.find("|") != -1 || dir_name.find(">") != -1 || dir_name.ends_with(".") || dir_name.ends_with(" ")) {

View File

@ -72,7 +72,7 @@ void AnimationNodeBlendSpace1DEditor::_blend_space_gui_input(const Ref<InputEven
ap->get_animation_list(&names);
for (List<StringName>::Element *E = names.front(); E; E = E->next()) {
animations_menu->add_icon_item(get_icon("Animation", "Editoricons"), E->get());
animations_menu->add_icon_item(get_icon("Animation", "EditorIcons"), E->get());
animations_to_add.push_back(E->get());
}
}

View File

@ -395,7 +395,7 @@ void AnimationNodeBlendTreeEditor::_delete_request(const String &p_which) {
undo_redo->create_action("Delete Node");
undo_redo->add_do_method(blend_tree.ptr(), "remove_node", p_which);
undo_redo->add_undo_method(blend_tree.ptr(), "add_node", p_which, blend_tree->get_node(p_which));
undo_redo->add_undo_method(blend_tree.ptr(), "add_node", p_which, blend_tree->get_node(p_which), blend_tree.ptr()->get_node_position(p_which));
List<AnimationNodeBlendTree::NodeConnection> conns;
blend_tree->get_node_connections(&conns);
@ -813,6 +813,8 @@ void AnimationNodeBlendTreeEditor::_node_renamed(const String &p_text, Ref<Anima
break;
}
}
_update_graph(); // Needed to update the signal connections with the new name.
}
void AnimationNodeBlendTreeEditor::_node_renamed_focus_out(Node *le, Ref<AnimationNode> p_node) {

View File

@ -1073,7 +1073,9 @@ void AnimationNodeStateMachineEditor::_name_edited(const String &p_text) {
ERR_FAIL_COND(new_name == "" || new_name.find(".") != -1 || new_name.find("/") != -1)
ERR_FAIL_COND(new_name == prev_name);
if (new_name == prev_name) {
return; // Nothing to do.
}
String base_name = new_name;
int base = 1;

View File

@ -668,7 +668,7 @@ void SceneTreeEditor::_renamed() {
// Empty node names are not allowed, so resets it to previous text and show warning
if (which->get_text(0).strip_edges().empty()) {
which->set_text(0, n->get_name());
EditorNode::get_singleton()->show_warning(TTR("No name provided"));
EditorNode::get_singleton()->show_warning(TTR("No name provided."));
return;
}

View File

@ -600,6 +600,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_icon("resizer", "GraphNode", make_icon(window_resizer_png));
theme->set_font("title_font", "GraphNode", default_font);
theme->set_color("title_color", "GraphNode", Color(0, 0, 0, 1));
theme->set_color("close_color", "GraphNode", Color(0, 0, 0, 1));
theme->set_constant("title_offset", "GraphNode", 20 * scale);
theme->set_constant("close_offset", "GraphNode", 18 * scale);
theme->set_constant("port_offset", "GraphNode", 3 * scale);