Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,14 @@ opts.Add(BoolVariable("disable_physics_3d", "Disable 3D physics nodes and server
opts.Add(BoolVariable("disable_navigation_2d", "Disable 2D navigation features", False))
opts.Add(BoolVariable("disable_navigation_3d", "Disable 3D navigation features", False))
opts.Add(BoolVariable("disable_xr", "Disable XR nodes and server", False))
opts.Add(BoolVariable("disable_overrides", "Disable project settings overrides and related CLI arguments", False))
opts.Add(BoolVariable("disable_overrides", "Disable project settings overrides (override.cfg)", False))
opts.Add(
BoolVariable(
"disable_path_overrides",
"Disable CLI arguments to override project path/main pack/scene and run scripts (export template only)",
True,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels a bit weird to me that disable_path_overrides is silently ignored when building an editor build. But I'm not sure if it's important to fix this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand it correctly, this would require users to start editing the overrides.cfg to inject mods?

Or editing PCK, or both.

It feels a bit weird to me that disable_path_overrides is silently ignored when building an editor build.

It is, but I'm not sure how to handle it, since it's both enabled for editor and disabled for templates by default.

Copy link
Member

@Ivorforce Ivorforce Nov 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main solution in my mind would be to have it 'unspecified' by default, and if it's specified it overrides the defaults. But I'm not sure if we do this for any other options, plus the editor wouldn't function as expected with the option explicitly enabled anyway. So it's probably fine to keep it as is.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have some options that will automatically infer their status based on if it's an editor build or not, but those are more options for the SCons environment itself rather than actual arguments iirc. Unsure how much effort it would take to make that "just work" natively

)
)
opts.Add("build_profile", "Path to a file containing a feature build profile", "")
opts.Add("custom_modules", "A list of comma-separated directory paths containing custom modules to build.", "")
opts.Add(BoolVariable("custom_modules_recursive", "Detect custom modules recursively for each specified path.", True))
Expand Down Expand Up @@ -1033,6 +1040,9 @@ if env["brotli"]:
if not env["disable_overrides"]:
env.Append(CPPDEFINES=["OVERRIDE_ENABLED"])

if env.editor_build or not env["disable_path_overrides"]:
env.Append(CPPDEFINES=["OVERRIDE_PATH_ENABLED"])

if not env["verbose"]:
methods.no_verbose(env)

Expand Down
22 changes: 15 additions & 7 deletions core/config/project_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -632,9 +632,8 @@ void ProjectSettings::_convert_to_last_version(int p_from_version) {
* If found, load it or fail.
* - Lookup project file in passed `p_path` (--path passed by the user), i.e. we
* are running from source code.
* If not found and `p_upwards` is true (--upwards passed by the user), look for
* project files in parent folders up to the system root (used to run a game
* from command line while in a subfolder).
* If not found and `p_upwards` is true, look for project files in parent folders
* up to the system root (used to run a game from command line while in a subfolder).
* If a project file is found, load it or fail.
* If nothing was found, error out.
*/
Expand Down Expand Up @@ -731,7 +730,7 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
#endif

// Try to use the filesystem for files, according to OS.
// (Only Android -when reading from pck- and iOS use this.)
// (Only Android -when reading from PCK-.)

if (!OS::get_singleton()->get_resource_dir().is_empty()) {
Error err = _load_settings_text_or_binary("res://project.godot", "res://project.binary");
Expand Down Expand Up @@ -804,6 +803,7 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
break;
}

#if defined(OVERRIDE_PATH_ENABLED)
if (p_upwards) {
// Try to load settings ascending through parent directories
d->change_dir("..");
Expand All @@ -812,6 +812,9 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b
}
current_dir = d->get_current_dir();
} else {
#else
{
#endif
break;
}
}
Expand All @@ -829,12 +832,17 @@ Error ProjectSettings::_setup(const String &p_path, const String &p_main_pack, b

Error ProjectSettings::setup(const String &p_path, const String &p_main_pack, bool p_upwards, bool p_ignore_override) {
Error err = _setup(p_path, p_main_pack, p_upwards, p_ignore_override);
#ifdef OVERRIDE_ENABLED
if (err == OK && !p_ignore_override) {
String custom_settings = GLOBAL_GET("application/config/project_settings_override");
if (!custom_settings.is_empty()) {
_load_settings_text(custom_settings);
bool disable_override = GLOBAL_GET("application/config/disable_project_settings_override");
if (!disable_override) {
String custom_settings = GLOBAL_GET("application/config/project_settings_override");
if (!custom_settings.is_empty()) {
_load_settings_text(custom_settings);
}
}
}
#endif

// Updating the default value after the project settings have loaded.
bool use_hidden_directory = GLOBAL_GET("application/config/use_hidden_project_data_directory");
Expand Down
138 changes: 103 additions & 35 deletions main/main.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions main/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Main {
CLI_OPTION_AVAILABILITY_EDITOR,
CLI_OPTION_AVAILABILITY_TEMPLATE_DEBUG,
CLI_OPTION_AVAILABILITY_TEMPLATE_RELEASE,
CLI_OPTION_AVAILABILITY_TEMPLATE_UNSAFE,
CLI_OPTION_AVAILABILITY_HIDDEN,
};

Expand Down
3 changes: 0 additions & 3 deletions misc/dist/linux/godot.6
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ Use a specific locale (<locale> being a two\-letter code).
\fB\-\-path\fR <directory>
Path to a project (<directory> must contain a 'project.godot' file).
.TP
\fB\-u\fR, \fB\-\-upwards\fR
Scan folders upwards for project.godot file.
.TP
\fB\-\-main\-pack\fR <file>
Path to a pack (.pck) file to load.
.TP
Expand Down
1 change: 0 additions & 1 deletion misc/dist/shell/_godot.zsh-completion
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ _arguments \
'--quit[quit after the first iteration]' \
'(-l --language)'{-l,--language}'[use a specific locale (<locale> being a two-letter code)]:two-letter locale code' \
"--path[path to a project (<directory> must contain a 'project.godot' file)]:path to directory with 'project.godot' file:_dirs" \
'(-u --upwards)'{-u,--upwards}'[scan folders upwards for project.godot file]' \
'--main-pack[path to a pack (.pck) file to load]:path to .pck file:_files' \
'--render-thread[set the render thread mode]:render thread mode:(unsafe safe separate)' \
'--remote-fs[use a remote filesystem]:remote filesystem address' \
Expand Down
1 change: 0 additions & 1 deletion misc/dist/shell/godot.bash-completion
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ _complete_godot_options() {
--quit
--language
--path
--upwards
--main-pack
--render-thread
--remote-fs
Expand Down
1 change: 0 additions & 1 deletion misc/dist/shell/godot.fish
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ complete -c godot -l debug-server -d "Start the editor debug server (<protocol>:
complete -c godot -l quit -d "Quit after the first iteration"
complete -c godot -s l -l language -d "Use a specific locale (<locale> being a two-letter code)" -x
complete -c godot -l path -d "Path to a project (<directory> must contain a 'project.godot' file)" -r
complete -c godot -s u -l upwards -d "Scan folders upwards for project.godot file"
complete -c godot -l main-pack -d "Path to a pack (.pck) file to load" -r
complete -c godot -l render-thread -d "Set the render thread mode" -x -a "unsafe safe separate"
complete -c godot -l remote-fs -d "Use a remote filesystem (<host/IP>[:<port>] address)" -x
Expand Down