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

Allow comma as decimal separator in the Inspector #1576

Closed
ModProg opened this issue Sep 27, 2020 · 2 comments · Fixed by godotengine/godot#42376
Closed

Allow comma as decimal separator in the Inspector #1576

ModProg opened this issue Sep 27, 2020 · 2 comments · Fixed by godotengine/godot#42376

Comments

@ModProg
Copy link

ModProg commented Sep 27, 2020

Describe the project you are working on:
I am currently developing a fantasy RTS game in a low poly style.

Describe the problem or limitation you are having in your project:
On a German (QWERTZ) keyboardlayout the dot on the number-block is a comma, this means when entering numbers in the Inspector, it is slowed down by this.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:
Parse decimal numbers with both dot or comma separator. An other option would be to replace a comma entered in a number field with a dot

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

numinput.replace(',', '.')

If this enhancement will not be used often, can it be worked around with a few lines of script?:
If the number parsing for the Inspector is done in a single place this should not take more than 3 lines of code.

Is there a reason why this should be core and not an add-on in the asset library?:
I am not sure if this could even be done with an add-on and it is in my opinion part of the localization of the Editor.

I would be able to make a pull-request for this.

@Calinou
Copy link
Member

Calinou commented Sep 27, 2020

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

numinput.replace(',', '.')

Unfortunately, it's more complicated than that: godotengine/godot#24531 (comment)

That said, since we probably don't care about using functions in EditorSpinSlider, we can do it anyway. I don't remember hearing of anyone who actually uses pow() in EditorSpinSlider more than once a day…

@ModProg
Copy link
Author

ModProg commented Sep 27, 2020

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

numinput.replace(',', '.')

Unfortunately, it's more complicated than that: godotengine/godot#24531 (comment)

That said, since we probably don't care about using functions in EditorSpinSlider, we can do it anyway.

The better solution would of course be what Blender does and replace only the comma on the number block, but this would probably necessitate more changes on how the input for the Inspector is handled.

Another possibility I see is only replacing the comma if the input is only made of numbers and one comma, something like

^\d*,\d*$

akien-mga pushed a commit to akien-mga/godot that referenced this issue Sep 29, 2020
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.

2 participants