|
@@ -93,6 +93,12 @@ void EditorAssetLibraryItem::_notification(int p_what) {
|
|
category->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5));
|
|
category->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5));
|
|
author->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5));
|
|
author->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5));
|
|
price->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5));
|
|
price->add_theme_color_override("font_color", Color(0.5, 0.5, 0.5));
|
|
|
|
+
|
|
|
|
+ if (author->get_default_cursor_shape() == CURSOR_ARROW) {
|
|
|
|
+ // Disable visible feedback if author link isn't clickable.
|
|
|
|
+ author->add_theme_color_override("font_pressed_color", Color(0.5, 0.5, 0.5));
|
|
|
|
+ author->add_theme_color_override("font_hover_color", Color(0.5, 0.5, 0.5));
|
|
|
|
+ }
|
|
} break;
|
|
} break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -106,7 +112,7 @@ void EditorAssetLibraryItem::_category_clicked() {
|
|
}
|
|
}
|
|
|
|
|
|
void EditorAssetLibraryItem::_author_clicked() {
|
|
void EditorAssetLibraryItem::_author_clicked() {
|
|
- emit_signal(SNAME("author_selected"), author_id);
|
|
|
|
|
|
+ emit_signal(SNAME("author_selected"), author->get_text());
|
|
}
|
|
}
|
|
|
|
|
|
void EditorAssetLibraryItem::_bind_methods() {
|
|
void EditorAssetLibraryItem::_bind_methods() {
|
|
@@ -116,7 +122,7 @@ void EditorAssetLibraryItem::_bind_methods() {
|
|
ADD_SIGNAL(MethodInfo("author_selected"));
|
|
ADD_SIGNAL(MethodInfo("author_selected"));
|
|
}
|
|
}
|
|
|
|
|
|
-EditorAssetLibraryItem::EditorAssetLibraryItem() {
|
|
|
|
|
|
+EditorAssetLibraryItem::EditorAssetLibraryItem(bool p_clickable) {
|
|
Ref<StyleBoxEmpty> border;
|
|
Ref<StyleBoxEmpty> border;
|
|
border.instantiate();
|
|
border.instantiate();
|
|
border->set_content_margin_all(5 * EDSCALE);
|
|
border->set_content_margin_all(5 * EDSCALE);
|
|
@@ -129,9 +135,6 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() {
|
|
|
|
|
|
icon = memnew(TextureButton);
|
|
icon = memnew(TextureButton);
|
|
icon->set_custom_minimum_size(Size2(64, 64) * EDSCALE);
|
|
icon->set_custom_minimum_size(Size2(64, 64) * EDSCALE);
|
|
- icon->set_default_cursor_shape(CURSOR_POINTING_HAND);
|
|
|
|
- icon->connect("pressed", callable_mp(this, &EditorAssetLibraryItem::_asset_clicked));
|
|
|
|
-
|
|
|
|
hb->add_child(icon);
|
|
hb->add_child(icon);
|
|
|
|
|
|
VBoxContainer *vb = memnew(VBoxContainer);
|
|
VBoxContainer *vb = memnew(VBoxContainer);
|
|
@@ -141,23 +144,48 @@ EditorAssetLibraryItem::EditorAssetLibraryItem() {
|
|
|
|
|
|
title = memnew(LinkButton);
|
|
title = memnew(LinkButton);
|
|
title->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
|
|
title->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
|
|
- title->connect("pressed", callable_mp(this, &EditorAssetLibraryItem::_asset_clicked));
|
|
|
|
vb->add_child(title);
|
|
vb->add_child(title);
|
|
|
|
|
|
category = memnew(LinkButton);
|
|
category = memnew(LinkButton);
|
|
category->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
|
|
category->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
|
|
- category->connect("pressed", callable_mp(this, &EditorAssetLibraryItem::_category_clicked));
|
|
|
|
vb->add_child(category);
|
|
vb->add_child(category);
|
|
|
|
|
|
|
|
+ HBoxContainer *author_price_hbox = memnew(HBoxContainer);
|
|
|
|
+ author_price_hbox->add_theme_constant_override("separation", 5 * EDSCALE);
|
|
|
|
+ vb->add_child(author_price_hbox);
|
|
|
|
+
|
|
author = memnew(LinkButton);
|
|
author = memnew(LinkButton);
|
|
- author->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
|
|
|
|
- author->connect("pressed", callable_mp(this, &EditorAssetLibraryItem::_author_clicked));
|
|
|
|
- vb->add_child(author);
|
|
|
|
|
|
+ author->set_tooltip_text(TTR("Author"));
|
|
|
|
+ author_price_hbox->add_child(author);
|
|
|
|
+
|
|
|
|
+ author_price_hbox->add_child(memnew(HSeparator));
|
|
|
|
+
|
|
|
|
+ if (p_clickable) {
|
|
|
|
+ author->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER);
|
|
|
|
+ icon->set_default_cursor_shape(CURSOR_POINTING_HAND);
|
|
|
|
+ icon->connect("pressed", callable_mp(this, &EditorAssetLibraryItem::_asset_clicked));
|
|
|
|
+ title->connect("pressed", callable_mp(this, &EditorAssetLibraryItem::_asset_clicked));
|
|
|
|
+ category->connect("pressed", callable_mp(this, &EditorAssetLibraryItem::_category_clicked));
|
|
|
|
+ author->connect("pressed", callable_mp(this, &EditorAssetLibraryItem::_author_clicked));
|
|
|
|
+ } else {
|
|
|
|
+ title->set_mouse_filter(MOUSE_FILTER_IGNORE);
|
|
|
|
+ category->set_mouse_filter(MOUSE_FILTER_IGNORE);
|
|
|
|
+ author->set_underline_mode(LinkButton::UNDERLINE_MODE_NEVER);
|
|
|
|
+ author->set_default_cursor_shape(CURSOR_ARROW);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Ref<StyleBoxEmpty> label_margin;
|
|
|
|
+ label_margin.instantiate();
|
|
|
|
+ label_margin->set_content_margin_all(0);
|
|
|
|
|
|
price = memnew(Label);
|
|
price = memnew(Label);
|
|
- vb->add_child(price);
|
|
|
|
|
|
+ price->add_theme_style_override("normal", label_margin);
|
|
|
|
+ price->set_tooltip_text(TTR("License"));
|
|
|
|
+ price->set_mouse_filter(MOUSE_FILTER_PASS);
|
|
|
|
+
|
|
|
|
+ author_price_hbox->add_child(price);
|
|
|
|
|
|
- set_custom_minimum_size(Size2(250, 100) * EDSCALE);
|
|
|
|
|
|
+ set_custom_minimum_size(Size2(250, 80) * EDSCALE);
|
|
set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
|
set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -262,6 +290,10 @@ void EditorAssetLibraryItemDescription::configure(const String &p_title, int p_a
|
|
}
|
|
}
|
|
|
|
|
|
void EditorAssetLibraryItemDescription::add_preview(int p_id, bool p_video, const String &p_url) {
|
|
void EditorAssetLibraryItemDescription::add_preview(int p_id, bool p_video, const String &p_url) {
|
|
|
|
+ if (preview_images.is_empty()) {
|
|
|
|
+ previews_vbox->show();
|
|
|
|
+ }
|
|
|
|
+
|
|
Preview new_preview;
|
|
Preview new_preview;
|
|
new_preview.id = p_id;
|
|
new_preview.id = p_id;
|
|
new_preview.video_link = p_url;
|
|
new_preview.video_link = p_url;
|
|
@@ -290,7 +322,7 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() {
|
|
item = memnew(EditorAssetLibraryItem);
|
|
item = memnew(EditorAssetLibraryItem);
|
|
|
|
|
|
desc_vbox->add_child(item);
|
|
desc_vbox->add_child(item);
|
|
- desc_vbox->set_custom_minimum_size(Size2(440 * EDSCALE, 0));
|
|
|
|
|
|
+ desc_vbox->set_custom_minimum_size(Size2(440 * EDSCALE, 440 * EDSCALE));
|
|
|
|
|
|
description = memnew(RichTextLabel);
|
|
description = memnew(RichTextLabel);
|
|
desc_vbox->add_child(description);
|
|
desc_vbox->add_child(description);
|
|
@@ -298,7 +330,9 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() {
|
|
description->connect("meta_clicked", callable_mp(this, &EditorAssetLibraryItemDescription::_link_click));
|
|
description->connect("meta_clicked", callable_mp(this, &EditorAssetLibraryItemDescription::_link_click));
|
|
description->add_theme_constant_override("line_separation", Math::round(5 * EDSCALE));
|
|
description->add_theme_constant_override("line_separation", Math::round(5 * EDSCALE));
|
|
|
|
|
|
- VBoxContainer *previews_vbox = memnew(VBoxContainer);
|
|
|
|
|
|
+ previews_vbox = memnew(VBoxContainer);
|
|
|
|
+ previews_vbox->hide(); // Will be shown if we add any previews later.
|
|
|
|
+
|
|
hbox->add_child(previews_vbox);
|
|
hbox->add_child(previews_vbox);
|
|
previews_vbox->add_theme_constant_override("separation", 15 * EDSCALE);
|
|
previews_vbox->add_theme_constant_override("separation", 15 * EDSCALE);
|
|
previews_vbox->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
|
previews_vbox->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
|
@@ -736,8 +770,12 @@ const char *EditorAssetLibrary::support_text[SUPPORT_MAX] = {
|
|
TTRC("Testing"),
|
|
TTRC("Testing"),
|
|
};
|
|
};
|
|
|
|
|
|
-void EditorAssetLibrary::_select_author(int p_id) {
|
|
|
|
- // Open author window.
|
|
|
|
|
|
+void EditorAssetLibrary::_select_author(const String &p_author) {
|
|
|
|
+ if (!host.contains("godotengine.org")) {
|
|
|
|
+ // Don't open the link for alternative repositories.
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ OS::get_singleton()->shell_open("https://godotengine.org/asset-library/asset?user=" + p_author.uri_encode());
|
|
}
|
|
}
|
|
|
|
|
|
void EditorAssetLibrary::_select_category(int p_id) {
|
|
void EditorAssetLibrary::_select_category(int p_id) {
|
|
@@ -1342,7 +1380,7 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
|
|
ERR_FAIL_COND(!category_map.has(r["category_id"]));
|
|
ERR_FAIL_COND(!category_map.has(r["category_id"]));
|
|
ERR_CONTINUE(!r.has("cost"));
|
|
ERR_CONTINUE(!r.has("cost"));
|
|
|
|
|
|
- EditorAssetLibraryItem *item = memnew(EditorAssetLibraryItem);
|
|
|
|
|
|
+ EditorAssetLibraryItem *item = memnew(EditorAssetLibraryItem(true));
|
|
asset_items->add_child(item);
|
|
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["cost"]);
|
|
item->configure(r["title"], r["asset_id"], category_map[r["category_id"]], r["category_id"], r["author"], r["author_id"], r["cost"]);
|
|
item->clamp_width(asset_items_column_width);
|
|
item->clamp_width(asset_items_column_width);
|
|
@@ -1382,7 +1420,6 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
|
|
|
|
|
|
description = memnew(EditorAssetLibraryItemDescription);
|
|
description = memnew(EditorAssetLibraryItemDescription);
|
|
add_child(description);
|
|
add_child(description);
|
|
- description->popup_centered();
|
|
|
|
description->connect("confirmed", callable_mp(this, &EditorAssetLibrary::_install_asset));
|
|
description->connect("confirmed", callable_mp(this, &EditorAssetLibrary::_install_asset));
|
|
|
|
|
|
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"]);
|
|
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"]);
|
|
@@ -1431,6 +1468,8 @@ void EditorAssetLibrary::_http_request_completed(int p_status, int p_code, const
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ description->popup_centered();
|
|
} break;
|
|
} break;
|
|
default:
|
|
default:
|
|
break;
|
|
break;
|