Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-04-08 22:55:08 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-04-08 22:55:08 +0400
commit2b2099cd519d2723dd79af2e1d9035c7cbb12022 (patch)
treea12fa477bb34c227d9ea69811347f796927b48c7 /source/blender/blenkernel/intern/unit.c
parentd2b55d1171af787f603c6c14129224dc1c038e85 (diff)
Fix #34875: 0 digits of precision was not supported for FloatProperty, now
you can specify precision=0 for this, and use -1 for the default 2.
Diffstat (limited to 'source/blender/blenkernel/intern/unit.c')
-rw-r--r--source/blender/blenkernel/intern/unit.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c
index 066b6eff5c5..c0dba657dd7 100644
--- a/source/blender/blenkernel/intern/unit.c
+++ b/source/blender/blenkernel/intern/unit.c
@@ -366,12 +366,14 @@ static int unit_as_string(char *str, int len_max, double value, int prec, bUnitC
* jump about while dragging */
i = len - 1;
- while (i > 0 && str[i] == '0') { /* 4.300 -> 4.3 */
- str[i--] = pad;
- }
+ if (prec > 0) {
+ while (i > 0 && str[i] == '0') { /* 4.300 -> 4.3 */
+ str[i--] = pad;
+ }
- if (i > 0 && str[i] == '.') { /* 10. -> 10 */
- str[i--] = pad;
+ if (i > 0 && str[i] == '.') { /* 10. -> 10 */
+ str[i--] = pad;
+ }
}
/* Now add the suffix */