-
-
Notifications
You must be signed in to change notification settings - Fork 21.7k
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
Store Control constants as floats instead of integers #39013
Conversation
This allows to store values like the editor scale in a constant. This way, we can eventually remove the need to include editor-only headers in source files in the `scene/` folder.
Perhaps |
@aaronfranke Maybe, but I can't think of what you'd need such large integers for in an UI context. The memory usage difference will probably be quite small and acceptable for 4.0, but I'd need approval from reduz first. That said, scalar floats in GDScript are already 64-bit, so this would make custom constants consistent with them. |
In general, it would be useful to have constants other than integers. While using ints as booleans is normal for a programmer, it doesn't lead to a great user experience. Floats can be useful for several things as well. However, I suspect this PR needs to be redone at this point, rather than rebased. |
I think editor scale probably should be accessible from the viewport/window, not from a theme property. |
This was added in #53341. I think float constants still have a few benefits, such as setting floating-point font sizes (even if the final rendering rounds them to integer sizes, at least for non-MSDF fonts). This gives you more control over a font's final size after oversampling. |
I think that ideally theme constants could allow any Variant constant, so bools would be true bools, and numbers can be both int and float, and maybe someone naughty would store something else in there. |
I think we can have a more flexible solution here, replacing ints with floats has a few downsides too. We should come up with a non-breaking solution during the 4.x development. |
This allows to store values like the editor scale in a constant. This way, we can eventually remove the need to include editor-only headers in source files in the
scene/
folder.The editor still appears to look correct, but please test for regressions anyway. I'd be surprised if everything worked as expected right now 🙂