summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/main.cpp70
-rw-r--r--main/tests/test_io.cpp10
2 files changed, 45 insertions, 35 deletions
diff --git a/main/main.cpp b/main/main.cpp
index ece54e7427..8960d85c45 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -31,10 +31,10 @@
#include "app_icon.gen.h"
#include "core/register_core_types.h"
#include "drivers/register_driver_types.h"
-#include "global_config.h"
#include "message_queue.h"
#include "modules/register_module_types.h"
#include "os/os.h"
+#include "project_settings.h"
#include "scene/register_scene_types.h"
#include "script_debugger_local.h"
#include "script_debugger_remote.h"
@@ -74,7 +74,7 @@
#include "translation.h"
#include "version.h"
-static GlobalConfig *globals = NULL;
+static ProjectSettings *globals = NULL;
static Engine *engine = NULL;
static InputMap *input_map = NULL;
static bool _start_success = false;
@@ -205,14 +205,14 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
Thread::_main_thread_id = Thread::get_caller_ID();
- globals = memnew(GlobalConfig);
+ globals = memnew(ProjectSettings);
input_map = memnew(InputMap);
register_core_settings(); //here globals is present
translation_server = memnew(TranslationServer);
performance = memnew(Performance);
- globals->add_singleton(GlobalConfig::Singleton("Performance", performance));
+ globals->add_singleton(ProjectSettings::Singleton("Performance", performance));
MAIN_PRINT("Main: Parse CMDLine");
@@ -529,7 +529,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
if (I->next()) {
- GlobalConfig::get_singleton()->set("editor_scene", game_path = I->next()->get());
+ ProjectSettings::get_singleton()->set("editor_scene", game_path = I->next()->get());
} else {
goto error;
}
@@ -551,7 +551,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
if (I->next()) {
int editor_pid = I->next()->get().to_int();
- GlobalConfig::get_singleton()->set("editor_pid", editor_pid);
+ ProjectSettings::get_singleton()->set("editor_pid", editor_pid);
N = I->next()->next();
} else {
goto error;
@@ -642,7 +642,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
#ifdef TOOLS_ENABLED
if (editor) {
packed_data->set_disabled(true);
- globals->set_disable_platform_override(true);
+ globals->set_disable_feature_overrides(true);
StreamPeerSSL::initialize_certs = false; //will be initialized by editor
}
@@ -665,10 +665,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
use_custom_res = false;
}
- if (bool(GlobalConfig::get_singleton()->get("application/run/disable_stdout"))) {
+ if (bool(ProjectSettings::get_singleton()->get("application/run/disable_stdout"))) {
quiet_stdout = true;
}
- if (bool(GlobalConfig::get_singleton()->get("application/run/disable_stderr"))) {
+ if (bool(ProjectSettings::get_singleton()->get("application/run/disable_stderr"))) {
_print_error_enabled = false;
};
@@ -679,7 +679,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
#ifdef TOOLS_ENABLED
- if (main_args.size() == 0 && (!GlobalConfig::get_singleton()->has("application/run/main_loop_type")) && (!GlobalConfig::get_singleton()->has("application/main_scene") || String(GlobalConfig::get_singleton()->get("application/main_scene")) == ""))
+ if (main_args.size() == 0 && (!ProjectSettings::get_singleton()->has("application/run/main_loop_type")) && (!ProjectSettings::get_singleton()->has("application/run/main_scene") || String(ProjectSettings::get_singleton()->get("application/run/main_scene")) == ""))
use_custom_res = false; //project manager (run without arguments)
#endif
@@ -724,6 +724,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
use_vsync = GLOBAL_DEF("display/window/vsync/use_vsync", use_vsync);
GLOBAL_DEF("display/window/size/test_width", 0);
GLOBAL_DEF("display/window/size/test_height", 0);
+ GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_allocation", 2);
+ GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_allocation.mobile", 3);
+
Engine::get_singleton()->_pixel_snap = GLOBAL_DEF("rendering/quality/2d/use_pixel_snap", false);
OS::get_singleton()->_keep_screen_on = GLOBAL_DEF("display/window/energy_saving/keep_screen_on", true);
if (rtm == -1) {
@@ -812,7 +815,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
message_queue = memnew(MessageQueue);
- GlobalConfig::get_singleton()->register_global_defaults();
+ ProjectSettings::get_singleton()->register_global_defaults();
if (p_second_phase)
return setup2();
@@ -913,7 +916,7 @@ Error Main::setup2() {
if (show_logo) { //boot logo!
String boot_logo_path = GLOBAL_DEF("application/boot_splash/image", String());
bool boot_logo_scale = GLOBAL_DEF("application/boot_splash/fullsize", true);
- GlobalConfig::get_singleton()->set_custom_property_info("application/boot_splash/image", PropertyInfo(Variant::STRING, "application/boot_splash/image", PROPERTY_HINT_FILE, "*.png"));
+ ProjectSettings::get_singleton()->set_custom_property_info("application/boot_splash/image", PropertyInfo(Variant::STRING, "application/boot_splash/image", PROPERTY_HINT_FILE, "*.png"));
Ref<Image> boot_logo;
@@ -933,7 +936,7 @@ Error Main::setup2() {
VisualServer::get_singleton()->set_boot_image(boot_logo, boot_bg, boot_logo_scale);
#ifndef TOOLS_ENABLED
//no tools, so free the boot logo (no longer needed)
-//GlobalConfig::get_singleton()->set("application/boot_logo",Image());
+//ProjectSettings::get_singleton()->set("application/boot_logo",Image());
#endif
} else {
@@ -958,7 +961,7 @@ Error Main::setup2() {
MAIN_PRINT("Main: END");
GLOBAL_DEF("application/config/icon", String());
- GlobalConfig::get_singleton()->set_custom_property_info("application/config/icon", PropertyInfo(Variant::STRING, "application/config/icon", PROPERTY_HINT_FILE, "*.png,*.webp"));
+ ProjectSettings::get_singleton()->set_custom_property_info("application/config/icon", PropertyInfo(Variant::STRING, "application/config/icon", PROPERTY_HINT_FILE, "*.png,*.webp"));
if (bool(GLOBAL_DEF("display/window/handheld/emulate_touchscreen", false))) {
if (!OS::get_singleton()->has_touchscreen_ui_hint() && Input::get_singleton() && !editor) {
@@ -977,15 +980,15 @@ Error Main::setup2() {
GLOBAL_DEF("display/mouse_cursor/custom_image", String());
GLOBAL_DEF("display/mouse_cursor/custom_image_hotspot", Vector2());
- GlobalConfig::get_singleton()->set_custom_property_info("display/mouse_cursor/custom_image", PropertyInfo(Variant::STRING, "display/mouse_cursor/custom_image", PROPERTY_HINT_FILE, "*.png,*.webp"));
+ ProjectSettings::get_singleton()->set_custom_property_info("display/mouse_cursor/custom_image", PropertyInfo(Variant::STRING, "display/mouse_cursor/custom_image", PROPERTY_HINT_FILE, "*.png,*.webp"));
- if (String(GlobalConfig::get_singleton()->get("display/mouse_cursor/custom_image")) != String()) {
+ if (String(ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image")) != String()) {
//print_line("use custom cursor");
- Ref<Texture> cursor = ResourceLoader::load(GlobalConfig::get_singleton()->get("display/mouse_cursor/custom_image"));
+ Ref<Texture> cursor = ResourceLoader::load(ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image"));
if (cursor.is_valid()) {
//print_line("loaded ok");
- Vector2 hotspot = GlobalConfig::get_singleton()->get("display/mouse_cursor/custom_image_hotspot");
+ Vector2 hotspot = ProjectSettings::get_singleton()->get("display/mouse_cursor/custom_image_hotspot");
Input::get_singleton()->set_custom_mouse_cursor(cursor, hotspot);
}
}
@@ -1257,6 +1260,7 @@ bool Main::start() {
String stretch_mode = GLOBAL_DEF("display/window/stretch/mode", "disabled");
String stretch_aspect = GLOBAL_DEF("display/window/stretch/aspect", "ignore");
Size2i stretch_size = Size2(GLOBAL_DEF("display/window/size/width", 0), GLOBAL_DEF("display/window/size/height", 0));
+ int stretch_shrink = GLOBAL_DEF("display/window/stretch/shrink", 1);
SceneTree::StretchMode sml_sm = SceneTree::STRETCH_MODE_DISABLED;
if (stretch_mode == "2d")
@@ -1272,11 +1276,11 @@ bool Main::start() {
else if (stretch_aspect == "keep_height")
sml_aspect = SceneTree::STRETCH_ASPECT_KEEP_HEIGHT;
- sml->set_screen_stretch(sml_sm, sml_aspect, stretch_size);
+ sml->set_screen_stretch(sml_sm, sml_aspect, stretch_size, stretch_shrink);
sml->set_auto_accept_quit(GLOBAL_DEF("application/config/auto_accept_quit", true));
sml->set_quit_on_go_back(GLOBAL_DEF("application/config/quit_on_go_back", true));
- String appname = GlobalConfig::get_singleton()->get("application/config/name");
+ String appname = ProjectSettings::get_singleton()->get("application/config/name");
appname = TranslationServer::get_singleton()->translate(appname);
OS::get_singleton()->set_window_title(appname);
@@ -1291,12 +1295,16 @@ bool Main::start() {
sml->get_root()->set_shadow_atlas_quadrant_subdiv(1, Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q1_subdiv));
sml->get_root()->set_shadow_atlas_quadrant_subdiv(2, Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q2_subdiv));
sml->get_root()->set_shadow_atlas_quadrant_subdiv(3, Viewport::ShadowAtlasQuadrantSubdiv(shadow_atlas_q3_subdiv));
+ Viewport::Usage usage = Viewport::Usage(int(GLOBAL_GET("rendering/quality/intended_usage/framebuffer_allocation")));
+ sml->get_root()->set_usage(usage);
} else {
GLOBAL_DEF("display/window/stretch/mode", "disabled");
- GlobalConfig::get_singleton()->set_custom_property_info("display/window/stretch/mode", PropertyInfo(Variant::STRING, "display/window/stretch/mode", PROPERTY_HINT_ENUM, "disabled,2d,viewport"));
+ ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/mode", PropertyInfo(Variant::STRING, "display/window/stretch/mode", PROPERTY_HINT_ENUM, "disabled,2d,viewport"));
GLOBAL_DEF("display/window/stretch/aspect", "ignore");
- GlobalConfig::get_singleton()->set_custom_property_info("display/window/stretch/aspect", PropertyInfo(Variant::STRING, "display/window/stretch/aspect", PROPERTY_HINT_ENUM, "ignore,keep,keep_width,keep_height"));
+ ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/aspect", PropertyInfo(Variant::STRING, "display/window/stretch/aspect", PROPERTY_HINT_ENUM, "ignore,keep,keep_width,keep_height"));
+ GLOBAL_DEF("display/window/stretch/shrink", 1);
+ ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/shrink", PropertyInfo(Variant::STRING, "display/window/stretch/shrink", PROPERTY_HINT_RANGE, "1,8,1"));
sml->set_auto_accept_quit(GLOBAL_DEF("application/config/auto_accept_quit", true));
sml->set_quit_on_go_back(GLOBAL_DEF("application/config/quit_on_go_back", true));
}
@@ -1311,7 +1319,7 @@ bool Main::start() {
if (!absolute) {
- if (GlobalConfig::get_singleton()->is_using_datapack()) {
+ if (ProjectSettings::get_singleton()->is_using_datapack()) {
local_game_path = "res://" + local_game_path;
@@ -1334,7 +1342,7 @@ bool Main::start() {
}
}
- local_game_path = GlobalConfig::get_singleton()->localize_path(local_game_path);
+ local_game_path = ProjectSettings::get_singleton()->localize_path(local_game_path);
#ifdef TOOLS_ENABLED
if (editor) {
@@ -1360,7 +1368,7 @@ bool Main::start() {
if (game_path != "" || script != "") {
//autoload
List<PropertyInfo> props;
- GlobalConfig::get_singleton()->get_property_list(&props);
+ ProjectSettings::get_singleton()->get_property_list(&props);
//first pass, add the constants so they exist before any script is loaded
for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
@@ -1369,7 +1377,7 @@ bool Main::start() {
if (!s.begins_with("autoload/"))
continue;
String name = s.get_slicec('/', 1);
- String path = GlobalConfig::get_singleton()->get(s);
+ String path = ProjectSettings::get_singleton()->get(s);
bool global_var = false;
if (path.begins_with("*")) {
global_var = true;
@@ -1390,7 +1398,7 @@ bool Main::start() {
if (!s.begins_with("autoload/"))
continue;
String name = s.get_slicec('/', 1);
- String path = GlobalConfig::get_singleton()->get(s);
+ String path = ProjectSettings::get_singleton()->get(s);
bool global_var = false;
if (path.begins_with("*")) {
global_var = true;
@@ -1689,14 +1697,16 @@ void Main::cleanup() {
OS::get_singleton()->_execpath = "";
OS::get_singleton()->_local_clipboard = "";
- if (audio_server) {
- memdelete(audio_server);
- }
+ ScriptServer::finish_languages();
#ifdef TOOLS_ENABLED
EditorNode::unregister_editor_types();
#endif
+ if (audio_server) {
+ memdelete(audio_server);
+ }
+
unregister_driver_types();
unregister_module_types();
unregister_scene_types();
diff --git a/main/tests/test_io.cpp b/main/tests/test_io.cpp
index 6986576081..f7c49c9249 100644
--- a/main/tests/test_io.cpp
+++ b/main/tests/test_io.cpp
@@ -31,7 +31,7 @@
#ifdef MINIZIP_ENABLED
-#include "core/global_config.h"
+#include "core/project_settings.h"
#include "io/resource_loader.h"
#include "io/resource_saver.h"
#include "os/dir_access.h"
@@ -91,10 +91,10 @@ MainLoop *test() {
ResourceSaver::save("test_data/rock.xml", texture);
print_line("localize paths");
- print_line(GlobalConfig::get_singleton()->localize_path("algo.xml"));
- print_line(GlobalConfig::get_singleton()->localize_path("c:\\windows\\algo.xml"));
- print_line(GlobalConfig::get_singleton()->localize_path(GlobalConfig::get_singleton()->get_resource_path() + "/something/something.xml"));
- print_line(GlobalConfig::get_singleton()->localize_path("somedir/algo.xml"));
+ print_line(ProjectSettings::get_singleton()->localize_path("algo.xml"));
+ print_line(ProjectSettings::get_singleton()->localize_path("c:\\windows\\algo.xml"));
+ print_line(ProjectSettings::get_singleton()->localize_path(ProjectSettings::get_singleton()->get_resource_path() + "/something/something.xml"));
+ print_line(ProjectSettings::get_singleton()->localize_path("somedir/algo.xml"));
{