|
@@ -816,10 +816,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|
|
|
|
|
String bp = breakpoints[i];
|
|
String bp = breakpoints[i];
|
|
int sp = bp.find_last(":");
|
|
int sp = bp.find_last(":");
|
|
- if (sp == -1) {
|
|
|
|
- ERR_EXPLAIN("Invalid breakpoint: '" + bp + "', expected file:line format.");
|
|
|
|
- ERR_CONTINUE(true);
|
|
|
|
- }
|
|
|
|
|
|
+ ERR_CONTINUE_MSG(sp == -1, "Invalid breakpoint: '" + bp + "', expected file:line format.");
|
|
|
|
|
|
script_debugger->insert_breakpoint(bp.substr(sp + 1, bp.length()).to_int(), bp.substr(0, sp));
|
|
script_debugger->insert_breakpoint(bp.substr(sp + 1, bp.length()).to_int(), bp.substr(0, sp));
|
|
}
|
|
}
|
|
@@ -1375,10 +1372,7 @@ bool Main::start() {
|
|
|
|
|
|
{
|
|
{
|
|
DirAccessRef da = DirAccess::open(doc_tool);
|
|
DirAccessRef da = DirAccess::open(doc_tool);
|
|
- if (!da) {
|
|
|
|
- ERR_EXPLAIN("Argument supplied to --doctool must be a base Godot build directory");
|
|
|
|
- ERR_FAIL_V(false);
|
|
|
|
- }
|
|
|
|
|
|
+ ERR_FAIL_COND_V_MSG(!da, false, "Argument supplied to --doctool must be a base Godot build directory.");
|
|
}
|
|
}
|
|
DocData doc;
|
|
DocData doc;
|
|
doc.generate(doc_base);
|
|
doc.generate(doc_base);
|
|
@@ -1462,8 +1456,7 @@ bool Main::start() {
|
|
} else if (script != "") {
|
|
} else if (script != "") {
|
|
|
|
|
|
Ref<Script> script_res = ResourceLoader::load(script);
|
|
Ref<Script> script_res = ResourceLoader::load(script);
|
|
- ERR_EXPLAIN("Can't load script: " + script);
|
|
|
|
- ERR_FAIL_COND_V(script_res.is_null(), false);
|
|
|
|
|
|
+ ERR_FAIL_COND_V_MSG(script_res.is_null(), false, "Can't load script: " + script);
|
|
|
|
|
|
if (check_only) {
|
|
if (check_only) {
|
|
return false;
|
|
return false;
|
|
@@ -1477,8 +1470,7 @@ bool Main::start() {
|
|
if (!script_loop) {
|
|
if (!script_loop) {
|
|
if (obj)
|
|
if (obj)
|
|
memdelete(obj);
|
|
memdelete(obj);
|
|
- ERR_EXPLAIN("Can't load script '" + script + "', it does not inherit from a MainLoop type");
|
|
|
|
- ERR_FAIL_V(false);
|
|
|
|
|
|
+ ERR_FAIL_V_MSG(false, "Can't load script '" + script + "', it does not inherit from a MainLoop type.");
|
|
}
|
|
}
|
|
|
|
|
|
script_loop->set_init_script(script_res);
|
|
script_loop->set_init_script(script_res);
|
|
@@ -1502,17 +1494,13 @@ bool Main::start() {
|
|
} else {
|
|
} else {
|
|
|
|
|
|
Object *ml = ClassDB::instance(main_loop_type);
|
|
Object *ml = ClassDB::instance(main_loop_type);
|
|
- if (!ml) {
|
|
|
|
- ERR_EXPLAIN("Can't instance MainLoop type");
|
|
|
|
- ERR_FAIL_V(false);
|
|
|
|
- }
|
|
|
|
|
|
+ ERR_FAIL_COND_V_MSG(!ml, false, "Can't instance MainLoop type.");
|
|
|
|
|
|
main_loop = Object::cast_to<MainLoop>(ml);
|
|
main_loop = Object::cast_to<MainLoop>(ml);
|
|
if (!main_loop) {
|
|
if (!main_loop) {
|
|
|
|
|
|
memdelete(ml);
|
|
memdelete(ml);
|
|
- ERR_EXPLAIN("Invalid MainLoop type");
|
|
|
|
- ERR_FAIL_V(false);
|
|
|
|
|
|
+ ERR_FAIL_V_MSG(false, "Invalid MainLoop type.");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1575,8 +1563,7 @@ bool Main::start() {
|
|
}
|
|
}
|
|
|
|
|
|
RES res = ResourceLoader::load(path);
|
|
RES res = ResourceLoader::load(path);
|
|
- ERR_EXPLAIN("Can't autoload: " + path);
|
|
|
|
- ERR_CONTINUE(res.is_null());
|
|
|
|
|
|
+ ERR_CONTINUE_MSG(res.is_null(), "Can't autoload: " + path);
|
|
Node *n = NULL;
|
|
Node *n = NULL;
|
|
if (res->is_class("PackedScene")) {
|
|
if (res->is_class("PackedScene")) {
|
|
Ref<PackedScene> ps = res;
|
|
Ref<PackedScene> ps = res;
|
|
@@ -1585,20 +1572,17 @@ bool Main::start() {
|
|
Ref<Script> script_res = res;
|
|
Ref<Script> script_res = res;
|
|
StringName ibt = script_res->get_instance_base_type();
|
|
StringName ibt = script_res->get_instance_base_type();
|
|
bool valid_type = ClassDB::is_parent_class(ibt, "Node");
|
|
bool valid_type = ClassDB::is_parent_class(ibt, "Node");
|
|
- ERR_EXPLAIN("Script does not inherit a Node: " + path);
|
|
|
|
- ERR_CONTINUE(!valid_type);
|
|
|
|
|
|
+ ERR_CONTINUE_MSG(!valid_type, "Script does not inherit a Node: " + path);
|
|
|
|
|
|
Object *obj = ClassDB::instance(ibt);
|
|
Object *obj = ClassDB::instance(ibt);
|
|
|
|
|
|
- ERR_EXPLAIN("Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt));
|
|
|
|
- ERR_CONTINUE(obj == NULL);
|
|
|
|
|
|
+ ERR_CONTINUE_MSG(obj == NULL, "Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt));
|
|
|
|
|
|
n = Object::cast_to<Node>(obj);
|
|
n = Object::cast_to<Node>(obj);
|
|
n->set_script(script_res.get_ref_ptr());
|
|
n->set_script(script_res.get_ref_ptr());
|
|
}
|
|
}
|
|
|
|
|
|
- ERR_EXPLAIN("Path in autoload not a node or script: " + path);
|
|
|
|
- ERR_CONTINUE(!n);
|
|
|
|
|
|
+ ERR_CONTINUE_MSG(!n, "Path in autoload not a node or script: " + path);
|
|
n->set_name(name);
|
|
n->set_name(name);
|
|
|
|
|
|
//defer so references are all valid on _ready()
|
|
//defer so references are all valid on _ready()
|
|
@@ -1756,7 +1740,7 @@ bool Main::start() {
|
|
|
|
|
|
if (!project_manager && !editor) { // game
|
|
if (!project_manager && !editor) { // game
|
|
|
|
|
|
- // Load SSL Certificates from Project Settings (or builtin)
|
|
|
|
|
|
+ // Load SSL Certificates from Project Settings (or builtin).
|
|
StreamPeerSSL::load_certs_from_memory(StreamPeerSSL::get_project_cert_array());
|
|
StreamPeerSSL::load_certs_from_memory(StreamPeerSSL::get_project_cert_array());
|
|
|
|
|
|
if (game_path != "") {
|
|
if (game_path != "") {
|
|
@@ -1765,8 +1749,7 @@ bool Main::start() {
|
|
if (scenedata.is_valid())
|
|
if (scenedata.is_valid())
|
|
scene = scenedata->instance();
|
|
scene = scenedata->instance();
|
|
|
|
|
|
- ERR_EXPLAIN("Failed loading scene: " + local_game_path);
|
|
|
|
- ERR_FAIL_COND_V(!scene, false);
|
|
|
|
|
|
+ ERR_FAIL_COND_V_MSG(!scene, false, "Failed loading scene: " + local_game_path);
|
|
sml->add_current_scene(scene);
|
|
sml->add_current_scene(scene);
|
|
|
|
|
|
#ifdef OSX_ENABLED
|
|
#ifdef OSX_ENABLED
|
|
@@ -1810,14 +1793,14 @@ bool Main::start() {
|
|
}
|
|
}
|
|
|
|
|
|
if (project_manager || editor) {
|
|
if (project_manager || editor) {
|
|
- // Load SSL Certificates from Editor Settings (or builtin)
|
|
|
|
|
|
+ // Load SSL Certificates from Editor Settings (or builtin).
|
|
String certs = EditorSettings::get_singleton()->get_setting("network/ssl/editor_ssl_certificates").operator String();
|
|
String certs = EditorSettings::get_singleton()->get_setting("network/ssl/editor_ssl_certificates").operator String();
|
|
if (certs != "")
|
|
if (certs != "")
|
|
StreamPeerSSL::load_certs_from_file(certs);
|
|
StreamPeerSSL::load_certs_from_file(certs);
|
|
else
|
|
else
|
|
StreamPeerSSL::load_certs_from_memory(StreamPeerSSL::get_project_cert_array());
|
|
StreamPeerSSL::load_certs_from_memory(StreamPeerSSL::get_project_cert_array());
|
|
|
|
|
|
- // Hide console window if requested (Windows-only)
|
|
|
|
|
|
+ // Hide console window if requested (Windows-only).
|
|
bool hide_console = EditorSettings::get_singleton()->get_setting("interface/editor/hide_console_window");
|
|
bool hide_console = EditorSettings::get_singleton()->get_setting("interface/editor/hide_console_window");
|
|
OS::get_singleton()->set_console_visible(!hide_console);
|
|
OS::get_singleton()->set_console_visible(!hide_console);
|
|
}
|
|
}
|
|
@@ -1854,7 +1837,7 @@ bool Main::is_iterating() {
|
|
return iterating > 0;
|
|
return iterating > 0;
|
|
}
|
|
}
|
|
|
|
|
|
-// For performance metrics
|
|
|
|
|
|
+// For performance metrics.
|
|
static uint64_t physics_process_max = 0;
|
|
static uint64_t physics_process_max = 0;
|
|
static uint64_t idle_process_max = 0;
|
|
static uint64_t idle_process_max = 0;
|
|
|
|
|