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

Expose method to set a project setting as internal #6984

Closed
winston-yallow opened this issue May 30, 2023 · 2 comments · Fixed by godotengine/godot#77668
Closed

Expose method to set a project setting as internal #6984

winston-yallow opened this issue May 30, 2023 · 2 comments · Fixed by godotengine/godot#77668
Milestone

Comments

@winston-yallow
Copy link

Describe the project you are working on

I'm working on a plugin for simple in-game input remapping. It needs to store some settings that are managed via a custom dialog.

Describe the problem or limitation you are having in your project

I have a custom dialog for some of my plugin settings because the standard project settings dialog can't be used to nicely edit graphs. I still use the ProjectSettings to store this though, since it is a setting in the end and it makes sense to let the engine handle saving and loading them. The problem is that they still show up in the project settings, even though they aren't supposed to be edited manually by the user.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Setting them as internal would prevent them from showing up in the project settings.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

It just adds one line to the source, exposing ProjectSettings.set_as_internal(prop, internal) to the scripting languages.

If this enhancement will not be used often, can it be worked around with a few lines of script?

I don't think there is a way to work around this reliably while still using the project settings. I could, in theory, simply store my custom setting in my own custom resource instead of using the project settings. However this would needlessly duplicate behavior that the engine already has.

Is there a reason why this should be core and not an add-on in the asset library?

The change won't require any new logic, just exposing what's already there.

@winston-yallow
Copy link
Author

As a note, this is similar to #6938 (already completed) and I can make a PR for this one too. However I would like to know first if there would be any negative side effects for marking plugin settings as internal? I wonder if the internal flag is only used to toggle visibility, or if this has other side effects that I missed

@winston-yallow
Copy link
Author

winston-yallow commented May 30, 2023

As far as I understand it, the only place where the internal flag is really used is when generating the property list (https://github.com/winston-yallow/godot/blob/master/core/config/project_settings.cpp#L397).

It sets the hint to storage only, and sets the usage to PROPERTY_USAGE_INTERNAL (which sadly isn't documented). So unless that usage flag has some very specific meaning, it seems like exposing this to GDScript should be fine.

Edit: confirmed on rocketchat that I understood the usage flag correctly

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

Successfully merging a pull request may close this issue.

3 participants