summaryrefslogtreecommitdiff
path: root/main/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main/main.cpp')
-rw-r--r--main/main.cpp340
1 files changed, 191 insertions, 149 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 14b6ac29ec..e00a482bde 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -110,7 +110,6 @@ static bool force_lowdpi = false;
static int init_screen = -1;
static bool use_vsync = true;
static bool editor = false;
-static bool show_help = false;
static String unescape_cmdline(const String &p_str) {
@@ -127,88 +126,63 @@ static String unescape_cmdline(const String &p_str) {
void Main::print_help(const char *p_binary) {
- OS::get_singleton()->print(VERSION_FULL_NAME " - https://godotengine.org\n");
- OS::get_singleton()->print("(c) 2007-2017 Juan Linietsky, Ariel Manzur.\n");
- OS::get_singleton()->print("(c) 2014-2017 Godot Engine contributors.\n");
- OS::get_singleton()->print("\n");
- OS::get_singleton()->print("Usage: %s [options] [path to scene or 'project.godot' file]\n", p_binary);
- OS::get_singleton()->print("\n");
-
- OS::get_singleton()->print("General options:\n");
- OS::get_singleton()->print(" -h, --help Display this help message.\n");
- OS::get_singleton()->print(" -v, --verbose Use verbose stdout mode.\n");
- OS::get_singleton()->print(" --quiet Quiet mode, silences stdout messages. Errors are still displayed.\n");
- OS::get_singleton()->print("\n");
-
- OS::get_singleton()->print("Run options:\n");
+ OS::get_singleton()->print(VERSION_FULL_NAME " (c) 2008-2017 Juan Linietsky, Ariel Manzur.\n");
+ OS::get_singleton()->print("Usage: %s [options] [scene]\n", p_binary);
+ OS::get_singleton()->print("Options:\n");
+ OS::get_singleton()->print("\t-path [dir] : Path to a game, containing project.godot\n");
#ifdef TOOLS_ENABLED
- OS::get_singleton()->print(" -e, --editor Start the editor instead of running the scene.\n");
- OS::get_singleton()->print(" -p, --project-manager Start the project manager, even if a project is auto-detected.\n");
+ OS::get_singleton()->print("\t-e,-editor : Bring up the editor instead of running the scene.\n");
#endif
- OS::get_singleton()->print(" -l, --language <locale> Use a specific locale (<locale> being a two-letter code).\n");
- OS::get_singleton()->print(" --path <directory> Path to a project (<directory> must contain a 'project.godot' file).\n");
- OS::get_singleton()->print(" --main-pack <file> Path to a pack (.pck) file to load.\n");
- OS::get_singleton()->print(" --render-thread <mode> Render thread mode ('unsafe', 'safe', 'separate').\n");
- OS::get_singleton()->print(" --remote-fs <address> Remote filesystem (<host/IP>[:<port>] address).\n");
- OS::get_singleton()->print(" --remote-fs-password <password> Password for remote filesystem.\n");
- OS::get_singleton()->print(" --audio-driver <driver> Audio driver (");
- for (int i = 0; i < OS::get_singleton()->get_audio_driver_count(); i++) {
- if (i != 0)
- OS::get_singleton()->print(", ");
- OS::get_singleton()->print("'%s'", OS::get_singleton()->get_audio_driver_name(i));
+ OS::get_singleton()->print("\t-test [test] : Run a test.\n");
+ OS::get_singleton()->print("\t\t(");
+ const char **test_names = tests_get_names();
+ const char *coma = "";
+ while (*test_names) {
+
+ OS::get_singleton()->print("%s%s", coma, *test_names);
+ test_names++;
+ coma = ", ";
}
- OS::get_singleton()->print(").\n");
- OS::get_singleton()->print(" --video-driver <driver> Video driver (");
+ OS::get_singleton()->print(")\n");
+
+ OS::get_singleton()->print("\t-r WIDTHxHEIGHT\t : Request Window Resolution\n");
+ OS::get_singleton()->print("\t-p XxY\t : Request Window Position\n");
+ OS::get_singleton()->print("\t-f\t\t : Request Fullscreen\n");
+ OS::get_singleton()->print("\t-mx\t\t Request Maximized\n");
+ OS::get_singleton()->print("\t-w\t\t Request Windowed\n");
+ OS::get_singleton()->print("\t-vd DRIVER\t : Video Driver (");
for (int i = 0; i < OS::get_singleton()->get_video_driver_count(); i++) {
+
if (i != 0)
OS::get_singleton()->print(", ");
- OS::get_singleton()->print("'%s'", OS::get_singleton()->get_video_driver_name(i));
+ OS::get_singleton()->print("%s", OS::get_singleton()->get_video_driver_name(i));
}
- OS::get_singleton()->print(").\n");
- OS::get_singleton()->print("\n");
-
- OS::get_singleton()->print("Display options:\n");
- OS::get_singleton()->print(" -f, --fullscreen Request fullscreen mode.\n");
- OS::get_singleton()->print(" -m, --maximized Request a maximized window.\n");
- OS::get_singleton()->print(" -w, --windowed Request windowed mode.\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(" --low-dpi Force low-DPI mode (macOS only).\n");
- OS::get_singleton()->print(" --no-window Disable window creation (Windows only). Useful together with --script.\n");
- OS::get_singleton()->print("\n");
-
- OS::get_singleton()->print("Debug options:\n");
- OS::get_singleton()->print(" -d, --debug Debug (local stdout debugger).\n");
- OS::get_singleton()->print(" -b, --breakpoints Breakpoint list as source::line comma-separated pairs, no spaces (use %%20, %%2C, etc. instead).\n");
- OS::get_singleton()->print(" --profiling Enable profiling in the script debugger.\n");
- OS::get_singleton()->print(" --remote-debug <address> Remote debug (<host/IP>:<port> address).\n");
-#ifdef DEBUG_ENABLED
- OS::get_singleton()->print(" --debug-collisions Show collisions shapes when running the scene.\n");
- OS::get_singleton()->print(" --debug-navigation Show navigation polygons when running the scene.\n");
-#endif
- OS::get_singleton()->print(" --frame-delay <ms> Simulate high CPU load (delay each frame by <ms> milliseconds).\n");
- OS::get_singleton()->print(" --time-scale <scale> Force time scale (higher values are faster, 1.0 is normal speed).\n");
- OS::get_singleton()->print("\n");
+ OS::get_singleton()->print(")\n");
+ OS::get_singleton()->print("\t-ldpi\t : Force low-dpi mode (OSX Only)\n");
- OS::get_singleton()->print("Standalone tools:\n");
- OS::get_singleton()->print(" -s, --script <script> Run a script.\n");
-#ifdef TOOLS_ENABLED
- OS::get_singleton()->print(" --export <target> Export the project using the given export target.\n");
- OS::get_singleton()->print(" --export-debug Use together with --export, enables debug mode for the template.\n");
- OS::get_singleton()->print(" --doctool <file> Dump the whole engine API to <file> in XML format. If <file> exists, it will be merged.\n");
- OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n");
-#ifdef DEBUG_METHODS_ENABLED
- OS::get_singleton()->print(" --gdnative-generate-json-api Generate JSON dump of the Godot API for GDNative bindings.\n");
-#endif
- OS::get_singleton()->print(" --test <test> Run a unit test (");
- const char **test_names = tests_get_names();
- const char *comma = "";
- while (*test_names) {
- OS::get_singleton()->print("%s'%s'", comma, *test_names);
- test_names++;
- comma = ", ";
+ OS::get_singleton()->print("\t-ad DRIVER\t : Audio Driver (");
+ for (int i = 0; i < OS::get_singleton()->get_audio_driver_count(); i++) {
+
+ if (i != 0)
+ OS::get_singleton()->print(", ");
+ OS::get_singleton()->print("%s", OS::get_singleton()->get_audio_driver_name(i));
}
- OS::get_singleton()->print(").\n");
+ OS::get_singleton()->print(")\n");
+ OS::get_singleton()->print("\t-rthread <mode>\t : Render Thread Mode ('unsafe', 'safe', 'separate').\n");
+ OS::get_singleton()->print("\t-s,-script [script] : Run a script.\n");
+ OS::get_singleton()->print("\t-d,-debug : Debug (local stdout debugger).\n");
+ OS::get_singleton()->print("\t-rdebug ADDRESS : Remote debug (<ip>:<port> host address).\n");
+ OS::get_singleton()->print("\t-fdelay [msec]: Simulate high CPU load (delay each frame by [msec]).\n");
+ OS::get_singleton()->print("\t-timescale [msec]: Simulate high CPU load (delay each frame by [msec]).\n");
+ OS::get_singleton()->print("\t-bp : breakpoint list as source::line comma separated pairs, no spaces (%%20,%%2C,etc instead).\n");
+ OS::get_singleton()->print("\t-v : Verbose stdout mode\n");
+ OS::get_singleton()->print("\t-lang [locale]: Use a specific locale\n");
+ OS::get_singleton()->print("\t-rfs <host/ip>[:<port>] : Remote FileSystem.\n");
+ OS::get_singleton()->print("\t-rfs_pass <password> : Password for Remote FileSystem.\n");
+#ifdef TOOLS_ENABLED
+ OS::get_singleton()->print("\t-doctool FILE: Dump the whole engine api to FILE in XML format. If FILE exists, it will be merged.\n");
+ OS::get_singleton()->print("\t-nodocbase: Disallow dump the base types (used with -doctool).\n");
+ OS::get_singleton()->print("\t-export [target] Export the project using given export target.\n");
#endif
}
@@ -278,6 +252,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
String remotefs;
String remotefs_pass;
+ String screen = "";
+
+ List<String> pack_list;
Vector<String> breakpoints;
bool use_custom_res = true;
bool force_res = false;
@@ -304,12 +281,14 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
List<String>::Element *N = I->next();
- if (I->get() == "-h" || I->get() == "--help" || I->get() == "/?") { // display help
+ if (I->get() == "-noop") {
+
+ // no op
+ } else if (I->get() == "-h" || I->get() == "--help" || I->get() == "/?") { // resolution
- show_help = true;
goto error;
- } else if (I->get() == "--resolution") { // force resolution
+ } else if (I->get() == "-r") { // resolution
if (I->next()) {
@@ -317,16 +296,16 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
if (vm.find("x") == -1) { // invalid parameter format
- OS::get_singleton()->print("Invalid resolution '%s', it should be e.g. '1280x720'.\n", vm.utf8().get_data());
+ OS::get_singleton()->print("Invalid -r argument: %s\n", vm.utf8().get_data());
goto error;
}
int w = vm.get_slice("x", 0).to_int();
int h = vm.get_slice("x", 1).to_int();
- if (w <= 0 || h <= 0) {
+ if (w == 0 || h == 0) {
- OS::get_singleton()->print("Invalid resolution '%s', width and height must be above 0.\n", vm.utf8().get_data());
+ OS::get_singleton()->print("Invalid -r resolution, x and y must be >0\n");
goto error;
}
@@ -336,86 +315,84 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
N = I->next()->next();
} else {
- OS::get_singleton()->print("Missing resolution argument, aborting.\n");
+ OS::get_singleton()->print("Invalid -p argument, needs resolution\n");
goto error;
}
- } else if (I->get() == "--position") { // set window position
+ } else if (I->get() == "-p") { // position
if (I->next()) {
String vm = I->next()->get();
- if (vm.find(",") == -1) { // invalid parameter format
+ if (vm.find("x") == -1) { // invalid parameter format
- OS::get_singleton()->print("Invalid position '%s', it should be e.g. '80,128'.\n", vm.utf8().get_data());
+ OS::get_singleton()->print("Invalid -p argument: %s\n", vm.utf8().get_data());
goto error;
}
- int x = vm.get_slice(",", 0).to_int();
- int y = vm.get_slice(",", 1).to_int();
+ int x = vm.get_slice("x", 0).to_int();
+ int y = vm.get_slice("x", 1).to_int();
init_custom_pos = Point2(x, y);
init_use_custom_pos = true;
N = I->next()->next();
} else {
- OS::get_singleton()->print("Missing position argument, aborting.\n");
+ OS::get_singleton()->print("Invalid -r argument, needs position\n");
goto error;
}
- } else if (I->get() == "-m" || I->get() == "--maximized") { // force maximized window
+ } else if (I->get() == "-mx") { // video driver
init_maximized = true;
- } else if (I->get() == "-w" || I->get() == "--windowed") { // force windowed window
+ } else if (I->get() == "-w") { // video driver
init_windowed = true;
- } else if (I->get() == "--profiling") { // enable profiling
+ } else if (I->get() == "-profile") { // video driver
use_debug_profiler = true;
- } else if (I->get() == "--video-driver") { // force video driver
+ } else if (I->get() == "-vd") { // video driver
if (I->next()) {
video_driver = I->next()->get();
N = I->next()->next();
} else {
- OS::get_singleton()->print("Missing video driver argument, aborting.\n");
+ OS::get_singleton()->print("Invalid -cd argument, needs driver name\n");
goto error;
}
- } else if (I->get() == "-l" || I->get() == "--language") { // language
+ } else if (I->get() == "-lang") { // language
if (I->next()) {
locale = I->next()->get();
N = I->next()->next();
} else {
- OS::get_singleton()->print("Missing language argument, aborting.\n");
+ OS::get_singleton()->print("Invalid -lang argument, needs language code\n");
goto error;
}
- } else if (I->get() == "--low-dpi") { // force low DPI (macOS only)
+ } else if (I->get() == "-ldpi") { // language
force_lowdpi = true;
- } else if (I->get() == "--remote-fs") { // remote filesystem
+ } else if (I->get() == "-rfs") { // language
if (I->next()) {
remotefs = I->next()->get();
N = I->next()->next();
} else {
- OS::get_singleton()->print("Missing remote filesystem address, aborting.\n");
goto error;
}
- } else if (I->get() == "--remote-fs-password") { // remote filesystem password
+ } else if (I->get() == "-rfs_pass") { // language
if (I->next()) {
remotefs_pass = I->next()->get();
N = I->next()->next();
} else {
- OS::get_singleton()->print("Missing remote filesystem password, aborting.\n");
goto error;
}
- } else if (I->get() == "--render-thread") { // render thread mode
+ } else if (I->get() == "-rthread") { // language
if (I->next()) {
@@ -428,37 +405,35 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
N = I->next()->next();
} else {
- OS::get_singleton()->print("Missing render thread mode argument, aborting.\n");
goto error;
}
- } else if (I->get() == "--audio-driver") { // audio driver
+ } else if (I->get() == "-ad") { // video driver
if (I->next()) {
audio_driver = I->next()->get();
N = I->next()->next();
} else {
- OS::get_singleton()->print("Missing audio driver argument, aborting.\n");
goto error;
}
- } else if (I->get() == "-f" || I->get() == "--fullscreen") { // force fullscreen
+ } else if (I->get() == "-f") { // fullscreen
//video_mode.fullscreen=false;
init_fullscreen = true;
- } else if (I->get() == "-e" || I->get() == "--editor") { // starts editor
+ } else if (I->get() == "-e" || I->get() == "-editor") { // fonud editor
editor = true;
- } else if (I->get() == "--no-window") { // disable window creation, Windows only
+ } else if (I->get() == "-nowindow") { // fullscreen
OS::get_singleton()->set_no_window_mode(true);
- } else if (I->get() == "--quiet") { // quieter output
+ } else if (I->get() == "-quiet") { // fullscreen
quiet_stdout = true;
- } else if (I->get() == "-v" || I->get() == "--verbose") { // verbose output
+ } else if (I->get() == "-v") { // fullscreen
OS::get_singleton()->_verbose_stdout = true;
- } else if (I->get() == "--path") { // set path of project to start or edit
+ } else if (I->get() == "-path") { // resolution
if (I->next()) {
@@ -470,7 +445,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
N = I->next()->next();
} else {
- OS::get_singleton()->print("Missing relative or absolute path, aborting.\n");
goto error;
}
} else if (I->get().ends_with("project.godot")) {
@@ -490,7 +464,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
#ifdef TOOLS_ENABLED
editor = true;
#endif
- } else if (I->get() == "-b" || I->get() == "--breakpoints") { // add breakpoints
+ } else if (I->get() == "-bp") { // /breakpoints
if (I->next()) {
@@ -498,73 +472,88 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
breakpoints = bplist.split(",");
N = I->next()->next();
} else {
- OS::get_singleton()->print("Missing list of breakpoints, aborting.\n");
goto error;
}
- } else if (I->get() == "--frame-delay") { // force frame delay
+ } else if (I->get() == "-fdelay") { // resolution
if (I->next()) {
frame_delay = I->next()->get().to_int();
N = I->next()->next();
} else {
- OS::get_singleton()->print("Missing frame delay argument, aborting.\n");
goto error;
}
- } else if (I->get() == "--time-scale") { // force time scale
+ } else if (I->get() == "-timescale") { // resolution
if (I->next()) {
Engine::get_singleton()->set_time_scale(I->next()->get().to_double());
N = I->next()->next();
} else {
- OS::get_singleton()->print("Missing time scale argument, aborting.\n");
goto error;
}
- } else if (I->get() == "--main-pack") {
+ } else if (I->get() == "-pack") {
+
+ if (I->next()) {
+
+ pack_list.push_back(I->next()->get());
+ N = I->next()->next();
+ } else {
+
+ goto error;
+ };
+
+ } else if (I->get() == "-main_pack") {
if (I->next()) {
main_pack = I->next()->get();
N = I->next()->next();
} else {
- OS::get_singleton()->print("Missing path to main pack file, aborting.\n");
+
goto error;
};
- } else if (I->get() == "-d" || I->get() == "--debug") {
+ } else if (I->get() == "-debug" || I->get() == "-d") {
debug_mode = "local";
#ifdef DEBUG_ENABLED
- } else if (I->get() == "--debug-collisions") {
+ } else if (I->get() == "-debugcol" || I->get() == "-dc") {
debug_collisions = true;
- } else if (I->get() == "--debug-navigation") {
+ } else if (I->get() == "-debugnav" || I->get() == "-dn") {
debug_navigation = true;
#endif
- } else if (I->get() == "--remote-debug") {
+ } else if (I->get() == "-editor_scene") {
+
+ if (I->next()) {
+
+ ProjectSettings::get_singleton()->set("editor_scene", game_path = I->next()->get());
+ } else {
+ goto error;
+ }
+
+ } else if (I->get() == "-rdebug") {
if (I->next()) {
debug_mode = "remote";
debug_host = I->next()->get();
- if (debug_host.find(":") == -1) { // wrong address
- OS::get_singleton()->print("Invalid debug host address, it should be of the form <host/IP>:<port>.\n");
+ if (debug_host.find(":") == -1) { //wrong host
+ OS::get_singleton()->print("Invalid debug host string\n");
goto error;
}
N = I->next()->next();
} else {
- OS::get_singleton()->print("Missing remote debug host address, aborting.\n");
goto error;
}
- } else if (I->get() == "--editor-pid") { // not exposed to user
+ } else if (I->get() == "-epid") {
if (I->next()) {
int editor_pid = I->next()->get().to_int();
ProjectSettings::get_singleton()->set("editor_pid", editor_pid);
N = I->next()->next();
} else {
- OS::get_singleton()->print("Missing editor PID argument, aborting.\n");
goto error;
}
} else {
@@ -628,7 +617,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
Error err = file_access_network_client->connect(remotefs, port, remotefs_pass);
if (err) {
- OS::get_singleton()->printerr("Could not connect to remotefs: %s:%i.\n", remotefs.utf8().get_data(), port);
+ OS::get_singleton()->printerr("Could not connect to remotefs: %s:%i\n", remotefs.utf8().get_data(), port);
goto error;
}
@@ -664,14 +653,14 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
#ifdef TOOLS_ENABLED
editor = false;
#else
- OS::get_singleton()->print("Error: Could not load game path '%s'.\n", game_path.ascii().get_data());
+ OS::get_singleton()->print("error: Couldn't load game path '%s'\n", game_path.ascii().get_data());
goto error;
#endif
}
if (editor) {
- main_args.push_back("--editor");
+ main_args.push_back("-editor");
init_maximized = true;
use_custom_res = false;
}
@@ -753,7 +742,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->_render_thread_mode = OS::RenderThreadMode(rtm);
}
- /* Determine audio and video drivers */
+ /* Determine Video Driver */
+
+ if (audio_driver == "") { // specified in project.godot
+ audio_driver = GLOBAL_DEF("audio/driver", OS::get_singleton()->get_audio_driver_name(0));
+ }
for (int i = 0; i < OS::get_singleton()->get_video_driver_count(); i++) {
@@ -771,10 +764,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
//goto error;
}
- if (audio_driver == "") { // specified in project.godot
- audio_driver = GLOBAL_DEF("audio/driver", OS::get_singleton()->get_audio_driver_name(0));
- }
-
for (int i = 0; i < OS::get_singleton()->get_audio_driver_count(); i++) {
if (audio_driver == OS::get_singleton()->get_audio_driver_name(i)) {
@@ -842,8 +831,7 @@ error:
args.clear();
main_args.clear();
- if (show_help)
- print_help(execpath);
+ print_help(execpath);
if (performance)
memdelete(performance);
@@ -1059,18 +1047,23 @@ bool Main::start() {
String game_path;
String script;
String test;
+ String screen;
String _export_preset;
+ String _import;
+ String _import_script;
+ bool noquit = false;
bool export_debug = false;
bool project_manager_request = false;
-
List<String> args = OS::get_singleton()->get_cmdline_args();
for (int i = 0; i < args.size(); i++) {
//parameters that do not have an argument to the right
- if (args[i] == "--no-docbase") {
+ if (args[i] == "-nodocbase") {
doc_base = false;
- } else if (args[i] == "-e" || args[i] == "--editor") {
+ } else if (args[i] == "-noquit") {
+ noquit = true;
+ } else if (args[i] == "-editor" || args[i] == "-e") {
editor = true;
- } else if (args[i] == "-p" || args[i] == "--project-manager") {
+ } else if (args[i] == "-pm" || args[i] == "-project_manager") {
project_manager_request = true;
} else if (args[i].length() && args[i][0] != '-' && game_path == "") {
game_path = args[i];
@@ -1078,21 +1071,29 @@ bool Main::start() {
//parameters that have an argument to the right
else if (i < (args.size() - 1)) {
bool parsed_pair = true;
- if (args[i] == "--doctool") {
+ if (args[i] == "-doctool") {
doc_tool = args[i + 1];
for (int j = i + 2; j < args.size(); j++)
removal_docs.push_back(args[j]);
- } else if (args[i] == "-s" || args[i] == "--script") {
+ } else if (args[i] == "-script" || args[i] == "-s") {
script = args[i + 1];
- } else if (args[i] == "--test") {
+ } else if (args[i] == "-level" || args[i] == "-l") {
+ Engine::get_singleton()->_custom_level = args[i + 1];
+ } else if (args[i] == "-test") {
test = args[i + 1];
- } else if (args[i] == "--export") {
+ } else if (args[i] == "-export") {
editor = true; //needs editor
_export_preset = args[i + 1];
- } else if (args[i] == "--export-debug") {
+ } else if (args[i] == "-export_debug") {
editor = true; //needs editor
_export_preset = args[i + 1];
export_debug = true;
+ } else if (args[i] == "-import") {
+ editor = true; //needs editor
+ _import = args[i + 1];
+ } else if (args[i] == "-import_script") {
+ editor = true; //needs editor
+ _import_script = args[i + 1];
} else {
// The parameter does not match anything known, don't skip the next argument
parsed_pair = false;
@@ -1138,7 +1139,7 @@ bool Main::start() {
if (_export_preset != "") {
if (game_path == "") {
String err = "Command line param ";
- err += export_debug ? "--export-debug" : "--export";
+ err += export_debug ? "-export_debug" : "-export";
err += " passed but no destination path given.\n";
err += "Please specify the binary's file path to export to. Aborting export.";
ERR_PRINT(err.utf8().get_data());
@@ -1198,7 +1199,7 @@ bool Main::start() {
if (!main_loop) {
if (!ClassDB::class_exists(main_loop_type)) {
- OS::get_singleton()->alert("Error: MainLoop type doesn't exist: " + main_loop_type);
+ OS::get_singleton()->alert("godot: error: MainLoop type doesn't exist: " + main_loop_type);
return false;
} else {
@@ -1348,8 +1349,19 @@ bool Main::start() {
#ifdef TOOLS_ENABLED
if (editor) {
- Error serr = editor_node->load_scene(local_game_path);
+ if (_import != "") {
+
+ //editor_node->import_scene(_import,local_game_path,_import_script);
+ if (!noquit)
+ sml->quit();
+ game_path = ""; //no load anything
+ } else {
+
+ Error serr = editor_node->load_scene(local_game_path);
+ }
OS::get_singleton()->set_context(OS::CONTEXT_EDITOR);
+
+ //editor_node->set_edited_scene(game);
}
#endif
}
@@ -1423,6 +1435,7 @@ bool Main::start() {
n->set_name(name);
//defer so references are all valid on _ready()
+ //sml->get_root()->add_child(n);
to_add.push_back(n);
if (global_var) {
@@ -1447,6 +1460,7 @@ bool Main::start() {
ERR_EXPLAIN("Failed loading scene: " + local_game_path);
ERR_FAIL_COND_V(!scene, false)
+ //sml->get_root()->add_child(scene);
sml->add_current_scene(scene);
String iconpath = GLOBAL_DEF("application/config/icon", "Variant()");
@@ -1460,6 +1474,27 @@ bool Main::start() {
}
#ifdef TOOLS_ENABLED
+
+ /*if (_export_platform!="") {
+
+ sml->quit();
+ }*/
+
+ /*
+ if (sml->get_root_node()) {
+
+ Console *console = memnew( Console );
+
+ sml->get_root_node()->cast_to<RootNode>()->set_console(console);
+ if (GLOBAL_DEF("console/visible_default",false).operator bool()) {
+
+ console->show();
+ } else {P
+
+ console->hide();
+ };
+ }
+*/
if (project_manager_request || (script == "" && test == "" && game_path == "" && !editor)) {
ProjectManager *pmanager = memnew(ProjectManager);
@@ -1468,6 +1503,7 @@ bool Main::start() {
sml->get_root()->add_child(pmanager);
OS::get_singleton()->set_context(OS::CONTEXT_PROJECTMAN);
}
+
#endif
}
@@ -1548,6 +1584,10 @@ bool Main::iteration() {
time_accum -= frame_slice;
message_queue->flush();
+ /*
+ if (AudioServer::get_singleton())
+ AudioServer::get_singleton()->update();
+ */
fixed_process_ticks = MAX(fixed_process_ticks, OS::get_singleton()->get_ticks_usec() - fixed_begin); // keep the largest one for reference
fixed_process_max = MAX(OS::get_singleton()->get_ticks_usec() - fixed_begin, fixed_process_max);
@@ -1596,6 +1636,7 @@ bool Main::iteration() {
script_debugger->idle_poll();
}
+ //x11_delay_usec(10000);
frames++;
Engine::get_singleton()->_idle_frames++;
@@ -1697,6 +1738,7 @@ void Main::cleanup() {
unregister_core_driver_types();
unregister_core_types();
+ //PerformanceMetrics::finish();
OS::get_singleton()->clear_last_error();
OS::get_singleton()->finalize_core();
}