Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ProjectSetting overrides #71325

Merged

Conversation

reduz
Copy link
Member

@reduz reduz commented Jan 13, 2023

  • 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 the above function.
  • The ability to disable feature overrides has been removed since it no longer makes sense.

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.

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

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

There are also these usage of ProjectSettings::get_setting() which should likely be replaced by GLOBAL_GET() or get_setting_with_override() to properly respect overrides:

tests/core/config/test_project_settings.h
43:     Variant variant = ProjectSettings::get_singleton()->get_setting("application/config/name");
53:     Variant variant = ProjectSettings::get_singleton()->get_setting("application/config/name", "SomeDefaultValue");
63:     Variant variant = ProjectSettings::get_singleton()->get_setting("not_existing_setting");
70:     Variant variant = ProjectSettings::get_singleton()->get_setting("not_existing_setting");
73:     variant = ProjectSettings::get_singleton()->get_setting("not_existing_setting", "my_nice_default_value");
85:     Variant variant = ProjectSettings::get_singleton()->get_setting("my_custom_setting");
91:     variant = ProjectSettings::get_singleton()->get_setting("my_custom_setting");

modules/mono/csharp_script.cpp
691:            String assembly_name = ProjectSettings::get_singleton()->get_setting("dotnet/project/assembly_name");

modules/mono/mono_gd/gd_mono.cpp
292:    String assembly_name = ProjectSettings::get_singleton()->get_setting("dotnet/project/assembly_name");
469:    String assembly_name = ProjectSettings::get_singleton()->get_setting("dotnet/project/assembly_name");

platform/web/export/export_plugin.cpp
156:    replaces["$GODOT_PROJECT_NAME"] = ProjectSettings::get_singleton()->get_setting("application/config/name");
196:    String proj_name = ProjectSettings::get_singleton()->get_setting("application/config/name");

core/config/project_settings.cpp Outdated Show resolved Hide resolved
core/config/project_settings.cpp Show resolved Hide resolved
core/config/project_settings.cpp Outdated Show resolved Hide resolved
core/config/project_settings.cpp Show resolved Hide resolved
platform/android/export/export_plugin.cpp Outdated Show resolved Hide resolved
@reduz reduz force-pushed the refactor-project-setting-overrides branch from 329d4b6 to 5a91a14 Compare January 13, 2023 13:37
@reduz reduz requested review from a team as code owners January 13, 2023 13:37
@reduz reduz force-pushed the refactor-project-setting-overrides branch from 5a91a14 to 4fb62bd Compare January 13, 2023 13:42
@reduz
Copy link
Member Author

reduz commented Jan 13, 2023

Removed function to disable, applied fixes and updated docs.

@reduz reduz force-pushed the refactor-project-setting-overrides branch 2 times, most recently from b10c519 to 24b9374 Compare January 13, 2023 14:09
* 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 godotengine#64100. Fixes godotengine#64014. Fixes godotengine#61908.
@reduz reduz force-pushed the refactor-project-setting-overrides branch from 24b9374 to 6f0e210 Compare January 13, 2023 14:14
@akien-mga akien-mga merged commit 8716c12 into godotengine:master Jan 13, 2023
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Project settings feature overrides aren't applied in the editor
3 participants