Page MenuHome

UI: Comma as Decimal Separator
AbandonedPublic

Authored by Harley Acheson (harley) on Apr 24 2020, 7:02 PM.

Details

Summary

Currently Blender only accepts the period symbol as decimal separator.

But this is only the standard in about half the world. A majority of European countries, like Spain, France, Norway, Denmark, and more use comma for this. As does parts of Africa, Indonesia, Mongolia, Venezuela, Brazil, Chile, Argentina, Colombia, and Uruguay, and some Quebecers.

This patch doesn't strictly make you choose, so don't think this is more disruptive than it is. This patch generally allows you to use both symbols for decimal separator. It is mostly about how the result is shown. So you can set "comma" for decimal separator yet still use the "." on your keypad for this.

Once applied you can go into Preferences and change to "comma":

Once you make this change you can enter numbers using comma as decimal separator or with period, but what is shown will be with commas. And with this set any large integers that are normally shown as "1,234,567" will be shown as "1.234.567" as is the custom in almost all places that use comma decimals. I have kept this patch simple by not allowing for differences in integer grouping. So India does not get 2,3 groups and Switzerland and Liechtenstein do not see apostrophes. Easy enough to add these options but I liked the simplicity of having just one switch.

No, it does not add much complexity at all. Most of this patch is dealing with large integer grouping, not with decimals.

Yes, all the fancy things we do in number inputs still work. I have found only one thing that necessarily has to work differently. If you have decimal "point" selected then you can enter "1,5" to get "6", while obviously that will give you "1.5" if set to decimal comma.

Diff Detail

Repository
rB Blender

Event Timeline

Harley Acheson (harley) requested review of this revision.Apr 24 2020, 7:02 PM
Harley Acheson (harley) created this revision.

Would by any chance to also get padding zeros to work be easy?
Currently if one enters 04 it fails to register. Curious enough 04.0 works correctly

It’s nice to support this, but should it be set automatically for each region? If i were to pick German, it could automatically use commas.

@Duarte Farrajota Ramos (duarteframos) - Would by any chance to also get padding zeros to work be easy? Currently if one enters 04 it fails to register. Curious enough 04.0 works correctly

Wow, I'd never noticed that before. But having a python "invalid token" error when entering "04" into a number input looks like a legitimate bug to me.

@William Reynish (billreynish) - It’s nice to support this, but should it be set automatically for each region? If i were to pick German, it could automatically use commas.

Maybe? I'm not entirely certain. I generally start with "do the least amount of harm" so having this just off by default would give no change for existing users who are used to current behavior. Tying it to blender language might be okay but I don't like the thought of getting this (or language) from the OS as many of our users these don't necessarily match.

But again, I'm not finding much harm with this patch when set "wrong" so who knows. Needs some thought.

having a python "invalid token" error when entering "04" into a number input looks like a legitimate bug to me.

It's been like that since I remember, not sure it'd be considered a bug, maybe a limitation.

Reading the description I got the impression that this patch would make it possible to use both comas and periods interchangeably as decimal separator simultaneously.
Would it be possible to just accept both characters as separator regardless of locale or preferences?
For number fields at least it doesn't seem like we would run into any kind of conflict.
If I'm not mistaken I don't recall any part of the UI that allows entering vectors or lists to be manually, so I'd only foresee potential issues for text fields.

This should not be supported, it adds a lot of complexity in indirect ways. Not only in Blender but also add-ons and interop with other apps. It's not worth it.

@Brecht Van Lommel (brecht) - This should not be supported, it adds a lot of complexity in indirect ways. Not only in Blender but also add-ons and interop with other apps. It's not worth it.

How? Would love at least one example. Otherwise it reads as "this won't work for unstated reasons" and doesn't inform this thread at all.

  • Number input in modal operators
  • All text rendering that includes decimals, in Blender and add-ons
  • Drivers and Python expressions
  • Copy paste to Python scripts
  • Copy paste between other 3D apps
  • Tutorials and documentation incompatibilities
  • ..

Periods as decimal separator is the standard in computer graphics and programming. Trying to do deviate from that is inviting a bunch of problems, to do something that users aren't even asking for. I think it's bad practice to teach users to use commas, that makes it harder for them to learn computer graphics techniques and software as a while.

@Brecht Van Lommel (brecht)
What if commas will appear only as visual separator, because it is more noticable?
Only at areas without input (statistics for example)
But for input there will be always dot.

What I might try next is something much simpler:

Leave "dot" as the decimal separator but ALLOW the use of comma when entering numbers. So people used to using comma, or where their OS setting or hardware make this easier, can hit comma and just get a dot.

And also change the grouping symbol from comma to thinspace as per current international recommendation.

Might work. Will give it a try one of these days. LOL

Vyacheslav (hitrpr) added a comment.EditedMay 6 2020, 11:17 PM

@Harley Acheson (harley) thats the idea.
I have software, that allows only comma for floats, I use it rare. And error messages about dots are annoying.
I tested, what will happen, just for curiosity.
Blender acts even more cruelly. If I enter 12,5 it will set 12+5.

So yes, better to allow user to input comma, than that…

But. I assume, comma now using as «append»? Will we broke something in that case?
We need to be sure, it will not brake drivers, that can be typed right in the input-string.

What's inconvenient for me is that when I copy values from a calculator or a spreadsheet application I can't just paste it into Blender. So some automatic conversion (comma to period) would be very convenient, where possible.

Would by any chance to also get padding zeros to work be easy?
Currently if one enters 04 it fails to register. Curious enough 04.0 works correctly

What's inconvenient for me is that when I copy values from a calculator or a spreadsheet application I can't just paste it into Blender. So some automatic conversion (comma to period) would be very convenient, where possible.

What I might try next is something much simpler:

Leave "dot" as the decimal separator but ALLOW the use of comma when entering numbers. So people used to using comma, or where their OS setting or hardware make this easier, can hit comma and just get a dot.

Proposed that some time ago
https://blender.community/c/rightclickselect/csfbbc/

ogierm added a subscriber: ogierm.

This should not be supported, it adds a lot of complexity in indirect ways. Not only in Blender but also add-ons and interop with other apps. It's not worth it.

Yes, this will bring the same decimal separator problem as in Excel, it's definitely not worth it.
Thank you!

Yes, this will bring the same decimal separator problem as in Excel, it's definitely not worth it.
Thank you!

The state of this patch is Abandoned so no worries there. LOL

Yes, this will bring the same decimal separator problem as in Excel, it's definitely not worth it.
Thank you!

The state of this patch is Abandoned so no worries there. LOL

Yes, I remember when it happened, but I remembered that forgot to say thanks to Brecht personaly for stopping our worries.
We appreciate this.

There are many possible things that at first glance seem convenient and useful, but in fact create more problems that they solve.

so no worries

In our company, we remembered the development of the blender for 2020, and I realized that this moment was remembered as a favorite to me.