You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the problem or limitation you are having in your project
Large numbers are currently displayed as-is in the editor, without any separators for thousands. Additionally, projects regularly need to display large numbers for debugging purposes, and readability is important in this scenario.
This is also a common use case for management or idle games which often display large numbers.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
By adding a String.number_format() method (and having TextServer use it internally when relevant), we can improve the display of large numbers in the editor:
TextServer takes the current language into account and aims to use the correct separator for the language. Here's an example with French:
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
String.format_number() can be used directly when you want to specify your own separator characters, a custom separator interval or don't need internationalization. Custom separator intervals can be useful for hexadecimal numbers (e.g. 0x00060d07 can become 0x0006 0d07).
TextServer.format_number() uses String.format_number() with an automatically detected delimiter separator and decimal separator according to the current language (or the specified language parameter).
If this enhancement will not be used often, can it be worked around with a few lines of script?
This can be worked around with a script, but not for the editor's own display of large numbers.
Is there a reason why this should be core and not an add-on in the asset library?
This is about improving editor usability as well as quality of life when debugging a project.
The text was updated successfully, but these errors were encountered:
Does this affect the Output window (i.e., output from print statements)? [Edit: sorry, I think I see this in the first image.]
Would I be able to supply my own format_number() function in an editor plugin?
I'm asking because I also have the "small number problem", where the editor prints "0" when the number is neither 0.0 nor approximately 0.0 by is_zero_approx() test. This happens quite frequently in my solar system simulation.
Does this affect the Output window (i.e., output from print statements)? [Edit: sorry, I think I see this in the first image.]
It wouldn't, but you could use the number formatting method manually within a print() if you wish. The first image is the 3D editor viewport's View Information panel, not the Output bottom panel.
Would I be able to supply my own format_number() function in an editor plugin?
You could choose to use a custom separator for thousands and decimals, as well as choosing the "length" of thousands so to speak. The PR's String.format_number() method provides all three options as optional parameters.
I'm asking because I also have the "small number problem", where the editor prints "0" when the number is neither 0.0 nor approximately 0.0 by is_zero_approx() test. This happens quite frequently in my solar system simulation.
Describe the project you are working on
The Godot editor 🙂
Describe the problem or limitation you are having in your project
Large numbers are currently displayed as-is in the editor, without any separators for thousands. Additionally, projects regularly need to display large numbers for debugging purposes, and readability is important in this scenario.
This is also a common use case for management or idle games which often display large numbers.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
By adding a
String.number_format()
method (and having TextServer use it internally when relevant), we can improve the display of large numbers in the editor:TextServer takes the current language into account and aims to use the correct separator for the language. Here's an example with French:
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
String.format_number()
can be used directly when you want to specify your own separator characters, a custom separator interval or don't need internationalization. Custom separator intervals can be useful for hexadecimal numbers (e.g.0x00060d07
can become0x0006 0d07
).TextServer.format_number()
usesString.format_number()
with an automatically detected delimiter separator and decimal separator according to the current language (or the specifiedlanguage
parameter).If this enhancement will not be used often, can it be worked around with a few lines of script?
This can be worked around with a script, but not for the editor's own display of large numbers.
Is there a reason why this should be core and not an add-on in the asset library?
This is about improving editor usability as well as quality of life when debugging a project.
The text was updated successfully, but these errors were encountered: