aboutsummaryrefslogtreecommitdiff
path: root/tools/editor/asset_library_editor_plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/editor/asset_library_editor_plugin.cpp')
-rw-r--r--tools/editor/asset_library_editor_plugin.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/tools/editor/asset_library_editor_plugin.cpp b/tools/editor/asset_library_editor_plugin.cpp
index a2448921d..4f685badf 100644
--- a/tools/editor/asset_library_editor_plugin.cpp
+++ b/tools/editor/asset_library_editor_plugin.cpp
@@ -444,6 +444,13 @@ void EditorAssetLibraryItemDownload::_close() {
void EditorAssetLibraryItemDownload::_install() {
String file = download->get_download_file();
+
+ if (external_install) {
+ emit_signal("install_asset",file,title->get_text());
+ return;
+ }
+
+
asset_installer->open(file,1);
}
@@ -465,6 +472,8 @@ void EditorAssetLibraryItemDownload::_bind_methods() {
ObjectTypeDB::bind_method("_close",&EditorAssetLibraryItemDownload::_close);
ObjectTypeDB::bind_method("_make_request",&EditorAssetLibraryItemDownload::_make_request);
+ ADD_SIGNAL(MethodInfo("install_asset",PropertyInfo(Variant::STRING,"zip_path"),PropertyInfo(Variant::STRING,"name")));
+
}
EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
@@ -530,6 +539,8 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
prev_status=-1;
+ external_install=false;
+
}
@@ -600,7 +611,8 @@ void EditorAssetLibrary::_install_asset() {
EditorAssetLibraryItemDownload *d = downloads_hb->get_child(i)->cast_to<EditorAssetLibraryItemDownload>();
if (d && d->get_asset_id() == description->get_asset_id()) {
- EditorNode::get_singleton()->show_warning("Download for this asset is already in progress!");
+ if (EditorNode::get_singleton() != NULL)
+ EditorNode::get_singleton()->show_warning("Download for this asset is already in progress!");
return;
}
}
@@ -610,6 +622,11 @@ void EditorAssetLibrary::_install_asset() {
downloads_hb->add_child(download);
download->configure(description->get_title(),description->get_asset_id(),description->get_preview_icon(),description->get_download_url(),description->get_sha256());
+ if (templates_only) {
+ download->set_external_install(true);
+ download->connect("install_asset",this,"_install_external_asset");
+ }
+
}
const char* EditorAssetLibrary::sort_key[SORT_MAX]={
@@ -1258,6 +1275,11 @@ void EditorAssetLibrary::_manage_plugins() {
+void EditorAssetLibrary::_install_external_asset(String p_zip_path,String p_title) {
+
+ emit_signal("install_asset",p_zip_path,p_title);
+}
+
void EditorAssetLibrary::_bind_methods() {
ObjectTypeDB::bind_method("_http_request_completed",&EditorAssetLibrary::_http_request_completed);
@@ -1273,6 +1295,11 @@ void EditorAssetLibrary::_bind_methods() {
ObjectTypeDB::bind_method("_repository_changed",&EditorAssetLibrary::_repository_changed);
ObjectTypeDB::bind_method("_support_toggled",&EditorAssetLibrary::_support_toggled);
ObjectTypeDB::bind_method("_rerun_search",&EditorAssetLibrary::_rerun_search);
+ ObjectTypeDB::bind_method("_install_external_asset",&EditorAssetLibrary::_install_external_asset);
+
+
+
+ ADD_SIGNAL(MethodInfo("install_asset",PropertyInfo(Variant::STRING,"zip_path"),PropertyInfo(Variant::STRING,"name")));
}
@@ -1366,7 +1393,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
repository = memnew( OptionButton );
repository->add_item("Godot");
- repository->set_item_metadata(0, "http://godotengine.org/asset-library/api");
+ repository->set_item_metadata(0, "https://godotengine.org/asset-library/api");
repository->add_item("Localhost"); // TODO: Maybe remove?
repository->set_item_metadata(1, "http://127.0.0.1/asset-library/api");
repository->connect("item_selected",this,"_repository_changed");