diff options
Diffstat (limited to 'tools/editor/asset_library_editor_plugin.cpp')
-rw-r--r-- | tools/editor/asset_library_editor_plugin.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tools/editor/asset_library_editor_plugin.cpp b/tools/editor/asset_library_editor_plugin.cpp index f132e94690..4f685badfb 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; + } @@ -611,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]={ @@ -1259,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); @@ -1274,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"))); } |