summaryrefslogtreecommitdiff
path: root/main/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main/main.cpp')
-rw-r--r--main/main.cpp36
1 files changed, 32 insertions, 4 deletions
diff --git a/main/main.cpp b/main/main.cpp
index fb42f71a75..ad8e8dadfe 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -55,6 +55,7 @@
#include "main/splash.gen.h"
#include "main/splash_editor.gen.h"
#include "main/tests/test_main.h"
+#include "modules/modules_enabled.gen.h"
#include "modules/register_module_types.h"
#include "platform/register_platform_apis.h"
#include "scene/main/scene_tree.h"
@@ -1162,9 +1163,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
ProjectSettings::get_singleton()->set_custom_property_info("debug/settings/fps/force_fps", PropertyInfo(Variant::INT, "debug/settings/fps/force_fps", PROPERTY_HINT_RANGE, "0,120,1,or_greater"));
GLOBAL_DEF("debug/settings/stdout/print_fps", false);
+ GLOBAL_DEF("debug/settings/stdout/verbose_stdout", false);
- if (!OS::get_singleton()->_verbose_stdout) //overridden
- OS::get_singleton()->_verbose_stdout = GLOBAL_DEF("debug/settings/stdout/verbose_stdout", false);
+ if (!OS::get_singleton()->_verbose_stdout) { // Not manually overridden.
+ OS::get_singleton()->_verbose_stdout = GLOBAL_GET("debug/settings/stdout/verbose_stdout");
+ }
if (frame_delay == 0) {
frame_delay = GLOBAL_DEF("application/run/frame_delay_msec", 0);
@@ -1481,6 +1484,15 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
// We could add more, and make the CLI arg require a comma-separated list of profilers.
EngineDebugger::get_singleton()->profiler_enable("scripts", true);
}
+
+ if (!project_manager) {
+ // If not running the project manager, and now that the engine is
+ // able to load resources, load the global shader variables.
+ // If running on editor, dont load the textures because the editor
+ // may want to import them first. Editor will reload those later.
+ rendering_server->global_variables_load_settings(!editor);
+ }
+
_start_success = true;
locale = String();
@@ -1588,6 +1600,19 @@ bool Main::start() {
DirAccessRef da = DirAccess::open(doc_tool);
ERR_FAIL_COND_V_MSG(!da, false, "Argument supplied to --doctool must be a base Godot build directory.");
}
+
+#ifndef MODULE_MONO_ENABLED
+ // Hack to define Mono-specific project settings even on non-Mono builds,
+ // so that we don't lose their descriptions and default values in DocData.
+ // Default values should be synced with mono_gd/gd_mono.cpp.
+ GLOBAL_DEF("mono/debugger_agent/port", 23685);
+ GLOBAL_DEF("mono/debugger_agent/wait_for_debugger", false);
+ GLOBAL_DEF("mono/debugger_agent/wait_timeout", 3000);
+ GLOBAL_DEF("mono/profiler/args", "log:calls,alloc,sample,output=output.mlpd");
+ GLOBAL_DEF("mono/profiler/enabled", false);
+ GLOBAL_DEF("mono/unhandled_exception_policy", 0);
+#endif
+
DocData doc;
doc.generate(doc_base);
@@ -1675,7 +1700,7 @@ bool Main::start() {
return false;
}
- if (script_res->can_instance() /*&& script_res->inherits_from("SceneTreeScripted")*/) {
+ if (script_res->can_instance()) {
StringName instance_type = script_res->get_instance_base_type();
Object *obj = ClassDB::instance(instance_type);
@@ -1683,7 +1708,7 @@ bool Main::start() {
if (!script_loop) {
if (obj)
memdelete(obj);
- ERR_FAIL_V_MSG(false, "Can't load script '" + script + "', it does not inherit from a MainLoop type.");
+ ERR_FAIL_V_MSG(false, vformat("Can't load the script \"%s\" as it doesn't inherit from SceneTree or MainLoop.", script));
}
script_loop->set_init_script(script_res);
@@ -2280,6 +2305,9 @@ void Main::cleanup() {
// Sync pending commands that may have been queued from a different thread during ScriptServer finalization
RenderingServer::get_singleton()->sync();
+ //clear global shader variables before scene and other graphics stuff is deinitialized.
+ rendering_server->global_variables_clear();
+
#ifdef TOOLS_ENABLED
EditorNode::unregister_editor_types();
#endif