From 6f0e210093dbd3f20bec34a4e60861dcceabd484 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Fri, 13 Jan 2023 13:16:49 +0100 Subject: 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. --- doc/classes/ProjectSettings.xml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'doc') 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. + + + + + + + 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. -- cgit v1.2.3