Merge pull request #61409 from akien-mga/pm-guard-asset_library-calls
This commit is contained in:
commit
971daadfa0
1 changed files with 23 additions and 19 deletions
|
@ -1881,18 +1881,20 @@ void ProjectManager::_notification(int p_what) {
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case NOTIFICATION_RESIZED: {
|
case NOTIFICATION_RESIZED: {
|
||||||
if (open_templates->is_visible()) {
|
if (open_templates && open_templates->is_visible()) {
|
||||||
open_templates->popup_centered();
|
open_templates->popup_centered();
|
||||||
}
|
}
|
||||||
real_t size = get_size().x / EDSCALE;
|
if (asset_library) {
|
||||||
asset_library->set_columns(size < 1000 ? 1 : 2);
|
real_t size = get_size().x / EDSCALE;
|
||||||
// Adjust names of tabs to fit the new size.
|
asset_library->set_columns(size < 1000 ? 1 : 2);
|
||||||
if (size < 650) {
|
// Adjust names of tabs to fit the new size.
|
||||||
local_projects_hb->set_name(TTR("Local"));
|
if (size < 650) {
|
||||||
asset_library->set_name(TTR("Asset Library"));
|
local_projects_hb->set_name(TTR("Local"));
|
||||||
} else {
|
asset_library->set_name(TTR("Asset Library"));
|
||||||
local_projects_hb->set_name(TTR("Local Projects"));
|
} else {
|
||||||
asset_library->set_name(TTR("Asset Library Projects"));
|
local_projects_hb->set_name(TTR("Local Projects"));
|
||||||
|
asset_library->set_name(TTR("Asset Library Projects"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
@ -1901,10 +1903,6 @@ void ProjectManager::_notification(int p_what) {
|
||||||
filter_option->select(default_sorting);
|
filter_option->select(default_sorting);
|
||||||
_project_list->set_order_option(default_sorting);
|
_project_list->set_order_option(default_sorting);
|
||||||
|
|
||||||
if (_project_list->get_project_count() == 0 && StreamPeerSSL::is_available()) {
|
|
||||||
open_templates->popup_centered();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_project_list->get_project_count() >= 1) {
|
if (_project_list->get_project_count() >= 1) {
|
||||||
// Focus on the search box immediately to allow the user
|
// Focus on the search box immediately to allow the user
|
||||||
// to search without having to reach for their mouse
|
// to search without having to reach for their mouse
|
||||||
|
@ -1914,6 +1912,10 @@ void ProjectManager::_notification(int p_what) {
|
||||||
if (asset_library) {
|
if (asset_library) {
|
||||||
// Removes extra border margins.
|
// Removes extra border margins.
|
||||||
asset_library->add_theme_style_override("panel", memnew(StyleBoxEmpty));
|
asset_library->add_theme_style_override("panel", memnew(StyleBoxEmpty));
|
||||||
|
// Suggest browsing asset library to get templates/demos.
|
||||||
|
if (open_templates && _project_list->get_project_count() == 0) {
|
||||||
|
open_templates->popup_centered();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
@ -2847,11 +2849,13 @@ ProjectManager::ProjectManager() {
|
||||||
dialog_error = memnew(AcceptDialog);
|
dialog_error = memnew(AcceptDialog);
|
||||||
add_child(dialog_error);
|
add_child(dialog_error);
|
||||||
|
|
||||||
open_templates = memnew(ConfirmationDialog);
|
if (asset_library) {
|
||||||
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 = memnew(ConfirmationDialog);
|
||||||
open_templates->get_ok_button()->set_text(TTR("Open Asset Library"));
|
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->connect("confirmed", callable_mp(this, &ProjectManager::_open_asset_library));
|
open_templates->get_ok_button()->set_text(TTR("Open Asset Library"));
|
||||||
add_child(open_templates);
|
open_templates->connect("confirmed", callable_mp(this, &ProjectManager::_open_asset_library));
|
||||||
|
add_child(open_templates);
|
||||||
|
}
|
||||||
|
|
||||||
about = memnew(EditorAbout);
|
about = memnew(EditorAbout);
|
||||||
add_child(about);
|
add_child(about);
|
||||||
|
|
Loading…
Reference in a new issue