summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/create_dialog.cpp10
-rw-r--r--editor/create_dialog.h1
-rw-r--r--editor/export_template_manager.cpp16
3 files changed, 20 insertions, 7 deletions
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 520bf480fd..95b4f7e982 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -171,6 +171,9 @@ void CreateDialog::add_type(const String &p_type, HashMap<String, TreeItem *> &p
bool is_search_subsequence = search_box->get_text().is_subsequence_ofi(p_type);
String to_select_type = *to_select ? (*to_select)->get_text(0) : "";
bool current_item_is_preffered = ClassDB::is_parent_class(p_type, preferred_search_result_type) && !ClassDB::is_parent_class(to_select_type, preferred_search_result_type);
+ if (*to_select && p_type.length() < (*to_select)->get_text(0).length()) {
+ current_item_is_preffered = true;
+ }
if (((!*to_select || current_item_is_preffered) && is_search_subsequence) || search_box->get_text() == p_type) {
*to_select = item;
@@ -211,9 +214,6 @@ void CreateDialog::_update_search() {
_parse_fs(EditorFileSystem::get_singleton()->get_filesystem());
*/
- List<StringName> type_list;
- ClassDB::get_class_list(&type_list);
-
HashMap<String, TreeItem *> types;
TreeItem *root = search_options->create_item();
@@ -293,6 +293,7 @@ void CreateDialog::_update_search() {
if (to_select) {
to_select->select(0);
+ search_options->scroll_to_item(to_select);
favorite->set_disabled(false);
favorite->set_pressed(favorite_list.find(to_select->get_text(0)) != -1);
}
@@ -615,6 +616,9 @@ void CreateDialog::_bind_methods() {
CreateDialog::CreateDialog() {
+ ClassDB::get_class_list(&type_list);
+ type_list.sort_custom<StringName::AlphCompare>();
+
set_resizable(true);
HSplitContainer *hbc = memnew(HSplitContainer);
diff --git a/editor/create_dialog.h b/editor/create_dialog.h
index 2e4ce9b277..157c126c66 100644
--- a/editor/create_dialog.h
+++ b/editor/create_dialog.h
@@ -55,6 +55,7 @@ class CreateDialog : public ConfirmationDialog {
String base_type;
String preferred_search_result_type;
EditorHelpBit *help_bit;
+ List<StringName> type_list;
void _item_selected();
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp
index 164d02c580..8641fc7667 100644
--- a/editor/export_template_manager.cpp
+++ b/editor/export_template_manager.cpp
@@ -127,7 +127,7 @@ void ExportTemplateManager::_download_template(const String &p_version) {
template_list_state->set_text(TTR("Retrieving mirrors, please wait.."));
template_download_progress->set_max(100);
template_download_progress->set_value(0);
- request_mirror->request("https://www.godotengine.org/download_mirrors.php?version=" + p_version);
+ request_mirror->request("https://godotengine.org/mirrorlist/" + p_version + ".json");
template_list_state->show();
template_download_progress->show();
}
@@ -319,8 +319,16 @@ void ExportTemplateManager::ok_pressed() {
void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data) {
- print_line("mirror complete");
- String mirror_str = "{ \"mirrors\":[{\"name\":\"Official\",\"url\":\"http://op.godotengine.org:81/downloads/2.1.4/Godot_v2.1.4-stable_linux_server.64.zip\"}] }";
+ if (p_status != HTTPRequest::RESULT_SUCCESS || p_code != 200) {
+ EditorNode::get_singleton()->show_warning("Error getting the list of mirrors.");
+ return;
+ }
+
+ String mirror_str;
+ {
+ PoolByteArray::Read r = p_data.read();
+ mirror_str.parse_utf8((const char *)r.ptr(), p_data.size());
+ }
template_list_state->hide();
template_download_progress->hide();
@@ -330,7 +338,7 @@ void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_
int errline;
Error err = JSON::parse(mirror_str, r, errs, errline);
if (err != OK) {
- EditorNode::get_singleton()->show_warning("Error parsing JSON with mirror list. Please report this issue!");
+ EditorNode::get_singleton()->show_warning("Error parsing JSON of mirror list. Please report this issue!");
return;
}