diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/editor/asset_library_editor_plugin.cpp | 23 | ||||
-rw-r--r-- | tools/editor/asset_library_editor_plugin.h | 5 |
2 files changed, 27 insertions, 1 deletions
diff --git a/tools/editor/asset_library_editor_plugin.cpp b/tools/editor/asset_library_editor_plugin.cpp index de13265e89..e6667b1a81 100644 --- a/tools/editor/asset_library_editor_plugin.cpp +++ b/tools/editor/asset_library_editor_plugin.cpp @@ -628,6 +628,12 @@ const char* EditorAssetLibrary::sort_text[SORT_MAX]={ "Updated" }; +const char* EditorAssetLibrary::support_key[SUPPORT_MAX]={ + "official", + "community", + "testing" +}; + void EditorAssetLibrary::_select_author(int p_id) { @@ -839,11 +845,26 @@ void EditorAssetLibrary::_repository_changed(int p_repository_id) { _api_request("configure", REQUESTING_CONFIG); } +void EditorAssetLibrary::_support_toggled(int p_support) { + print_line(support_key[p_support]); + support->get_popup()->set_item_checked(p_support, !support->get_popup()->is_item_checked(p_support)); +} + void EditorAssetLibrary::_search(int p_page) { String args; args=String()+"?sort="+sort_key[sort->get_selected()]; + + String support_list; + for(int i = 0; i < SUPPORT_MAX; i++) { + if(support->get_popup()->is_item_checked(i)) { + support_list += String(support_key[i]) + "+"; + } + } + if(support_list != String()) { + args += "&support=" + support_list.substr(0, support_list.length() - 1); + } if (categories->get_selected()>0) { @@ -1236,6 +1257,7 @@ void EditorAssetLibrary::_bind_methods() { ObjectTypeDB::bind_method("_asset_open",&EditorAssetLibrary::_asset_open); ObjectTypeDB::bind_method("_asset_file_selected",&EditorAssetLibrary::_asset_file_selected); ObjectTypeDB::bind_method("_repository_changed",&EditorAssetLibrary::_repository_changed); + ObjectTypeDB::bind_method("_support_toggled",&EditorAssetLibrary::_support_toggled); } @@ -1345,6 +1367,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("item_pressed",this,"_support_toggled"); ///////// diff --git a/tools/editor/asset_library_editor_plugin.h b/tools/editor/asset_library_editor_plugin.h index 0f150fb0e6..7f9514019e 100644 --- a/tools/editor/asset_library_editor_plugin.h +++ b/tools/editor/asset_library_editor_plugin.h @@ -213,7 +213,8 @@ class EditorAssetLibrary : public PanelContainer { enum Support { SUPPORT_OFFICIAL, SUPPORT_COMMUNITY, - SUPPORT_TESTING + SUPPORT_TESTING, + SUPPORT_MAX }; enum SortOrder { @@ -228,6 +229,7 @@ class EditorAssetLibrary : public PanelContainer { static const char* sort_key[SORT_MAX]; static const char* sort_text[SORT_MAX]; + static const char* support_key[SUPPORT_MAX]; ///MainListing @@ -296,6 +298,7 @@ class EditorAssetLibrary : public PanelContainer { void _http_download_completed(int p_status, int p_code, const StringArray& headers, const ByteArray& p_data); void _repository_changed(int p_repository_id); + void _support_toggled(int p_support); friend class EditorAssetLibraryItemDescription; friend class EditorAssetLibraryItem; |