mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 14:11:15 +00:00
Reworked signal connection system, added support for Callable and Signal objects and made them default.
This commit is contained in:
parent
1a4be2cd8f
commit
69c95f4b4c
275 changed files with 3831 additions and 2948 deletions
|
|
@ -112,7 +112,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() {
|
|||
icon = memnew(TextureButton);
|
||||
icon->set_custom_minimum_size(Size2(64, 64) * EDSCALE);
|
||||
icon->set_default_cursor_shape(CURSOR_POINTING_HAND);
|
||||
icon->connect("pressed", this, "_asset_clicked");
|
||||
icon->connect_compat("pressed", this, "_asset_clicked");
|
||||
|
||||
hb->add_child(icon);
|
||||
|
||||
|
|
@ -123,17 +123,17 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() {
|
|||
|
||||
title = memnew(LinkButton);
|
||||
title->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
|
||||
title->connect("pressed", this, "_asset_clicked");
|
||||
title->connect_compat("pressed", this, "_asset_clicked");
|
||||
vb->add_child(title);
|
||||
|
||||
category = memnew(LinkButton);
|
||||
category->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
|
||||
category->connect("pressed", this, "_category_clicked");
|
||||
category->connect_compat("pressed", this, "_category_clicked");
|
||||
vb->add_child(category);
|
||||
|
||||
author = memnew(LinkButton);
|
||||
author->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
|
||||
author->connect("pressed", this, "_author_clicked");
|
||||
author->connect_compat("pressed", this, "_author_clicked");
|
||||
vb->add_child(author);
|
||||
|
||||
price = memnew(Label);
|
||||
|
|
@ -263,7 +263,7 @@ void EditorAssetLibraryItemDescription::add_preview(int p_id, bool p_video, cons
|
|||
preview.button->set_flat(true);
|
||||
preview.button->set_icon(get_icon("ThumbnailWait", "EditorIcons"));
|
||||
preview.button->set_toggle_mode(true);
|
||||
preview.button->connect("pressed", this, "_preview_click", varray(p_id));
|
||||
preview.button->connect_compat("pressed", this, "_preview_click", varray(p_id));
|
||||
preview_hb->add_child(preview.button);
|
||||
if (!p_video) {
|
||||
preview.image = get_icon("ThumbnailWait", "EditorIcons");
|
||||
|
|
@ -290,7 +290,7 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() {
|
|||
description = memnew(RichTextLabel);
|
||||
desc_vbox->add_child(description);
|
||||
description->set_v_size_flags(SIZE_EXPAND_FILL);
|
||||
description->connect("meta_clicked", this, "_link_click");
|
||||
description->connect_compat("meta_clicked", this, "_link_click");
|
||||
description->add_constant_override("line_separation", Math::round(5 * EDSCALE));
|
||||
|
||||
VBoxContainer *previews_vbox = memnew(VBoxContainer);
|
||||
|
|
@ -526,7 +526,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
|
|||
title->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
|
||||
dismiss = memnew(TextureButton);
|
||||
dismiss->connect("pressed", this, "_close");
|
||||
dismiss->connect_compat("pressed", this, "_close");
|
||||
title_hb->add_child(dismiss);
|
||||
|
||||
title->set_clip_text(true);
|
||||
|
|
@ -546,11 +546,11 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
|
|||
install = memnew(Button);
|
||||
install->set_text(TTR("Install..."));
|
||||
install->set_disabled(true);
|
||||
install->connect("pressed", this, "_install");
|
||||
install->connect_compat("pressed", this, "_install");
|
||||
|
||||
retry = memnew(Button);
|
||||
retry->set_text(TTR("Retry"));
|
||||
retry->connect("pressed", this, "_make_request");
|
||||
retry->connect_compat("pressed", this, "_make_request");
|
||||
|
||||
hb2->add_child(retry);
|
||||
hb2->add_child(install);
|
||||
|
|
@ -558,7 +558,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
|
|||
|
||||
download = memnew(HTTPRequest);
|
||||
add_child(download);
|
||||
download->connect("request_completed", this, "_http_download_completed");
|
||||
download->connect_compat("request_completed", this, "_http_download_completed");
|
||||
download->set_use_threads(EDITOR_DEF("asset_library/use_threads", true));
|
||||
|
||||
download_error = memnew(AcceptDialog);
|
||||
|
|
@ -567,7 +567,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
|
|||
|
||||
asset_installer = memnew(EditorAssetInstaller);
|
||||
add_child(asset_installer);
|
||||
asset_installer->connect("confirmed", this, "_close");
|
||||
asset_installer->connect_compat("confirmed", this, "_close");
|
||||
|
||||
prev_status = -1;
|
||||
|
||||
|
|
@ -657,7 +657,7 @@ void EditorAssetLibrary::_install_asset() {
|
|||
|
||||
if (templates_only) {
|
||||
download->set_external_install(true);
|
||||
download->connect("install_asset", this, "_install_external_asset");
|
||||
download->connect_compat("install_asset", this, "_install_external_asset");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -892,7 +892,7 @@ void EditorAssetLibrary::_request_image(ObjectID p_for, String p_image_url, Imag
|
|||
iq.queue_id = ++last_queue_id;
|
||||
iq.active = false;
|
||||
|
||||
iq.request->connect("request_completed", this, "_image_request_completed", varray(iq.queue_id));
|
||||
iq.request->connect_compat("request_completed", this, "_image_request_completed", varray(iq.queue_id));
|
||||
|
||||
image_queue[iq.queue_id] = iq;
|
||||
|
||||
|
|
@ -991,7 +991,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
|
|||
Button *first = memnew(Button);
|
||||
first->set_text(TTR("First"));
|
||||
if (p_page != 0) {
|
||||
first->connect("pressed", this, "_search", varray(0));
|
||||
first->connect_compat("pressed", this, "_search", varray(0));
|
||||
} else {
|
||||
first->set_disabled(true);
|
||||
first->set_focus_mode(Control::FOCUS_NONE);
|
||||
|
|
@ -1001,7 +1001,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
|
|||
Button *prev = memnew(Button);
|
||||
prev->set_text(TTR("Previous"));
|
||||
if (p_page > 0) {
|
||||
prev->connect("pressed", this, "_search", varray(p_page - 1));
|
||||
prev->connect_compat("pressed", this, "_search", varray(p_page - 1));
|
||||
} else {
|
||||
prev->set_disabled(true);
|
||||
prev->set_focus_mode(Control::FOCUS_NONE);
|
||||
|
|
@ -1023,7 +1023,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
|
|||
|
||||
Button *current = memnew(Button);
|
||||
current->set_text(itos(i + 1));
|
||||
current->connect("pressed", this, "_search", varray(i));
|
||||
current->connect_compat("pressed", this, "_search", varray(i));
|
||||
|
||||
hbc->add_child(current);
|
||||
}
|
||||
|
|
@ -1032,7 +1032,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
|
|||
Button *next = memnew(Button);
|
||||
next->set_text(TTR("Next"));
|
||||
if (p_page < p_page_count - 1) {
|
||||
next->connect("pressed", this, "_search", varray(p_page + 1));
|
||||
next->connect_compat("pressed", this, "_search", varray(p_page + 1));
|
||||
} else {
|
||||
next->set_disabled(true);
|
||||
next->set_focus_mode(Control::FOCUS_NONE);
|
||||
|
|
@ -1043,7 +1043,7 @@ HBoxContainer *EditorAssetLibrary::_make_pages(int p_page, int p_page_count, int
|
|||
Button *last = memnew(Button);
|
||||
last->set_text(TTR("Last"));
|
||||
if (p_page != p_page_count - 1) {
|
||||
last->connect("pressed", this, "_search", varray(p_page_count - 1));
|
||||
last->connect_compat("pressed", this, "_search", varray(p_page_count - 1));
|
||||
} else {
|
||||
last->set_disabled(true);
|
||||
last->set_focus_mode(Control::FOCUS_NONE);
|
||||
|
|
@ -1229,9 +1229,9 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
|
|||
EditorAssetLibraryItem *item = memnew(EditorAssetLibraryItem);
|
||||
asset_items->add_child(item);
|
||||
item->configure(r["title"], r["asset_id"], category_map[r["category_id"]], r["category_id"], r["author"], r["author_id"], r["cost"]);
|
||||
item->connect("asset_selected", this, "_select_asset");
|
||||
item->connect("author_selected", this, "_select_author");
|
||||
item->connect("category_selected", this, "_select_category");
|
||||
item->connect_compat("asset_selected", this, "_select_asset");
|
||||
item->connect_compat("author_selected", this, "_select_author");
|
||||
item->connect_compat("category_selected", this, "_select_category");
|
||||
|
||||
if (r.has("icon_url") && r["icon_url"] != "") {
|
||||
_request_image(item->get_instance_id(), r["icon_url"], IMAGE_QUEUE_ICON, 0);
|
||||
|
|
@ -1262,7 +1262,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
|
|||
description = memnew(EditorAssetLibraryItemDescription);
|
||||
add_child(description);
|
||||
description->popup_centered_minsize();
|
||||
description->connect("confirmed", this, "_install_asset");
|
||||
description->connect_compat("confirmed", this, "_install_asset");
|
||||
|
||||
description->configure(r["title"], r["asset_id"], category_map[r["category_id"]], r["category_id"], r["author"], r["author_id"], r["cost"], r["version"], r["version_string"], r["description"], r["download_url"], r["browse_url"], r["download_hash"]);
|
||||
|
||||
|
|
@ -1374,9 +1374,9 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
|
|||
filter = memnew(LineEdit);
|
||||
search_hb->add_child(filter);
|
||||
filter->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
filter->connect("text_entered", this, "_search_text_entered");
|
||||
filter->connect_compat("text_entered", this, "_search_text_entered");
|
||||
search = memnew(Button(TTR("Search")));
|
||||
search->connect("pressed", this, "_search");
|
||||
search->connect_compat("pressed", this, "_search");
|
||||
search_hb->add_child(search);
|
||||
|
||||
if (!p_templates_only)
|
||||
|
|
@ -1385,12 +1385,12 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
|
|||
Button *open_asset = memnew(Button);
|
||||
open_asset->set_text(TTR("Import..."));
|
||||
search_hb->add_child(open_asset);
|
||||
open_asset->connect("pressed", this, "_asset_open");
|
||||
open_asset->connect_compat("pressed", this, "_asset_open");
|
||||
|
||||
Button *plugins = memnew(Button);
|
||||
plugins->set_text(TTR("Plugins..."));
|
||||
search_hb->add_child(plugins);
|
||||
plugins->connect("pressed", this, "_manage_plugins");
|
||||
plugins->connect_compat("pressed", this, "_manage_plugins");
|
||||
|
||||
if (p_templates_only) {
|
||||
open_asset->hide();
|
||||
|
|
@ -1409,7 +1409,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
|
|||
search_hb2->add_child(sort);
|
||||
|
||||
sort->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
sort->connect("item_selected", this, "_rerun_search");
|
||||
sort->connect_compat("item_selected", this, "_rerun_search");
|
||||
|
||||
search_hb2->add_child(memnew(VSeparator));
|
||||
|
||||
|
|
@ -1418,7 +1418,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
|
|||
categories->add_item(TTR("All"));
|
||||
search_hb2->add_child(categories);
|
||||
categories->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
categories->connect("item_selected", this, "_rerun_search");
|
||||
categories->connect_compat("item_selected", this, "_rerun_search");
|
||||
|
||||
search_hb2->add_child(memnew(VSeparator));
|
||||
|
||||
|
|
@ -1430,7 +1430,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
|
|||
repository->add_item("localhost");
|
||||
repository->set_item_metadata(1, "http://127.0.0.1/asset-library/api");
|
||||
|
||||
repository->connect("item_selected", this, "_repository_changed");
|
||||
repository->connect_compat("item_selected", this, "_repository_changed");
|
||||
|
||||
search_hb2->add_child(repository);
|
||||
repository->set_h_size_flags(SIZE_EXPAND_FILL);
|
||||
|
|
@ -1445,7 +1445,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
|
|||
support->get_popup()->add_check_item(TTR("Testing"), SUPPORT_TESTING);
|
||||
support->get_popup()->set_item_checked(SUPPORT_OFFICIAL, true);
|
||||
support->get_popup()->set_item_checked(SUPPORT_COMMUNITY, true);
|
||||
support->get_popup()->connect("id_pressed", this, "_support_toggled");
|
||||
support->get_popup()->connect_compat("id_pressed", this, "_support_toggled");
|
||||
|
||||
/////////
|
||||
|
||||
|
|
@ -1501,7 +1501,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
|
|||
request = memnew(HTTPRequest);
|
||||
add_child(request);
|
||||
request->set_use_threads(EDITOR_DEF("asset_library/use_threads", true));
|
||||
request->connect("request_completed", this, "_http_request_completed");
|
||||
request->connect_compat("request_completed", this, "_http_request_completed");
|
||||
|
||||
last_queue_id = 0;
|
||||
|
||||
|
|
@ -1534,7 +1534,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
|
|||
asset_open->add_filter("*.zip ; " + TTR("Assets ZIP File"));
|
||||
asset_open->set_mode(EditorFileDialog::MODE_OPEN_FILE);
|
||||
add_child(asset_open);
|
||||
asset_open->connect("file_selected", this, "_asset_file_selected");
|
||||
asset_open->connect_compat("file_selected", this, "_asset_file_selected");
|
||||
|
||||
asset_installer = NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue