Merge pull request #70028 from clayjohn/PM-GLES3

Added gl_compatibility as an option to the project creation screen
This commit is contained in:
Rémi Verschelde 2022-12-14 00:20:52 +01:00
commit db6976eed4
No known key found for this signature in database
GPG Key ID: C3336907360768E1
3 changed files with 75 additions and 23 deletions

View File

@ -628,6 +628,9 @@
<member name="network/tls/editor_tls_certificates" type="String" setter="" getter=""> <member name="network/tls/editor_tls_certificates" type="String" setter="" getter="">
The TLS certificate bundle to use for HTTP requests made within the editor (e.g. from the AssetLib tab). If left empty, the [url=https://github.com/godotengine/godot/blob/master/thirdparty/certs/ca-certificates.crt]included Mozilla certificate bundle[/url] will be used. The TLS certificate bundle to use for HTTP requests made within the editor (e.g. from the AssetLib tab). If left empty, the [url=https://github.com/godotengine/godot/blob/master/thirdparty/certs/ca-certificates.crt]included Mozilla certificate bundle[/url] will be used.
</member> </member>
<member name="project_manager/default_renderer" type="String" setter="" getter="">
The renderer type that will be checked off by default when creating a new project. Accepted strings are "forward_plus", "mobile" or "gl_compatibility".
</member>
<member name="project_manager/sorting_order" type="int" setter="" getter=""> <member name="project_manager/sorting_order" type="int" setter="" getter="">
The sorting order to use in the project manager. When changing the sorting order in the project manager, this setting is set permanently in the editor settings. The sorting order to use in the project manager. When changing the sorting order in the project manager, this setting is set permanently in the editor settings.
</member> </member>

View File

@ -734,6 +734,7 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
// TRANSLATORS: Project Manager here refers to the tool used to create/manage Godot projects. // TRANSLATORS: Project Manager here refers to the tool used to create/manage Godot projects.
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "project_manager/sorting_order", 0, "Last Edited,Name,Path") EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "project_manager/sorting_order", 0, "Last Edited,Name,Path")
EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_NONE, "project_manager/default_renderer", "forward_plus", "forward_plus,mobile,gl_compatibility")
if (p_extra_config.is_valid()) { if (p_extra_config.is_valid()) {
if (p_extra_config->has_section("init_projects") && p_extra_config->has_section_key("init_projects", "list")) { if (p_extra_config->has_section("init_projects") && p_extra_config->has_section_key("init_projects", "list")) {

View File

@ -94,6 +94,7 @@ private:
Container *path_container; Container *path_container;
Container *install_path_container; Container *install_path_container;
Container *renderer_container; Container *renderer_container;
Label *renderer_info;
HBoxContainer *default_files_container; HBoxContainer *default_files_container;
Ref<ButtonGroup> renderer_button_group; Ref<ButtonGroup> renderer_button_group;
Label *msg; Label *msg;
@ -426,6 +427,35 @@ private:
ok_pressed(); ok_pressed();
} }
void _renderer_selected() {
String renderer_type = renderer_button_group->get_pressed_button()->get_meta(SNAME("rendering_method"));
if (renderer_type == "forward_plus") {
renderer_info->set_text(
String::utf8("") + TTR("Supports desktop platforms only.") +
String::utf8("\n") + TTR("Advanced 3D graphics available.") +
String::utf8("\n") + TTR("Can scale to large complex scenes.") +
String::utf8("\n") + TTR("Uses RenderingDevice backend.") +
String::utf8("\n") + TTR("Slower rendering of simple scenes."));
} else if (renderer_type == "mobile") {
renderer_info->set_text(
String::utf8("") + TTR("Supports desktop + mobile platforms.") +
String::utf8("\n") + TTR("Less advanced 3D graphics.") +
String::utf8("\n") + TTR("Less scalable for complex scenes.") +
String::utf8("\n") + TTR("Uses RenderingDevice backend.") +
String::utf8("\n") + TTR("Fast rendering of simple scenes."));
} else if (renderer_type == "gl_compatibility") {
renderer_info->set_text(
String::utf8("") + TTR("Supports desktop, mobile, + web platforms.") +
String::utf8("\n") + TTR("Least advanced 3D graphics.") +
String::utf8("\n") + TTR("Intended for low-end/older devices.") +
String::utf8("\n") + TTR("Uses OpenGL 3 backend (OpenGL 3.3/ES 3.0/WebGL2).") +
String::utf8("\n") + TTR("Fastest rendering of simple scenes."));
} else {
WARN_PRINT("Unknown renderer type. Please report this as a bug on GitHub.");
}
}
void ok_pressed() override { void ok_pressed() override {
String dir = project_path->get_text(); String dir = project_path->get_text();
@ -483,10 +513,15 @@ private:
String renderer_type = renderer_button_group->get_pressed_button()->get_meta(SNAME("rendering_method")); String renderer_type = renderer_button_group->get_pressed_button()->get_meta(SNAME("rendering_method"));
initial_settings["rendering/renderer/rendering_method"] = renderer_type; initial_settings["rendering/renderer/rendering_method"] = renderer_type;
EditorSettings::get_singleton()->set("project_manager/default_renderer", renderer_type);
EditorSettings::get_singleton()->save();
if (renderer_type == "forward_plus") { if (renderer_type == "forward_plus") {
project_features.push_back("Forward Plus"); project_features.push_back("Forward Plus");
} else if (renderer_type == "mobile") { } else if (renderer_type == "mobile") {
project_features.push_back("Mobile"); project_features.push_back("Mobile");
} else if (renderer_type == "gl_compatibility") {
project_features.push_back("GL Compatibility");
} else { } else {
WARN_PRINT("Unknown renderer type. Please report this as a bug on GitHub."); WARN_PRINT("Unknown renderer type. Please report this as a bug on GitHub.");
} }
@ -860,42 +895,55 @@ public:
renderer_container->add_child(rshc); renderer_container->add_child(rshc);
renderer_button_group.instantiate(); renderer_button_group.instantiate();
// Left hand side, used for checkboxes to select renderer.
Container *rvb = memnew(VBoxContainer); Container *rvb = memnew(VBoxContainer);
rvb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
rshc->add_child(rvb); rshc->add_child(rvb);
String default_renderer_type = "forward_plus";
if (EditorSettings::get_singleton()->has_setting("project_manager/default_renderer")) {
default_renderer_type = EditorSettings::get_singleton()->get_setting("project_manager/default_renderer");
}
Button *rs_button = memnew(CheckBox); Button *rs_button = memnew(CheckBox);
rs_button->set_button_group(renderer_button_group); rs_button->set_button_group(renderer_button_group);
rs_button->set_text(TTR("Forward+")); rs_button->set_text(TTR("Forward+"));
rs_button->set_meta(SNAME("rendering_method"), "forward_plus"); rs_button->set_meta(SNAME("rendering_method"), "forward_plus");
rs_button->set_pressed(true); rs_button->connect("pressed", callable_mp(this, &ProjectDialog::_renderer_selected));
rvb->add_child(rs_button); rvb->add_child(rs_button);
l = memnew(Label); if (default_renderer_type == "forward_plus") {
l->set_text( rs_button->set_pressed(true);
String::utf8("") + TTR("Supports desktop platforms only.") + }
String::utf8("\n") + TTR("Advanced 3D graphics available.") +
String::utf8("\n") + TTR("Can scale to large complex scenes.") +
String::utf8("\n") + TTR("Slower rendering of simple scenes."));
l->set_modulate(Color(1, 1, 1, 0.7));
rvb->add_child(l);
rshc->add_child(memnew(VSeparator));
rvb = memnew(VBoxContainer);
rvb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
rshc->add_child(rvb);
rs_button = memnew(CheckBox); rs_button = memnew(CheckBox);
rs_button->set_button_group(renderer_button_group); rs_button->set_button_group(renderer_button_group);
rs_button->set_text(TTR("Mobile")); rs_button->set_text(TTR("Mobile"));
rs_button->set_meta(SNAME("rendering_method"), "mobile"); rs_button->set_meta(SNAME("rendering_method"), "mobile");
rs_button->connect("pressed", callable_mp(this, &ProjectDialog::_renderer_selected));
rvb->add_child(rs_button); rvb->add_child(rs_button);
l = memnew(Label); if (default_renderer_type == "mobile") {
l->set_text( rs_button->set_pressed(true);
String::utf8("") + TTR("Supports desktop + mobile platforms.") + }
String::utf8("\n") + TTR("Less advanced 3D graphics.") +
String::utf8("\n") + TTR("Less scalable for complex scenes.") + rs_button = memnew(CheckBox);
String::utf8("\n") + TTR("Faster rendering of simple scenes.")); rs_button->set_button_group(renderer_button_group);
l->set_modulate(Color(1, 1, 1, 0.7)); rs_button->set_text(TTR("Compatibility"));
rvb->add_child(l); rs_button->set_meta(SNAME("rendering_method"), "gl_compatibility");
rs_button->connect("pressed", callable_mp(this, &ProjectDialog::_renderer_selected));
rvb->add_child(rs_button);
if (default_renderer_type == "gl_compatibility") {
rs_button->set_pressed(true);
}
rshc->add_child(memnew(VSeparator));
// Right hand side, used for text explaining each choice.
rvb = memnew(VBoxContainer);
rvb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
rshc->add_child(rvb);
renderer_info = memnew(Label);
renderer_info->set_modulate(Color(1, 1, 1, 0.7));
rvb->add_child(renderer_info);
_renderer_selected();
l = memnew(Label); l = memnew(Label);
l->set_text(TTR("The renderer can be changed later, but scenes may need to be adjusted.")); l->set_text(TTR("The renderer can be changed later, but scenes may need to be adjusted."));