diff options
Diffstat (limited to 'editor/script_create_dialog.cpp')
-rw-r--r-- | editor/script_create_dialog.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 7d063e13f9..77e0321f83 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -38,6 +38,7 @@ #include "editor/editor_file_dialog.h" #include "editor/editor_file_system.h" #include "editor/editor_node.h" +#include "editor/editor_paths.h" #include "editor/editor_scale.h" #include "editor/editor_settings.h" @@ -384,7 +385,7 @@ void ScriptCreateDialog::_create_new() { } else { String lpath = ProjectSettings::get_singleton()->localize_path(file_path->get_text()); scr->set_path(lpath); - Error err = ResourceSaver::save(lpath, scr, ResourceSaver::FLAG_CHANGE_PATH); + Error err = ResourceSaver::save(scr, lpath, ResourceSaver::FLAG_CHANGE_PATH); if (err != OK) { alert->set_text(TTR("Error - Could not create script in filesystem.")); alert->popup_centered(); @@ -398,7 +399,7 @@ void ScriptCreateDialog::_create_new() { void ScriptCreateDialog::_load_exist() { String path = file_path->get_text(); - RES p_script = ResourceLoader::load(path, "Script"); + Ref<Resource> p_script = ResourceLoader::load(path, "Script"); if (p_script.is_null()) { alert->set_text(vformat(TTR("Error loading script from %s"), path)); alert->popup_centered(); @@ -481,7 +482,7 @@ void ScriptCreateDialog::_browse_path(bool browse_parent, bool p_save) { if (p_save) { file_browse->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE); file_browse->set_title(TTR("Open Script / Choose Location")); - file_browse->get_ok_button()->set_text(TTR("Open")); + file_browse->set_ok_button_text(TTR("Open")); } else { file_browse->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); file_browse->set_title(TTR("Open Script")); @@ -528,7 +529,7 @@ void ScriptCreateDialog::_browse_class_in_tree() { select_class->set_base_type(base_type); select_class->popup_create(true); select_class->set_title(vformat(TTR("Inherit %s"), base_type)); - select_class->get_ok_button()->set_text(TTR("Inherit")); + select_class->set_ok_button_text(TTR("Inherit")); } void ScriptCreateDialog::_path_changed(const String &p_path) { @@ -620,9 +621,9 @@ void ScriptCreateDialog::_update_template_menu() { } else { String template_directory; if (template_location == ScriptLanguage::TEMPLATE_PROJECT) { - template_directory = EditorSettings::get_singleton()->get_project_script_templates_dir(); + template_directory = EditorPaths::get_singleton()->get_project_script_templates_dir(); } else { - template_directory = EditorSettings::get_singleton()->get_script_templates_dir(); + template_directory = EditorPaths::get_singleton()->get_script_templates_dir(); } templates_found = _get_user_templates(language, current_node, template_directory, template_location); } @@ -750,7 +751,7 @@ void ScriptCreateDialog::_update_dialog() { parent_browse_button->set_disabled(!is_new_file || !can_inherit_from_file); template_inactive_message = ""; String button_text = is_new_file ? TTR("Create") : TTR("Load"); - get_ok_button()->set_text(button_text); + set_ok_button_text(button_text); if (is_new_file) { if (is_built_in) { @@ -940,7 +941,7 @@ ScriptCreateDialog::ScriptCreateDialog() { builtin_warning_label->set_text( TTR("Note: Built-in scripts have some limitations and can't be edited using an external editor.")); vb->add_child(builtin_warning_label); - builtin_warning_label->set_autowrap_mode(Label::AUTOWRAP_WORD_SMART); + builtin_warning_label->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART); builtin_warning_label->hide(); script_name_warning_label = memnew(Label); @@ -948,12 +949,12 @@ ScriptCreateDialog::ScriptCreateDialog() { TTR("Warning: Having the script name be the same as a built-in type is usually not desired.")); vb->add_child(script_name_warning_label); script_name_warning_label->add_theme_color_override("font_color", Color(1, 0.85, 0.4)); - script_name_warning_label->set_autowrap_mode(Label::AUTOWRAP_WORD_SMART); + script_name_warning_label->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART); script_name_warning_label->hide(); template_info_label = memnew(Label); vb->add_child(template_info_label); - template_info_label->set_autowrap_mode(Label::AUTOWRAP_WORD_SMART); + template_info_label->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART); status_panel = memnew(PanelContainer); status_panel->set_h_size_flags(Control::SIZE_FILL); @@ -1008,7 +1009,7 @@ ScriptCreateDialog::ScriptCreateDialog() { parent_search_button->connect("pressed", callable_mp(this, &ScriptCreateDialog::_browse_class_in_tree)); hb->add_child(parent_search_button); parent_browse_button = memnew(Button); - parent_browse_button->connect("pressed", callable_mp(this, &ScriptCreateDialog::_browse_path), varray(true, false)); + parent_browse_button->connect("pressed", callable_mp(this, &ScriptCreateDialog::_browse_path).bind(true, false)); hb->add_child(parent_browse_button); gc->add_child(memnew(Label(TTR("Inherits:")))); gc->add_child(hb); @@ -1057,7 +1058,7 @@ ScriptCreateDialog::ScriptCreateDialog() { file_path->set_h_size_flags(Control::SIZE_EXPAND_FILL); hb->add_child(file_path); path_button = memnew(Button); - path_button->connect("pressed", callable_mp(this, &ScriptCreateDialog::_browse_path), varray(false, true)); + path_button->connect("pressed", callable_mp(this, &ScriptCreateDialog::_browse_path).bind(false, true)); hb->add_child(path_button); Label *label = memnew(Label(TTR("Path:"))); gc->add_child(label); @@ -1088,9 +1089,9 @@ ScriptCreateDialog::ScriptCreateDialog() { file_browse->connect("file_selected", callable_mp(this, &ScriptCreateDialog::_file_selected)); file_browse->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE); add_child(file_browse); - get_ok_button()->set_text(TTR("Create")); + set_ok_button_text(TTR("Create")); alert = memnew(AcceptDialog); - alert->get_label()->set_autowrap_mode(Label::AUTOWRAP_WORD_SMART); + alert->get_label()->set_autowrap_mode(TextServer::AUTOWRAP_WORD_SMART); alert->get_label()->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER); alert->get_label()->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER); alert->get_label()->set_custom_minimum_size(Size2(325, 60) * EDSCALE); |