Merge pull request #105302 from KoBeWi/scenic

Add `--scene` command line argument
This commit is contained in:
Thaddeus Crews 2025-05-13 16:22:20 -05:00
commit 7439ea95f6
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
2 changed files with 11 additions and 2 deletions

View file

@ -514,7 +514,7 @@ void Main::print_help(const char *p_binary) {
print_help_copyright("(c) 2014-present Godot Engine contributors. (c) 2007-present Juan Linietsky, Ariel Manzur.");
print_help_title("Usage");
OS::get_singleton()->print(" %s \u001b[96m[options] [path to scene or \"project.godot\" file]\u001b[0m\n", p_binary);
OS::get_singleton()->print(" %s \u001b[96m[options] [path to \"project.godot\" file]\u001b[0m\n", p_binary);
#if defined(TOOLS_ENABLED)
print_help_title("Option legend (this build = editor)");
@ -555,6 +555,7 @@ void Main::print_help(const char *p_binary) {
print_help_option("--quit-after <int>", "Quit after the given number of iterations. Set to 0 to disable.\n");
print_help_option("-l, --language <locale>", "Use a specific locale (<locale> being a two-letter code).\n");
print_help_option("--path <directory>", "Path to a project (<directory> must contain a \"project.godot\" file).\n");
print_help_option("--scene <path>", "Path or UID of a scene in the project that should be started.\n");
print_help_option("-u, --upwards", "Scan folders upwards for project.godot file.\n");
print_help_option("--main-pack <file>", "Path to a pack (.pck) file to load.\n");
#ifdef DISABLE_DEPRECATED
@ -3855,7 +3856,14 @@ int Main::start() {
} else if (E->get() == "--install-android-build-template") {
install_android_build_template = true;
#endif // TOOLS_ENABLED
} else if (E->get().length() && E->get()[0] != '-' && positional_arg.is_empty()) {
} else if (E->get() == "--scene") {
E = E->next();
if (E) {
game_path = E->get();
} else {
ERR_FAIL_V_MSG(EXIT_FAILURE, "Missing scene path, aborting.");
}
} else if (E->get().length() && E->get()[0] != '-' && positional_arg.is_empty() && game_path.is_empty()) {
positional_arg = E->get();
String scene_path = ResourceUID::ensure_path(E->get());