summaryrefslogtreecommitdiff
path: root/main/main.cpp
diff options
context:
space:
mode:
authorkobewi <kobewi4e@gmail.com>2022-10-20 15:43:17 +0200
committerkobewi <kobewi4e@gmail.com>2022-11-08 01:29:39 +0100
commitd9f066d5fadfce5fc19310f8ba5ce51d3552bf9e (patch)
treead7a7fa1d33b3e46c7f79c9b4016f51d53c67a76 /main/main.cpp
parentb61fda9d2a6166e41538405ad8ae24f1aed40570 (diff)
Remove duplicate project settings definitions
Diffstat (limited to 'main/main.cpp')
-rw-r--r--main/main.cpp119
1 files changed, 53 insertions, 66 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 5b998d98ce..0fce8e3d94 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -443,11 +443,7 @@ Error Main::test_setup() {
globals = memnew(ProjectSettings);
- GLOBAL_DEF("debug/settings/crash_handler/message",
- String("Please include this when reporting the bug on https://github.com/godotengine/godot/issues"));
- GLOBAL_DEF_RST("rendering/occlusion_culling/bvh_build_quality", 2);
-
- register_core_settings(); //here globals are present
+ register_core_settings(); // Here globals are present.
translation_server = memnew(TranslationServer);
tsman = memnew(TextServerManager);
@@ -665,11 +661,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
GLOBAL_DEF_RST("application/run/flush_stdout_on_print", false);
GLOBAL_DEF_RST("application/run/flush_stdout_on_print.debug", true);
- GLOBAL_DEF("debug/settings/crash_handler/message",
- String("Please include this when reporting the bug to the project developer."));
- GLOBAL_DEF("debug/settings/crash_handler/message.editor",
- String("Please include this when reporting the bug on: https://github.com/godotengine/godot/issues"));
-
MAIN_PRINT("Main: Parse CMDLine");
/* argument parsing and main creation */
@@ -1358,7 +1349,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
ResourceUID::get_singleton()->load_from_cache(); // load UUIDs from cache.
- GLOBAL_DEF("memory/limits/multithreaded_server/rid_pool_prealloc", 60);
ProjectSettings::get_singleton()->set_custom_property_info("memory/limits/multithreaded_server/rid_pool_prealloc",
PropertyInfo(Variant::INT,
"memory/limits/multithreaded_server/rid_pool_prealloc",
@@ -1715,7 +1705,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
window_mode = (DisplayServer::WindowMode)(GLOBAL_GET("display/window/size/mode").operator int());
}
- GLOBAL_DEF_RST("internationalization/rendering/force_right_to_left_layout_direction", false);
GLOBAL_DEF("internationalization/locale/include_text_server_data", false);
OS::get_singleton()->_allow_hidpi = GLOBAL_DEF("display/window/dpi/allow_hidpi", true);
@@ -2165,12 +2154,12 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
boot_logo->set_pixel(0, 0, Color(0, 0, 0, 0));
}
+ Color boot_bg_color = GLOBAL_DEF_BASIC("application/boot_splash/bg_color", boot_splash_bg_color);
+
#if defined(TOOLS_ENABLED) && !defined(NO_EDITOR_SPLASH)
- const Color boot_bg_color =
+ boot_bg_color =
GLOBAL_DEF_BASIC("application/boot_splash/bg_color",
(editor || project_manager) ? boot_splash_editor_bg_color : boot_splash_bg_color);
-#else
- const Color boot_bg_color = GLOBAL_DEF_BASIC("application/boot_splash/bg_color", boot_splash_bg_color);
#endif
if (boot_logo.is_valid()) {
RenderingServer::get_singleton()->set_boot_image(boot_logo, boot_bg_color, boot_logo_scale,
@@ -2202,7 +2191,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
MAIN_PRINT("Main: DCC");
RenderingServer::get_singleton()->set_default_clear_color(
- GLOBAL_DEF_BASIC("rendering/environment/defaults/default_clear_color", Color(0.3, 0.3, 0.3)));
+ GLOBAL_GET("rendering/environment/defaults/default_clear_color"));
GLOBAL_DEF("application/config/icon", String());
ProjectSettings::get_singleton()->set_custom_property_info("application/config/icon",
@@ -2805,15 +2794,48 @@ bool Main::start() {
startup_benchmark_file = String();
}
#endif
+ GLOBAL_DEF_BASIC("display/window/stretch/mode", "disabled");
+ ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/mode",
+ PropertyInfo(Variant::STRING,
+ "display/window/stretch/mode",
+ PROPERTY_HINT_ENUM,
+ "disabled,canvas_items,viewport"));
+ GLOBAL_DEF_BASIC("display/window/stretch/aspect", "keep");
+ 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,expand"));
+ GLOBAL_DEF_BASIC("display/window/stretch/scale", 1.0);
+ ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/scale",
+ PropertyInfo(Variant::FLOAT,
+ "display/window/stretch/scale",
+ PROPERTY_HINT_RANGE,
+ "0.5,8.0,0.01"));
+ 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));
+ GLOBAL_DEF_BASIC("gui/common/snap_controls_to_pixels", true);
+ GLOBAL_DEF_BASIC("gui/fonts/dynamic_fonts/use_oversampling", true);
+
+ GLOBAL_DEF_BASIC("rendering/textures/canvas_textures/default_texture_filter", 1);
+ ProjectSettings::get_singleton()->set_custom_property_info(
+ "rendering/textures/canvas_textures/default_texture_filter",
+ PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_filter", PROPERTY_HINT_ENUM,
+ "Nearest,Linear,Linear Mipmap,Nearest Mipmap"));
+ GLOBAL_DEF_BASIC("rendering/textures/canvas_textures/default_texture_repeat", 0);
+ ProjectSettings::get_singleton()->set_custom_property_info(
+ "rendering/textures/canvas_textures/default_texture_repeat",
+ PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_repeat", PROPERTY_HINT_ENUM,
+ "Disable,Enable,Mirror"));
if (!editor && !project_manager) {
//standard helpers that can be changed from main config
- String stretch_mode = GLOBAL_DEF_BASIC("display/window/stretch/mode", "disabled");
- String stretch_aspect = GLOBAL_DEF_BASIC("display/window/stretch/aspect", "keep");
- Size2i stretch_size = Size2i(GLOBAL_DEF_BASIC("display/window/size/viewport_width", 0),
- GLOBAL_DEF_BASIC("display/window/size/viewport_height", 0));
- real_t stretch_scale = GLOBAL_DEF_BASIC("display/window/stretch/scale", 1.0);
+ String stretch_mode = GLOBAL_GET("display/window/stretch/mode");
+ String stretch_aspect = GLOBAL_GET("display/window/stretch/aspect");
+ Size2i stretch_size = Size2i(GLOBAL_GET("display/window/size/viewport_width"),
+ GLOBAL_GET("display/window/size/viewport_height"));
+ real_t stretch_scale = GLOBAL_GET("display/window/stretch/scale");
Window::ContentScaleMode cs_sm = Window::CONTENT_SCALE_MODE_DISABLED;
if (stretch_mode == "canvas_items") {
@@ -2838,8 +2860,8 @@ bool Main::start() {
sml->get_root()->set_content_scale_size(stretch_size);
sml->get_root()->set_content_scale_factor(stretch_scale);
- 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));
+ sml->set_auto_accept_quit(GLOBAL_GET("application/config/auto_accept_quit"));
+ sml->set_quit_on_go_back(GLOBAL_GET("application/config/quit_on_go_back"));
String appname = GLOBAL_GET("application/config/name");
appname = TranslationServer::get_singleton()->translate(appname);
#ifdef DEBUG_ENABLED
@@ -2855,53 +2877,18 @@ bool Main::start() {
// It can still be overridden by the user in a script.
DisplayServer::get_singleton()->window_set_min_size(Size2i(64, 64));
- bool snap_controls = GLOBAL_DEF("gui/common/snap_controls_to_pixels", true);
+ bool snap_controls = GLOBAL_GET("gui/common/snap_controls_to_pixels");
sml->get_root()->set_snap_controls_to_pixels(snap_controls);
- bool font_oversampling = GLOBAL_DEF("gui/fonts/dynamic_fonts/use_oversampling", true);
+ bool font_oversampling = GLOBAL_GET("gui/fonts/dynamic_fonts/use_oversampling");
sml->get_root()->set_use_font_oversampling(font_oversampling);
- int texture_filter = GLOBAL_DEF("rendering/textures/canvas_textures/default_texture_filter", 1);
- int texture_repeat = GLOBAL_DEF("rendering/textures/canvas_textures/default_texture_repeat", 0);
+ int texture_filter = GLOBAL_GET("rendering/textures/canvas_textures/default_texture_filter");
+ int texture_repeat = GLOBAL_GET("rendering/textures/canvas_textures/default_texture_repeat");
sml->get_root()->set_default_canvas_item_texture_filter(
Viewport::DefaultCanvasItemTextureFilter(texture_filter));
sml->get_root()->set_default_canvas_item_texture_repeat(
Viewport::DefaultCanvasItemTextureRepeat(texture_repeat));
-
- } else {
- GLOBAL_DEF_BASIC("display/window/stretch/mode", "disabled");
- ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/mode",
- PropertyInfo(Variant::STRING,
- "display/window/stretch/mode",
- PROPERTY_HINT_ENUM,
- "disabled,canvas_items,viewport"));
- GLOBAL_DEF_BASIC("display/window/stretch/aspect", "keep");
- 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,expand"));
- GLOBAL_DEF_BASIC("display/window/stretch/scale", 1.0);
- ProjectSettings::get_singleton()->set_custom_property_info("display/window/stretch/scale",
- PropertyInfo(Variant::FLOAT,
- "display/window/stretch/scale",
- PROPERTY_HINT_RANGE,
- "0.5,8.0,0.01"));
- 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));
- GLOBAL_DEF_BASIC("gui/common/snap_controls_to_pixels", true);
- GLOBAL_DEF_BASIC("gui/fonts/dynamic_fonts/use_oversampling", true);
-
- GLOBAL_DEF_BASIC("rendering/textures/canvas_textures/default_texture_filter", 1);
- ProjectSettings::get_singleton()->set_custom_property_info(
- "rendering/textures/canvas_textures/default_texture_filter",
- PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_filter", PROPERTY_HINT_ENUM,
- "Nearest,Linear,Linear Mipmap,Nearest Mipmap"));
- GLOBAL_DEF_BASIC("rendering/textures/canvas_textures/default_texture_repeat", 0);
- ProjectSettings::get_singleton()->set_custom_property_info(
- "rendering/textures/canvas_textures/default_texture_repeat",
- PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_repeat", PROPERTY_HINT_ENUM,
- "Disable,Enable,Mirror"));
}
#ifdef TOOLS_ENABLED
@@ -2970,7 +2957,7 @@ bool Main::start() {
Engine::get_singleton()->startup_benchmark_begin_measure("game_load");
// Load SSL Certificates from Project Settings (or builtin).
- Crypto::load_default_certificates(GLOBAL_DEF("network/tls/certificate_bundle_override", ""));
+ Crypto::load_default_certificates(GLOBAL_GET("network/tls/certificate_bundle_override"));
if (!game_path.is_empty()) {
Node *scene = nullptr;
@@ -2983,7 +2970,7 @@ bool Main::start() {
sml->add_current_scene(scene);
#ifdef MACOS_ENABLED
- String mac_iconpath = GLOBAL_DEF("application/config/macos_native_icon", "Variant()");
+ String mac_iconpath = GLOBAL_GET("application/config/macos_native_icon");
if (!mac_iconpath.is_empty()) {
DisplayServer::get_singleton()->set_native_icon(mac_iconpath);
hasicon = true;
@@ -2991,14 +2978,14 @@ bool Main::start() {
#endif
#ifdef WINDOWS_ENABLED
- String win_iconpath = GLOBAL_DEF("application/config/windows_native_icon", "Variant()");
+ String win_iconpath = GLOBAL_GET("application/config/windows_native_icon");
if (!win_iconpath.is_empty()) {
DisplayServer::get_singleton()->set_native_icon(win_iconpath);
hasicon = true;
}
#endif
- String iconpath = GLOBAL_DEF("application/config/icon", "Variant()");
+ String iconpath = GLOBAL_GET("application/config/icon");
if ((!iconpath.is_empty()) && (!hasicon)) {
Ref<Image> icon;
icon.instantiate();