From 75f1e93ac04c139862fd4245a10ac4beebc9a7eb Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Wed, 12 Jun 2019 12:24:08 +0200 Subject: [PATCH] Remove some references to unimplemented features in the assetlib This removes rating icons and the associated sorting option as this feature wasn't implemented (and is unlikely to be in the near future). This also renames "Cost" to "License", as the "cost" field refers to SPDX license names on the Godot Asset Library. --- .../plugins/asset_library_editor_plugin.cpp | 31 +++++-------------- editor/plugins/asset_library_editor_plugin.h | 5 ++- 2 files changed, 9 insertions(+), 27 deletions(-) diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index fc5c8dbbb43..0923628b1f9 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -35,7 +35,7 @@ #include "editor_node.h" #include "editor_settings.h" -void EditorAssetLibraryItem::configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, int p_rating, const String &p_cost) { +void EditorAssetLibraryItem::configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, const String &p_cost) { title->set_text(p_title); asset_id = p_asset_id; @@ -44,13 +44,6 @@ void EditorAssetLibraryItem::configure(const String &p_title, int p_asset_id, co author->set_text(p_author); author_id = p_author_id; price->set_text(p_cost); - - for (int i = 0; i < 5; i++) { - if (i < p_rating) - stars[i]->set_texture(get_icon("Favorites", "EditorIcons")); - else - stars[i]->set_texture(get_icon("NonFavorite", "EditorIcons")); - } } void EditorAssetLibraryItem::set_image(int p_type, int p_index, const Ref &p_image) { @@ -68,6 +61,7 @@ void EditorAssetLibraryItem::_notification(int p_what) { icon->set_normal_texture(get_icon("DefaultProjectIcon", "EditorIcons")); category->add_color_override("font_color", Color(0.5, 0.5, 0.5)); author->add_color_override("font_color", Color(0.5, 0.5, 0.5)); + price->add_color_override("font_color", Color(0.5, 0.5, 0.5)); } } @@ -141,13 +135,6 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() { author->connect("pressed", this, "_author_clicked"); vb->add_child(author); - HBoxContainer *rating_hb = memnew(HBoxContainer); - vb->add_child(rating_hb); - - for (int i = 0; i < 5; i++) { - stars[i] = memnew(TextureRect); - rating_hb->add_child(stars[i]); - } price = memnew(Label); price->set_text(TTR("Free")); vb->add_child(price); @@ -248,13 +235,13 @@ void EditorAssetLibraryItemDescription::_preview_click(int p_id) { } } -void EditorAssetLibraryItemDescription::configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, int p_rating, const String &p_cost, int p_version, const String &p_version_string, const String &p_description, const String &p_download_url, const String &p_browse_url, const String &p_sha256_hash) { +void EditorAssetLibraryItemDescription::configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, const String &p_cost, int p_version, const String &p_version_string, const String &p_description, const String &p_download_url, const String &p_browse_url, const String &p_sha256_hash) { asset_id = p_asset_id; title = p_title; download_url = p_download_url; sha256 = p_sha256_hash; - item->configure(p_title, p_asset_id, p_category, p_category_id, p_author, p_author_id, p_rating, p_cost); + item->configure(p_title, p_asset_id, p_category, p_category_id, p_author, p_author_id, p_cost); description->clear(); description->add_text(TTR("Version:") + " " + p_version_string + "\n"); description->add_text(TTR("Contents:") + " "); @@ -666,7 +653,6 @@ void EditorAssetLibrary::_install_asset() { } const char *EditorAssetLibrary::sort_key[SORT_MAX] = { - "rating", "downloads", "name", "cost", @@ -674,10 +660,9 @@ const char *EditorAssetLibrary::sort_key[SORT_MAX] = { }; const char *EditorAssetLibrary::sort_text[SORT_MAX] = { - "Rating", "Downloads", "Name", - "Cost", + "License", // "cost" stores the SPDX license name in the Godot Asset Library "Updated" }; @@ -1212,12 +1197,11 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const ERR_CONTINUE(!r.has("author_id")); ERR_CONTINUE(!r.has("category_id")); ERR_FAIL_COND(!category_map.has(r["category_id"])); - ERR_CONTINUE(!r.has("rating")); ERR_CONTINUE(!r.has("cost")); 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["rating"], r["cost"]); + 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"); @@ -1238,7 +1222,6 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const ERR_FAIL_COND(!r.has("version_string")); ERR_FAIL_COND(!r.has("category_id")); ERR_FAIL_COND(!category_map.has(r["category_id"])); - ERR_FAIL_COND(!r.has("rating")); ERR_FAIL_COND(!r.has("cost")); ERR_FAIL_COND(!r.has("description")); ERR_FAIL_COND(!r.has("download_url")); @@ -1254,7 +1237,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const description->popup_centered_minsize(); description->connect("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["rating"], r["cost"], r["version"], r["version_string"], r["description"], r["download_url"], r["browse_url"], r["download_hash"]); + 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"]); /*item->connect("asset_selected",this,"_select_asset"); item->connect("author_selected",this,"_select_author"); item->connect("category_selected",this,"_category_selected");*/ diff --git a/editor/plugins/asset_library_editor_plugin.h b/editor/plugins/asset_library_editor_plugin.h index dd5f3c2077d..81288ae831e 100644 --- a/editor/plugins/asset_library_editor_plugin.h +++ b/editor/plugins/asset_library_editor_plugin.h @@ -77,7 +77,7 @@ protected: static void _bind_methods(); public: - void configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, int p_rating, const String &p_cost); + void configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, const String &p_cost); EditorAssetLibraryItem(); }; @@ -120,7 +120,7 @@ protected: static void _bind_methods(); public: - void configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, int p_rating, const String &p_cost, int p_version, const String &p_version_string, const String &p_description, const String &p_download_url, const String &p_browse_url, const String &p_sha256_hash); + void configure(const String &p_title, int p_asset_id, const String &p_category, int p_category_id, const String &p_author, int p_author_id, const String &p_cost, int p_version, const String &p_version_string, const String &p_description, const String &p_download_url, const String &p_browse_url, const String &p_sha256_hash); void add_preview(int p_id, bool p_video, const String &p_url); String get_title() { return title; } @@ -216,7 +216,6 @@ class EditorAssetLibrary : public PanelContainer { }; enum SortOrder { - SORT_RATING, SORT_DOWNLOADS, SORT_NAME, SORT_COST,