diff options
author | Juan Linietsky <reduzio@gmail.com> | 2023-01-13 13:16:49 +0100 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2023-01-13 15:13:56 +0100 |
commit | 6f0e210093dbd3f20bec34a4e60861dcceabd484 (patch) | |
tree | 608560e2f51e2b5a26542268a625266b2cdf62de /doc/classes | |
parent | 3c9bf4bc210a8e6a208f30ca59de4d4d7e18c04d (diff) |
Refactor ProjectSetting overrides
* Overrides no longer happen for set/get.
* They must be checked with a new function: `ProjectSettings::get_setting_with_override()`.
* GLOBAL_DEF/GLOBAL_GET updated to use this
This change solves many problems:
* General confusion about getting the actual or overriden setting.
* Feature tags available after settings are loaded were being ignored, they are now considered.
* Hacks required for the Project Settings editor to work.
Fixes #64100. Fixes #64014. Fixes #61908.
Diffstat (limited to 'doc/classes')
-rw-r--r-- | doc/classes/ProjectSettings.xml | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index cfcfca9880..f954e8bca8 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -84,6 +84,25 @@ GD.Print(ProjectSettings.GetSetting("application/config/custom_description", "No description specified.")); [/csharp] [/codeblocks] + [b]Note:[/b] This method doesn't take potential feature overrides into account automatically. Use [method get_setting_with_override] to handle seamlessly. + </description> + </method> + <method name="get_setting_with_override" qualifiers="const"> + <return type="Variant" /> + <param index="0" name="name" type="StringName" /> + <description> + Similar to [method get_setting], but applies feature tag overrides if any exists and is valid. + [b]Example:[/b] + If the following setting override exists "application/config/name.windows", and the following code is executed: + [codeblocks] + [gdscript] + print(ProjectSettings.get_setting_with_override("application/config/name")) + [/gdscript] + [csharp] + GD.Print(ProjectSettings.GetSettingWithOverride("application/config/name")); + [/csharp] + [/codeblocks] + Then the overridden setting will be returned instead if the project is running on the [i]Windows[/i] operating system. </description> </method> <method name="globalize_path" qualifiers="const"> |