Removed the AssetLib.

This commit is contained in:
Relintai 2022-03-16 00:47:29 +01:00
parent a9a83271db
commit 93d29cbc62
6 changed files with 5 additions and 1924 deletions

View File

@ -112,7 +112,6 @@
#include "editor/plugins/animation_state_machine_editor.h"
#include "editor/plugins/animation_tree_editor_plugin.h"
#include "editor/plugins/animation_tree_player_editor_plugin.h"
#include "editor/plugins/asset_library_editor_plugin.h"
#include "editor/plugins/audio_stream_editor_plugin.h"
#include "editor/plugins/camera_editor_plugin.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
@ -400,8 +399,6 @@ void EditorNode::_unhandled_input(const Ref<InputEvent> &p_event) {
_editor_select(EDITOR_SCRIPT);
} else if (ED_IS_SHORTCUT("editor/editor_help", p_event)) {
emit_signal("request_help_search", "");
} else if (ED_IS_SHORTCUT("editor/editor_assetlib", p_event) && StreamPeerSSL::is_available()) {
_editor_select(EDITOR_ASSETLIB);
} else if (ED_IS_SHORTCUT("editor/editor_next", p_event)) {
_editor_select_next();
} else if (ED_IS_SHORTCUT("editor/editor_prev", p_event)) {
@ -5569,12 +5566,9 @@ void EditorNode::_feature_profile_changed() {
main_editor_buttons[EDITOR_3D]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D));
main_editor_buttons[EDITOR_SCRIPT]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT));
if (StreamPeerSSL::is_available()) {
main_editor_buttons[EDITOR_ASSETLIB]->set_visible(!profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB));
}
if ((profile->is_feature_disabled(EditorFeatureProfile::FEATURE_3D) && singleton->main_editor_buttons[EDITOR_3D]->is_pressed()) ||
(profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT) && singleton->main_editor_buttons[EDITOR_SCRIPT]->is_pressed()) ||
(StreamPeerSSL::is_available() && profile->is_feature_disabled(EditorFeatureProfile::FEATURE_ASSET_LIB) && singleton->main_editor_buttons[EDITOR_ASSETLIB]->is_pressed())) {
(profile->is_feature_disabled(EditorFeatureProfile::FEATURE_SCRIPT) && singleton->main_editor_buttons[EDITOR_SCRIPT]->is_pressed())) {
_editor_select(EDITOR_2D);
}
} else {
@ -5586,9 +5580,6 @@ void EditorNode::_feature_profile_changed() {
filesystem_dock->set_visible(true);
main_editor_buttons[EDITOR_3D]->set_visible(true);
main_editor_buttons[EDITOR_SCRIPT]->set_visible(true);
if (StreamPeerSSL::is_available()) {
main_editor_buttons[EDITOR_ASSETLIB]->set_visible(true);
}
}
_update_dock_slots_visibility();
@ -6889,12 +6880,6 @@ EditorNode::EditorNode() {
ScriptTextEditor::register_editor(); //register one for text scripts
TextEditor::register_editor();
if (StreamPeerSSL::is_available()) {
add_editor_plugin(memnew(AssetLibraryEditorPlugin(this)));
} else {
WARN_PRINT("Asset Library not available, as it requires SSL to work.");
}
//add interface before adding plugins
editor_interface = memnew(EditorInterface);
@ -7088,13 +7073,11 @@ EditorNode::EditorNode() {
ED_SHORTCUT("editor/editor_2d", TTR("Open 2D Editor"), KEY_MASK_ALT | KEY_1);
ED_SHORTCUT("editor/editor_3d", TTR("Open 3D Editor"), KEY_MASK_ALT | KEY_2);
ED_SHORTCUT("editor/editor_script", TTR("Open Script Editor"), KEY_MASK_ALT | KEY_3);
ED_SHORTCUT("editor/editor_assetlib", TTR("Open Asset Library"), KEY_MASK_ALT | KEY_4);
#else
// Use the Ctrl modifier so F2 can be used to rename nodes in the scene tree dock.
ED_SHORTCUT("editor/editor_2d", TTR("Open 2D Editor"), KEY_MASK_CTRL | KEY_F1);
ED_SHORTCUT("editor/editor_3d", TTR("Open 3D Editor"), KEY_MASK_CTRL | KEY_F2);
ED_SHORTCUT("editor/editor_script", TTR("Open Script Editor"), KEY_MASK_CTRL | KEY_F3);
ED_SHORTCUT("editor/editor_assetlib", TTR("Open Asset Library"), KEY_MASK_CTRL | KEY_F4);
#endif
ED_SHORTCUT("editor/editor_next", TTR("Open the next Editor"));
ED_SHORTCUT("editor/editor_prev", TTR("Open the previous Editor"));

View File

@ -690,8 +690,7 @@ public:
enum EditorTable {
EDITOR_2D = 0,
EDITOR_3D,
EDITOR_SCRIPT,
EDITOR_ASSETLIB
EDITOR_SCRIPT
};
void set_visible_editor(EditorTable p_table) { _editor_select(p_table); }

File diff suppressed because it is too large Load Diff

View File

@ -1,327 +0,0 @@
/*************************************************************************/
/* asset_library_editor_plugin.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef ASSET_LIBRARY_EDITOR_PLUGIN_H
#define ASSET_LIBRARY_EDITOR_PLUGIN_H
#include "editor/editor_asset_installer.h"
#include "editor/editor_plugin.h"
#include "editor/editor_plugin_settings.h"
#include "scene/gui/box_container.h"
#include "scene/gui/check_box.h"
#include "scene/gui/grid_container.h"
#include "scene/gui/line_edit.h"
#include "scene/gui/link_button.h"
#include "scene/gui/option_button.h"
#include "scene/gui/panel_container.h"
#include "scene/gui/progress_bar.h"
#include "scene/gui/rich_text_label.h"
#include "scene/gui/scroll_container.h"
#include "scene/gui/separator.h"
#include "scene/gui/tab_container.h"
#include "scene/gui/texture_button.h"
#include "scene/main/http_request.h"
class EditorAssetLibraryItem : public PanelContainer {
GDCLASS(EditorAssetLibraryItem, PanelContainer);
TextureButton *icon;
LinkButton *title;
LinkButton *category;
LinkButton *author;
TextureRect *stars[5];
Label *price;
int asset_id;
int category_id;
int author_id;
void _asset_clicked();
void _category_clicked();
void _author_clicked();
void set_image(int p_type, int p_index, const Ref<Texture> &p_image);
protected:
void _notification(int p_what);
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, const String &p_cost);
EditorAssetLibraryItem();
};
class EditorAssetLibraryItemDescription : public ConfirmationDialog {
GDCLASS(EditorAssetLibraryItemDescription, ConfirmationDialog);
EditorAssetLibraryItem *item;
RichTextLabel *description;
ScrollContainer *previews;
HBoxContainer *preview_hb;
PanelContainer *previews_bg;
struct Preview {
int id;
bool is_video;
String video_link;
Button *button;
Ref<Texture> image;
};
Vector<Preview> preview_images;
TextureRect *preview;
void set_image(int p_type, int p_index, const Ref<Texture> &p_image);
int asset_id;
String download_url;
String title;
String sha256;
Ref<Texture> icon;
void _link_click(const String &p_url);
void _preview_click(int p_id);
protected:
void _notification(int p_what);
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, 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; }
Ref<Texture> get_preview_icon() { return icon; }
String get_download_url() { return download_url; }
int get_asset_id() { return asset_id; }
String get_sha256() { return sha256; }
EditorAssetLibraryItemDescription();
};
class EditorAssetLibraryItemDownload : public PanelContainer {
GDCLASS(EditorAssetLibraryItemDownload, PanelContainer);
TextureRect *icon;
Label *title;
ProgressBar *progress;
Button *install;
Button *retry;
TextureButton *dismiss;
AcceptDialog *download_error;
HTTPRequest *download;
String host;
String sha256;
Label *status;
int prev_status;
int asset_id;
bool external_install;
EditorAssetInstaller *asset_installer;
void _close();
void _install();
void _make_request();
void _http_download_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data);
protected:
void _notification(int p_what);
static void _bind_methods();
public:
void set_external_install(bool p_enable) { external_install = p_enable; }
int get_asset_id() { return asset_id; }
void configure(const String &p_title, int p_asset_id, const Ref<Texture> &p_preview, const String &p_download_url, const String &p_sha256_hash);
EditorAssetLibraryItemDownload();
};
class EditorAssetLibrary : public PanelContainer {
GDCLASS(EditorAssetLibrary, PanelContainer);
String host;
EditorFileDialog *asset_open;
EditorAssetInstaller *asset_installer;
void _asset_open();
void _asset_file_selected(const String &p_file);
void _update_repository_options();
PanelContainer *library_scroll_bg;
ScrollContainer *library_scroll;
VBoxContainer *library_vb;
Label *library_loading;
Label *library_error;
LineEdit *filter;
Timer *filter_debounce_timer;
OptionButton *categories;
OptionButton *repository;
OptionButton *sort;
HBoxContainer *error_hb;
TextureRect *error_tr;
Label *error_label;
MenuButton *support;
HBoxContainer *contents;
HBoxContainer *asset_top_page;
GridContainer *asset_items;
HBoxContainer *asset_bottom_page;
HTTPRequest *request;
bool templates_only;
bool initial_loading;
enum Support {
SUPPORT_OFFICIAL,
SUPPORT_COMMUNITY,
SUPPORT_TESTING,
SUPPORT_MAX
};
enum SortOrder {
SORT_UPDATED,
SORT_UPDATED_REVERSE,
SORT_NAME,
SORT_NAME_REVERSE,
SORT_COST,
SORT_COST_REVERSE,
SORT_MAX
};
static const char *sort_key[SORT_MAX];
static const char *sort_text[SORT_MAX];
static const char *support_key[SUPPORT_MAX];
///MainListing
enum ImageType {
IMAGE_QUEUE_ICON,
IMAGE_QUEUE_THUMBNAIL,
IMAGE_QUEUE_SCREENSHOT,
};
struct ImageQueue {
bool active;
int queue_id;
ImageType image_type;
int image_index;
String image_url;
HTTPRequest *request;
ObjectID target;
};
int last_queue_id;
Map<int, ImageQueue> image_queue;
void _image_update(bool use_cache, bool final, const PoolByteArray &p_data, int p_queue_id);
void _image_request_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data, int p_queue_id);
void _request_image(ObjectID p_for, String p_image_url, ImageType p_type, int p_image_index);
void _update_image_queue();
HBoxContainer *_make_pages(int p_page, int p_page_count, int p_page_len, int p_total_items, int p_current_items);
//
EditorAssetLibraryItemDescription *description;
//
enum RequestType {
REQUESTING_NONE,
REQUESTING_CONFIG,
REQUESTING_SEARCH,
REQUESTING_ASSET,
};
RequestType requesting;
Dictionary category_map;
ScrollContainer *downloads_scroll;
HBoxContainer *downloads_hb;
void _install_asset();
void _select_author(int p_id);
void _select_category(int p_id);
void _select_asset(int p_id);
void _manage_plugins();
void _search(int p_page = 0);
void _rerun_search(int p_ignore);
void _search_text_changed(const String &p_text = "");
void _api_request(const String &p_request, RequestType p_request_type, const String &p_arguments = "");
void _http_request_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data);
void _filter_debounce_timer_timeout();
void _repository_changed(int p_repository_id);
void _support_toggled(int p_support);
void _install_external_asset(String p_zip_path, String p_title);
friend class EditorAssetLibraryItemDescription;
friend class EditorAssetLibraryItem;
protected:
static void _bind_methods();
void _notification(int p_what);
public:
void disable_community_support();
EditorAssetLibrary(bool p_templates_only = false);
};
class AssetLibraryEditorPlugin : public EditorPlugin {
GDCLASS(AssetLibraryEditorPlugin, EditorPlugin);
EditorAssetLibrary *addon_library;
EditorNode *editor;
public:
virtual String get_name() const { return "AssetLib"; }
bool has_main_screen() const { return true; }
virtual void edit(Object *p_object) {}
virtual bool handles(Object *p_object) const { return false; }
virtual void make_visible(bool p_visible);
//virtual bool get_remove_list(List<Node*> *p_list) { return canvas_item_editor->get_remove_list(p_list); }
//virtual Dictionary get_state() const;
//virtual void set_state(const Dictionary& p_state);
AssetLibraryEditorPlugin(EditorNode *p_node);
~AssetLibraryEditorPlugin();
};
#endif // EDITORASSETLIBRARY_H

View File

@ -2329,17 +2329,11 @@ void ProjectManager::_bind_methods() {
ClassDB::bind_method("_unhandled_input", &ProjectManager::_unhandled_input);
ClassDB::bind_method("_install_project", &ProjectManager::_install_project);
ClassDB::bind_method("_files_dropped", &ProjectManager::_files_dropped);
ClassDB::bind_method("_open_asset_library", &ProjectManager::_open_asset_library);
ClassDB::bind_method("_confirm_update_settings", &ProjectManager::_confirm_update_settings);
ClassDB::bind_method("_update_project_buttons", &ProjectManager::_update_project_buttons);
ClassDB::bind_method(D_METHOD("_scan_multiple_folders", "files"), &ProjectManager::_scan_multiple_folders);
}
void ProjectManager::_open_asset_library() {
asset_library->disable_community_support();
tabs->set_current_tab(1);
}
void ProjectManager::_version_button_pressed() {
OS::get_singleton()->set_clipboard(version_btn->get_text());
}
@ -2561,15 +2555,6 @@ ProjectManager::ProjectManager() {
about_btn->connect("pressed", this, "_show_about");
tree_vb->add_child(about_btn);
if (StreamPeerSSL::is_available()) {
asset_library = memnew(EditorAssetLibrary(true));
asset_library->set_name(TTR("Asset Library Projects"));
tabs->add_child(asset_library);
asset_library->connect("install_asset", this, "_install_project");
} else {
WARN_PRINT("Asset Library not available, as it requires SSL to work.");
}
HBoxContainer *settings_hb = memnew(HBoxContainer);
settings_hb->set_alignment(BoxContainer::ALIGN_END);
settings_hb->set_h_grow_direction(Control::GROW_DIRECTION_BEGIN);
@ -2720,9 +2705,7 @@ ProjectManager::ProjectManager() {
gui_base->add_child(dialog_error);
open_templates = memnew(ConfirmationDialog);
open_templates->set_text(TTR("You currently don't have any projects.\nWould you like to explore official example projects in the Asset Library?"));
open_templates->get_ok()->set_text(TTR("Open Asset Library"));
open_templates->connect("confirmed", this, "_open_asset_library");
open_templates->set_text(TTR("You currently don't have any projects."));
add_child(open_templates);
about = memnew(EditorAbout);

View File

@ -32,12 +32,12 @@
#define PROJECT_MANAGER_H
#include "editor/editor_about.h"
#include "editor/plugins/asset_library_editor_plugin.h"
#include "scene/gui/dialogs.h"
#include "scene/gui/file_dialog.h"
#include "scene/gui/scroll_container.h"
#include "scene/gui/tool_button.h"
#include "scene/gui/tree.h"
#include "scene/gui/check_box.h"
class ProjectDialog;
class ProjectList;
@ -53,8 +53,6 @@ class ProjectManager : public Control {
Button *run_btn;
Button *about_btn;
EditorAssetLibrary *asset_library;
ProjectListFilter *project_filter;
ProjectListFilter *project_order_filter;
Label *loading_label;
@ -87,7 +85,6 @@ class ProjectManager : public Control {
bool importing;
void _open_asset_library();
void _scan_projects();
void _run_project();
void _run_project_confirm();