godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 69 forks source link

Use enums instead of integer properties for project settings that only allow power-of-two values #2872

Open mrjustaguy opened 3 years ago

mrjustaguy commented 3 years ago

Describe the project you are working on

N/A

Describe the problem or limitation you are having in your project

Some Project settings (Like Directional Shadow Resolution) say they Round to the nearest power of 2, as such, it's pointless to be able to pick any number from 256 to 16384, and should rather just be a set of options of the numbers that make sense (256, 512, 1k, 2k, 4k, 8k, 16k)

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

Change settings that have a narrow list of valid options (like a dozen) into Option Buttons with the list of possible options, as opposed to the current Spin Boxes. While Spin Boxes are ok, they are misleading, as they make it seem like the option range is much larger compared to what it actually is.

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

Turn any Spin Boxes/Sliders etc. into Option Buttons with all Valid options if there are only under about a dozen Valid options.

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

Yes, you can enter the correct power of 2 number

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

Project Settings are in core

Notes

If you know of any other UI cases similar to this in the editor, please post below

clayjohn commented 3 years ago

This is a great idea. I think a couple of the rendering settings can be similarly improved.

We should make a list of all the settings that can be fixed and then do it all at once in a single PR.

Calinou commented 3 years ago

I looked into doing this a few weeks ago, but it requires a lot of copy-editing work and couldn't finish it. It's also a breaking change, so it can't be backported to 3.x.

Calinou commented 2 years ago

Some Project settings (Like Directional Shadow Resolution) say they Round to the nearest power of 2, as such, it's pointless to be able to pick any number from 256 to 16384, and should rather just be a set of options of the numbers that make sense (256, 512, 1k, 2k, 4k, 8k, 16k)

https://github.com/godotengine/godot/pull/54041 would alleviate this by allowing non-power-of-two values to work in the first place :slightly_smiling_face:

mrjustaguy commented 2 years ago

Heh, Allowing non-power-of-two values for shadows is a nice improvement, didn't think that would work just fine, Great Job!