summaryrefslogtreecommitdiff
path: root/main/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main/main.cpp')
-rw-r--r--main/main.cpp267
1 files changed, 70 insertions, 197 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 386be0e2b1..5736aedfe5 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -179,7 +179,7 @@ static DisplayServer::VSyncMode window_vsync_mode = DisplayServer::VSYNC_ENABLED
static uint32_t window_flags = 0;
static Size2i window_size = Size2i(1152, 648);
-static int init_screen = -1;
+static int init_screen = DisplayServer::SCREEN_PRIMARY;
static bool init_fullscreen = false;
static bool init_maximized = false;
static bool init_windowed = false;
@@ -377,7 +377,8 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" -w, --windowed Request windowed mode.\n");
OS::get_singleton()->print(" -t, --always-on-top Request an always-on-top window.\n");
OS::get_singleton()->print(" --resolution <W>x<H> Request window resolution.\n");
- OS::get_singleton()->print(" --position <X>,<Y> Request window position.\n");
+ OS::get_singleton()->print(" --position <X>,<Y> Request window position (if set, screen argument is ignored).\n");
+ OS::get_singleton()->print(" --screen <N> Request window screen.\n");
OS::get_singleton()->print(" --single-window Use a single window (no separate subwindows).\n");
OS::get_singleton()->print(" --xr-mode <mode> Select XR (Extended Reality) mode ['default', 'off', 'on'].\n");
OS::get_singleton()->print("\n");
@@ -959,6 +960,17 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
goto error;
}
+ } else if (I->get() == "--screen") { // set window screen
+
+ if (I->next()) {
+ init_screen = I->next()->get().to_int();
+
+ N = I->next()->next();
+ } else {
+ OS::get_singleton()->print("Missing screen argument, aborting.\n");
+ goto error;
+ }
+
} else if (I->get() == "--position") { // set window position
if (I->next()) {
@@ -1359,35 +1371,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
ResourceUID::get_singleton()->load_from_cache(); // load UUIDs from cache.
- ProjectSettings::get_singleton()->set_custom_property_info("memory/limits/multithreaded_server/rid_pool_prealloc",
- PropertyInfo(Variant::INT,
- "memory/limits/multithreaded_server/rid_pool_prealloc",
- PROPERTY_HINT_RANGE,
- "0,500,1")); // No negative and limit to 500 due to crashes
- GLOBAL_DEF("network/limits/debugger/max_chars_per_second", 32768);
- ProjectSettings::get_singleton()->set_custom_property_info("network/limits/debugger/max_chars_per_second",
- PropertyInfo(Variant::INT,
- "network/limits/debugger/max_chars_per_second",
- PROPERTY_HINT_RANGE,
- "0, 4096, 1, or_greater"));
- GLOBAL_DEF("network/limits/debugger/max_queued_messages", 2048);
- ProjectSettings::get_singleton()->set_custom_property_info("network/limits/debugger/max_queued_messages",
- PropertyInfo(Variant::INT,
- "network/limits/debugger/max_queued_messages",
- PROPERTY_HINT_RANGE,
- "0, 8192, 1, or_greater"));
- GLOBAL_DEF("network/limits/debugger/max_errors_per_second", 400);
- ProjectSettings::get_singleton()->set_custom_property_info("network/limits/debugger/max_errors_per_second",
- PropertyInfo(Variant::INT,
- "network/limits/debugger/max_errors_per_second",
- PROPERTY_HINT_RANGE,
- "0, 200, 1, or_greater"));
- GLOBAL_DEF("network/limits/debugger/max_warnings_per_second", 400);
- ProjectSettings::get_singleton()->set_custom_property_info("network/limits/debugger/max_warnings_per_second",
- PropertyInfo(Variant::INT,
- "network/limits/debugger/max_warnings_per_second",
- PROPERTY_HINT_RANGE,
- "0, 200, 1, or_greater"));
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "network/limits/debugger/max_chars_per_second", PROPERTY_HINT_RANGE, "0, 4096, 1, or_greater"), 32768);
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "network/limits/debugger/max_queued_messages", PROPERTY_HINT_RANGE, "0, 8192, 1, or_greater"), 2048);
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "network/limits/debugger/max_errors_per_second", PROPERTY_HINT_RANGE, "0, 200, 1, or_greater"), 400);
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "network/limits/debugger/max_warnings_per_second", PROPERTY_HINT_RANGE, "0, 200, 1, or_greater"), 400);
EngineDebugger::initialize(debug_uri, skip_breakpoints, breakpoints, []() {
if (editor_pid) {
@@ -1424,12 +1411,8 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
// are disabled while in the editor (even if they should logically apply).
GLOBAL_DEF("debug/file_logging/enable_file_logging.pc", true);
GLOBAL_DEF("debug/file_logging/log_path", "user://logs/godot.log");
- GLOBAL_DEF("debug/file_logging/max_log_files", 5);
- ProjectSettings::get_singleton()->set_custom_property_info("debug/file_logging/max_log_files",
- PropertyInfo(Variant::INT,
- "debug/file_logging/max_log_files",
- PROPERTY_HINT_RANGE,
- "0,20,1,or_greater")); //no negative numbers
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "debug/file_logging/max_log_files", PROPERTY_HINT_RANGE, "0,20,1,or_greater"), 5);
+
if (!project_manager && !editor && FileAccess::get_create_func(FileAccess::ACCESS_USERDATA) &&
GLOBAL_GET("debug/file_logging/enable_file_logging")) {
// Don't create logs for the project manager as they would be written to
@@ -1485,21 +1468,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
// For now everything defaults to vulkan when available. This can change in future updates.
GLOBAL_DEF("rendering/rendering_device/driver", default_driver);
- GLOBAL_DEF("rendering/rendering_device/driver.windows", default_driver);
- ProjectSettings::get_singleton()->set_custom_property_info("rendering/rendering_device/driver.windows",
- PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.windows", PROPERTY_HINT_ENUM, driver_hints));
- GLOBAL_DEF("rendering/rendering_device/driver.linuxbsd", default_driver);
- ProjectSettings::get_singleton()->set_custom_property_info("rendering/rendering_device/driver.linuxbsd",
- PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.linuxbsd", PROPERTY_HINT_ENUM, driver_hints));
- GLOBAL_DEF("rendering/rendering_device/driver.android", default_driver);
- ProjectSettings::get_singleton()->set_custom_property_info("rendering/rendering_device/driver.android",
- PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.android", PROPERTY_HINT_ENUM, driver_hints));
- GLOBAL_DEF("rendering/rendering_device/driver.ios", default_driver);
- ProjectSettings::get_singleton()->set_custom_property_info("rendering/rendering_device/driver.ios",
- PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.ios", PROPERTY_HINT_ENUM, driver_hints));
- GLOBAL_DEF("rendering/rendering_device/driver.macos", default_driver);
- ProjectSettings::get_singleton()->set_custom_property_info("rendering/rendering_device/driver.macos",
- PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.macos", PROPERTY_HINT_ENUM, driver_hints));
+ GLOBAL_DEF(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.windows", PROPERTY_HINT_ENUM, driver_hints), default_driver);
+ GLOBAL_DEF(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.linuxbsd", PROPERTY_HINT_ENUM, driver_hints), default_driver);
+ GLOBAL_DEF(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.android", PROPERTY_HINT_ENUM, driver_hints), default_driver);
+ GLOBAL_DEF(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.ios", PROPERTY_HINT_ENUM, driver_hints), default_driver);
+ GLOBAL_DEF(PropertyInfo(Variant::STRING, "rendering/rendering_device/driver.macos", PROPERTY_HINT_ENUM, driver_hints), default_driver);
driver_hints = "";
#ifdef GLES3_ENABLED
@@ -1509,24 +1482,12 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
default_driver = driver_hints.get_slice(",", 0);
GLOBAL_DEF("rendering/gl_compatibility/driver", default_driver);
- GLOBAL_DEF("rendering/gl_compatibility/driver.windows", default_driver);
- ProjectSettings::get_singleton()->set_custom_property_info("rendering/gl_compatibility/driver.windows",
- PropertyInfo(Variant::STRING, "rendering/gl_compatibility/driver.windows", PROPERTY_HINT_ENUM, driver_hints));
- GLOBAL_DEF("rendering/gl_compatibility/driver.linuxbsd", default_driver);
- ProjectSettings::get_singleton()->set_custom_property_info("rendering/gl_compatibility/driver.linuxbsd",
- PropertyInfo(Variant::STRING, "rendering/gl_compatibility/driver.linuxbsd", PROPERTY_HINT_ENUM, driver_hints));
- GLOBAL_DEF("rendering/gl_compatibility/driver.web", default_driver);
- ProjectSettings::get_singleton()->set_custom_property_info("rendering/gl_compatibility/driver.web",
- PropertyInfo(Variant::STRING, "rendering/gl_compatibility/driver.web", PROPERTY_HINT_ENUM, driver_hints));
- GLOBAL_DEF("rendering/gl_compatibility/driver.android", default_driver);
- ProjectSettings::get_singleton()->set_custom_property_info("rendering/gl_compatibility/driver.android",
- PropertyInfo(Variant::STRING, "rendering/gl_compatibility/driver.android", PROPERTY_HINT_ENUM, driver_hints));
- GLOBAL_DEF("rendering/gl_compatibility/driver.ios", default_driver);
- ProjectSettings::get_singleton()->set_custom_property_info("rendering/gl_compatibility/driver.ios",
- PropertyInfo(Variant::STRING, "rendering/gl_compatibility/driver.ios", PROPERTY_HINT_ENUM, driver_hints));
- GLOBAL_DEF("rendering/gl_compatibility/driver.macos", default_driver);
- ProjectSettings::get_singleton()->set_custom_property_info("rendering/gl_compatibility/driver.macos",
- PropertyInfo(Variant::STRING, "rendering/gl_compatibility/driver.macos", PROPERTY_HINT_ENUM, driver_hints));
+ GLOBAL_DEF(PropertyInfo(Variant::STRING, "rendering/gl_compatibility/driver.windows", PROPERTY_HINT_ENUM, driver_hints), default_driver);
+ GLOBAL_DEF(PropertyInfo(Variant::STRING, "rendering/gl_compatibility/driver.linuxbsd", PROPERTY_HINT_ENUM, driver_hints), default_driver);
+ GLOBAL_DEF(PropertyInfo(Variant::STRING, "rendering/gl_compatibility/driver.web", PROPERTY_HINT_ENUM, driver_hints), default_driver);
+ GLOBAL_DEF(PropertyInfo(Variant::STRING, "rendering/gl_compatibility/driver.android", PROPERTY_HINT_ENUM, driver_hints), default_driver);
+ GLOBAL_DEF(PropertyInfo(Variant::STRING, "rendering/gl_compatibility/driver.ios", PROPERTY_HINT_ENUM, driver_hints), default_driver);
+ GLOBAL_DEF(PropertyInfo(Variant::STRING, "rendering/gl_compatibility/driver.macos", PROPERTY_HINT_ENUM, driver_hints), default_driver);
}
// Start with RenderingDevice-based backends. Should be included if any RD driver present.
@@ -1646,15 +1607,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
default_renderer = renderer_hints.get_slice(",", 0);
- GLOBAL_DEF_RST_BASIC("rendering/renderer/rendering_method", default_renderer);
+ GLOBAL_DEF_RST_BASIC(PropertyInfo(Variant::STRING, "rendering/renderer/rendering_method", PROPERTY_HINT_ENUM, renderer_hints), default_renderer);
GLOBAL_DEF_RST_BASIC("rendering/renderer/rendering_method.mobile", default_renderer_mobile);
GLOBAL_DEF_RST_BASIC("rendering/renderer/rendering_method.web", "gl_compatibility"); // This is a bit of a hack until we have WebGPU support.
- ProjectSettings::get_singleton()->set_custom_property_info("rendering/renderer/rendering_method",
- PropertyInfo(Variant::STRING,
- "rendering/renderer/rendering_method",
- PROPERTY_HINT_ENUM, renderer_hints));
-
// Default to ProjectSettings default if nothing set on the command line.
if (rendering_method.is_empty()) {
rendering_method = GLOBAL_GET("rendering/renderer/rendering_method");
@@ -1714,6 +1670,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
window_flags |= DisplayServer::WINDOW_FLAG_NO_FOCUS_BIT;
}
window_mode = (DisplayServer::WindowMode)(GLOBAL_GET("display/window/size/mode").operator int());
+ init_screen = GLOBAL_GET("display/window/size/initial_screen").operator int();
}
GLOBAL_DEF("internationalization/locale/include_text_server_data", false);
@@ -1795,22 +1752,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
window_vsync_mode = DisplayServer::VSyncMode::VSYNC_DISABLED;
}
}
- Engine::get_singleton()->set_physics_ticks_per_second(GLOBAL_DEF_BASIC("physics/common/physics_ticks_per_second", 60));
- ProjectSettings::get_singleton()->set_custom_property_info("physics/common/physics_ticks_per_second",
- PropertyInfo(Variant::INT, "physics/common/physics_ticks_per_second",
- PROPERTY_HINT_RANGE, "1,1000,1"));
-
- Engine::get_singleton()->set_max_physics_steps_per_frame(GLOBAL_DEF("physics/common/max_physics_steps_per_frame", 8));
- ProjectSettings::get_singleton()->set_custom_property_info("physics/common/max_physics_steps_per_frame",
- PropertyInfo(Variant::INT, "physics/common/max_physics_steps_per_frame",
- PROPERTY_HINT_RANGE, "1,100,1"));
-
+ Engine::get_singleton()->set_physics_ticks_per_second(GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "physics/common/physics_ticks_per_second", PROPERTY_HINT_RANGE, "1,1000,1"), 60));
+ Engine::get_singleton()->set_max_physics_steps_per_frame(GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "physics/common/max_physics_steps_per_frame", PROPERTY_HINT_RANGE, "1,100,1"), 8));
Engine::get_singleton()->set_physics_jitter_fix(GLOBAL_DEF("physics/common/physics_jitter_fix", 0.5));
- Engine::get_singleton()->set_max_fps(GLOBAL_DEF("application/run/max_fps", 0));
- ProjectSettings::get_singleton()->set_custom_property_info("application/run/max_fps",
- PropertyInfo(Variant::INT,
- "application/run/max_fps",
- PROPERTY_HINT_RANGE, "0,1000,1"));
+ Engine::get_singleton()->set_max_fps(GLOBAL_DEF(PropertyInfo(Variant::INT, "application/run/max_fps", PROPERTY_HINT_RANGE, "0,1000,1"), 0));
GLOBAL_DEF("debug/settings/stdout/print_fps", false);
GLOBAL_DEF("debug/settings/stdout/print_gpu_profile", false);
@@ -1821,46 +1766,25 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
if (frame_delay == 0) {
- frame_delay = GLOBAL_DEF("application/run/frame_delay_msec", 0);
- ProjectSettings::get_singleton()->set_custom_property_info("application/run/frame_delay_msec",
- PropertyInfo(Variant::INT,
- "application/run/frame_delay_msec",
- PROPERTY_HINT_RANGE,
- "0,100,1,or_greater")); // No negative numbers
+ frame_delay = GLOBAL_DEF(PropertyInfo(Variant::INT, "application/run/frame_delay_msec", PROPERTY_HINT_RANGE, "0,100,1,or_greater"), 0);
}
OS::get_singleton()->set_low_processor_usage_mode(GLOBAL_DEF("application/run/low_processor_mode", false));
OS::get_singleton()->set_low_processor_usage_mode_sleep_usec(
- GLOBAL_DEF("application/run/low_processor_mode_sleep_usec", 6900)); // Roughly 144 FPS
- ProjectSettings::get_singleton()->set_custom_property_info("application/run/low_processor_mode_sleep_usec",
- PropertyInfo(Variant::INT,
- "application/run/low_processor_mode_sleep_usec",
- PROPERTY_HINT_RANGE,
- "0,33200,1,or_greater")); // No negative numbers
+ GLOBAL_DEF(PropertyInfo(Variant::INT, "application/run/low_processor_mode_sleep_usec", PROPERTY_HINT_RANGE, "0,33200,1,or_greater"), 6900)); // Roughly 144 FPS
GLOBAL_DEF("display/window/ios/allow_high_refresh_rate", true);
GLOBAL_DEF("display/window/ios/hide_home_indicator", true);
GLOBAL_DEF("display/window/ios/hide_status_bar", true);
GLOBAL_DEF("display/window/ios/suppress_ui_gesture", true);
- GLOBAL_DEF("input_devices/pointing/ios/touch_delay", 0.15);
- ProjectSettings::get_singleton()->set_custom_property_info("input_devices/pointing/ios/touch_delay",
- PropertyInfo(Variant::FLOAT,
- "input_devices/pointing/ios/touch_delay",
- PROPERTY_HINT_RANGE, "0,1,0.001"));
+ GLOBAL_DEF(PropertyInfo(Variant::FLOAT, "input_devices/pointing/ios/touch_delay", PROPERTY_HINT_RANGE, "0,1,0.001"), 0.15);
// XR project settings.
GLOBAL_DEF_RST_BASIC("xr/openxr/enabled", false);
- GLOBAL_DEF_BASIC("xr/openxr/default_action_map", "res://openxr_action_map.tres");
- ProjectSettings::get_singleton()->set_custom_property_info("xr/openxr/default_action_map", PropertyInfo(Variant::STRING, "xr/openxr/default_action_map", PROPERTY_HINT_FILE, "*.tres"));
-
- GLOBAL_DEF_BASIC("xr/openxr/form_factor", "0");
- ProjectSettings::get_singleton()->set_custom_property_info("xr/openxr/form_factor", PropertyInfo(Variant::INT, "xr/openxr/form_factor", PROPERTY_HINT_ENUM, "Head Mounted,Handheld"));
-
- GLOBAL_DEF_BASIC("xr/openxr/view_configuration", "1");
- ProjectSettings::get_singleton()->set_custom_property_info("xr/openxr/view_configuration", PropertyInfo(Variant::INT, "xr/openxr/view_configuration", PROPERTY_HINT_ENUM, "Mono,Stereo")); // "Mono,Stereo,Quad,Observer"
-
- GLOBAL_DEF_BASIC("xr/openxr/reference_space", "1");
- ProjectSettings::get_singleton()->set_custom_property_info("xr/openxr/reference_space", PropertyInfo(Variant::INT, "xr/openxr/reference_space", PROPERTY_HINT_ENUM, "Local,Stage"));
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "xr/openxr/default_action_map", PROPERTY_HINT_FILE, "*.tres"), "res://openxr_action_map.tres");
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "xr/openxr/form_factor", PROPERTY_HINT_ENUM, "Head Mounted,Handheld"), "0");
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "xr/openxr/view_configuration", PROPERTY_HINT_ENUM, "Mono,Stereo"), "1"); // "Mono,Stereo,Quad,Observer"
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "xr/openxr/reference_space", PROPERTY_HINT_ENUM, "Local,Stage"), "1");
GLOBAL_DEF_BASIC("xr/openxr/submit_depth_buffer", false);
@@ -1998,7 +1922,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
// rendering_driver now held in static global String in main and initialized in setup()
Error err;
- display_server = DisplayServer::create(display_driver_idx, rendering_driver, window_mode, window_vsync_mode, window_flags, window_position, window_size, err);
+ display_server = DisplayServer::create(display_driver_idx, rendering_driver, window_mode, window_vsync_mode, window_flags, window_position, window_size, init_screen, err);
if (err != OK || display_server == nullptr) {
// We can't use this display server, try other ones as fallback.
// Skip headless (always last registered) because that's not what users
@@ -2007,7 +1931,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
if (i == display_driver_idx) {
continue; // Don't try the same twice.
}
- display_server = DisplayServer::create(i, rendering_driver, window_mode, window_vsync_mode, window_flags, window_position, window_size, err);
+ display_server = DisplayServer::create(i, rendering_driver, window_mode, window_vsync_mode, window_flags, window_position, window_size, init_screen, err);
if (err == OK && display_server != nullptr) {
break;
}
@@ -2046,8 +1970,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
{
GLOBAL_DEF_RST_NOVAL("input_devices/pen_tablet/driver", "");
- GLOBAL_DEF_RST_NOVAL("input_devices/pen_tablet/driver.windows", "");
- ProjectSettings::get_singleton()->set_custom_property_info("input_devices/pen_tablet/driver.windows", PropertyInfo(Variant::STRING, "input_devices/pen_tablet/driver.windows", PROPERTY_HINT_ENUM, "wintab,winink"));
+ GLOBAL_DEF_RST_NOVAL(PropertyInfo(Variant::STRING, "input_devices/pen_tablet/driver.windows", PROPERTY_HINT_ENUM, "wintab,winink"), "");
}
if (tablet_driver.is_empty()) { // specified in project.godot
@@ -2105,10 +2028,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
print_line(" "); //add a blank line for readability
- if (init_use_custom_pos) {
- display_server->window_set_position(init_custom_pos);
- }
-
// right moment to create and initialize the audio server
audio_server = memnew(AudioServer);
@@ -2127,9 +2046,6 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
bool show_logo = true;
#endif
- if (init_screen != -1) {
- DisplayServer::get_singleton()->window_set_current_screen(init_screen);
- }
if (init_windowed) {
//do none..
} else if (init_maximized) {
@@ -2148,13 +2064,9 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
if (show_logo) { //boot logo!
const bool boot_logo_image = GLOBAL_DEF_BASIC("application/boot_splash/show_image", true);
- const String boot_logo_path = String(GLOBAL_DEF_BASIC("application/boot_splash/image", String())).strip_edges();
+ const String boot_logo_path = String(GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "application/boot_splash/image", PROPERTY_HINT_FILE, "*.png"), String())).strip_edges();
const bool boot_logo_scale = GLOBAL_DEF_BASIC("application/boot_splash/fullsize", true);
const bool boot_logo_filter = GLOBAL_DEF_BASIC("application/boot_splash/use_filter", true);
- 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;
@@ -2212,22 +2124,9 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
RenderingServer::get_singleton()->set_default_clear_color(
GLOBAL_GET("rendering/environment/defaults/default_clear_color"));
- GLOBAL_DEF("application/config/icon", String());
- ProjectSettings::get_singleton()->set_custom_property_info("application/config/icon",
- PropertyInfo(Variant::STRING, "application/config/icon",
- PROPERTY_HINT_FILE, "*.png,*.webp,*.svg"));
-
- GLOBAL_DEF("application/config/macos_native_icon", String());
- ProjectSettings::get_singleton()->set_custom_property_info("application/config/macos_native_icon",
- PropertyInfo(Variant::STRING,
- "application/config/macos_native_icon",
- PROPERTY_HINT_FILE, "*.icns"));
-
- GLOBAL_DEF("application/config/windows_native_icon", String());
- ProjectSettings::get_singleton()->set_custom_property_info("application/config/windows_native_icon",
- PropertyInfo(Variant::STRING,
- "application/config/windows_native_icon",
- PROPERTY_HINT_FILE, "*.ico"));
+ GLOBAL_DEF(PropertyInfo(Variant::STRING, "application/config/icon", PROPERTY_HINT_FILE, "*.png,*.webp,*.svg"), String());
+ GLOBAL_DEF(PropertyInfo(Variant::STRING, "application/config/macos_native_icon", PROPERTY_HINT_FILE, "*.icns"), String());
+ GLOBAL_DEF(PropertyInfo(Variant::STRING, "application/config/windows_native_icon", PROPERTY_HINT_FILE, "*.ico"), String());
Input *id = Input::get_singleton();
if (id) {
@@ -2272,7 +2171,7 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
}
text_driver_options += driver_name;
}
- ProjectSettings::get_singleton()->set_custom_property_info("internationalization/rendering/text_driver", PropertyInfo(Variant::STRING, "internationalization/rendering/text_driver", PROPERTY_HINT_ENUM, text_driver_options));
+ ProjectSettings::get_singleton()->set_custom_property_info(PropertyInfo(Variant::STRING, "internationalization/rendering/text_driver", PROPERTY_HINT_ENUM, text_driver_options));
/* Determine text driver */
if (text_driver.is_empty()) {
@@ -2341,13 +2240,9 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
initialize_theme_db();
register_scene_singletons();
- GLOBAL_DEF_BASIC("display/mouse_cursor/custom_image", String());
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "display/mouse_cursor/custom_image", PROPERTY_HINT_FILE, "*.png,*.webp"), String());
GLOBAL_DEF_BASIC("display/mouse_cursor/custom_image_hotspot", Vector2());
GLOBAL_DEF_BASIC("display/mouse_cursor/tooltip_position_offset", Point2(10, 10));
- 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(GLOBAL_GET("display/mouse_cursor/custom_image")) != String()) {
Ref<Texture2D> cursor = ResourceLoader::load(
@@ -2504,12 +2399,7 @@ bool Main::start() {
#endif
}
- uint64_t minimum_time_msec = GLOBAL_DEF("application/boot_splash/minimum_display_time", 0);
- ProjectSettings::get_singleton()->set_custom_property_info("application/boot_splash/minimum_display_time",
- PropertyInfo(Variant::INT,
- "application/boot_splash/minimum_display_time",
- PROPERTY_HINT_RANGE,
- "0,100,1,or_greater,suffix:ms")); // No negative numbers.
+ uint64_t minimum_time_msec = GLOBAL_DEF(PropertyInfo(Variant::INT, "application/boot_splash/minimum_display_time", PROPERTY_HINT_RANGE, "0,100,1,or_greater,suffix:ms"), 0);
#ifdef TOOLS_ENABLED
if (!doc_tool_path.is_empty()) {
@@ -2717,7 +2607,7 @@ bool Main::start() {
if (debug_navigation) {
sml->set_debug_navigation_hint(true);
NavigationServer3D::get_singleton()->set_active(true);
- NavigationServer3D::get_singleton_mut()->set_debug_enabled(true);
+ NavigationServer3D::get_singleton()->set_debug_enabled(true);
}
#endif
@@ -2823,39 +2713,16 @@ 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"));
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "display/window/stretch/mode", PROPERTY_HINT_ENUM, "disabled,canvas_items,viewport"), "disabled");
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::STRING, "display/window/stretch/aspect", PROPERTY_HINT_ENUM, "ignore,keep,keep_width,keep_height,expand"), "keep");
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::FLOAT, "display/window/stretch/scale", PROPERTY_HINT_RANGE, "0.5,8.0,0.01"), 1.0);
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"));
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_filter", PROPERTY_HINT_ENUM, "Nearest,Linear,Linear Mipmap,Nearest Mipmap"), 1);
+ GLOBAL_DEF_BASIC(PropertyInfo(Variant::INT, "rendering/textures/canvas_textures/default_texture_repeat", PROPERTY_HINT_ENUM, "Disable,Enable,Mirror"), 0);
if (!editor && !project_manager) {
//standard helpers that can be changed from main config
@@ -2902,10 +2769,6 @@ bool Main::start() {
DisplayServer::get_singleton()->window_set_title(appname);
#endif
- // Define a very small minimum window size to prevent bugs such as GH-37242.
- // 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_GET("gui/common/snap_controls_to_pixels");
sml->get_root()->set_snap_controls_to_pixels(snap_controls);
@@ -3101,6 +2964,7 @@ bool Main::is_iterating() {
// For performance metrics.
static uint64_t physics_process_max = 0;
static uint64_t process_max = 0;
+static uint64_t navigation_process_max = 0;
bool Main::iteration() {
//for now do not error on this
@@ -3129,6 +2993,7 @@ bool Main::iteration() {
uint64_t physics_process_ticks = 0;
uint64_t process_ticks = 0;
+ uint64_t navigation_process_ticks = 0;
frame += ticks_elapsed;
@@ -3165,7 +3030,13 @@ bool Main::iteration() {
break;
}
- NavigationServer3D::get_singleton_mut()->process(physics_step * time_scale);
+ NavigationServer3D::get_singleton()->process(physics_step * time_scale);
+ uint64_t navigation_begin = OS::get_singleton()->get_ticks_usec();
+
+ NavigationServer3D::get_singleton()->process(physics_step * time_scale);
+
+ navigation_process_ticks = MAX(navigation_process_ticks, OS::get_singleton()->get_ticks_usec() - navigation_begin); // keep the largest one for reference
+ navigation_process_max = MAX(OS::get_singleton()->get_ticks_usec() - navigation_begin, navigation_process_max);
message_queue->flush();
@@ -3245,8 +3116,10 @@ bool Main::iteration() {
Engine::get_singleton()->_fps = frames;
performance->set_process_time(USEC_TO_SEC(process_max));
performance->set_physics_process_time(USEC_TO_SEC(physics_process_max));
+ performance->set_navigation_process_time(USEC_TO_SEC(navigation_process_max));
process_max = 0;
physics_process_max = 0;
+ navigation_process_max = 0;
frame %= 1000000;
frames = 0;