Page MenuHome

Units display visual bug (rounding to integer)
Closed, ResolvedPublicBUG

Description

System Information
Operating system: Windows 7
Graphics card: RX270

Blender Version
Broken: 2.8 and 2.81 (sub 12), branch: master, commit date: 2019-09-29 06:28, hash: rBba90d2efa58f
Worked: (optional)

Short description of error
Properties of some operators are displayed rounded

Exact steps for others to reproduce the error

  1. Open General template
  2. Set Properties editor > Scene Properties > Units > Length to millimeters
  3. Open side panel n
  4. Move cube using Move operator or tool
  5. Expand last action area

Properties in last action area are rounded to whole number, while properties in side panel are rounded to 1 decimal place

Event Timeline

Philipp Oeser (lichtwerk) lowered the priority of this task from 90 to 80.Sep 30 2019, 1:53 PM

I agree this looks like an unneccessary inconsistency [compared to how it is displayed elsewhere...].

CC @William Reynish (billreynish)
CC @Jacques Lucke (JacquesLucke)
CC @Julian Eisel (Severin)

Richard Antalik (ISS) changed the task status from Needs Information from Developers to Confirmed.Jan 14 2020, 12:00 PM
Richard Antalik (ISS) updated the task description. (Show Details)

Would propose this as a fix:

1diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
2index b2d8671fbce..09992e8be0e 100644
3--- a/source/blender/editors/transform/transform_ops.c
4+++ b/source/blender/editors/transform/transform_ops.c
5@@ -720,7 +720,7 @@ static void TRANSFORM_OT_translate(struct wmOperatorType *ot)
6 ot->poll = ED_operator_screenactive;
7 ot->poll_property = transform_poll_property;
8
9- RNA_def_float_vector_xyz(
10+ RNA_def_float_translation(
11 ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Move", "", -FLT_MAX, FLT_MAX);
12
13 WM_operatortype_props_advanced_begin(ot);
14diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
15index 0beb14614ec..349b30fa64e 100644
16--- a/source/blender/makesrna/RNA_define.h
17+++ b/source/blender/makesrna/RNA_define.h
18@@ -233,6 +233,16 @@ PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont,
19 const char *ui_description,
20 float softmin,
21 float softmax);
22+PropertyRNA *RNA_def_float_translation(StructOrFunctionRNA *cont,
23+ const char *identifier,
24+ int len,
25+ const float *default_value,
26+ float hardmin,
27+ float hardmax,
28+ const char *ui_name,
29+ const char *ui_description,
30+ float softmin,
31+ float softmax);
32 PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont,
33 const char *identifier,
34 int len,
35diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
36index 55aa529a30e..73a59cbba11 100644
37--- a/source/blender/makesrna/intern/rna_define.c
38+++ b/source/blender/makesrna/intern/rna_define.c
39@@ -3888,6 +3888,36 @@ PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont_,
40 return prop;
41 }
42
43+PropertyRNA *RNA_def_float_translation(StructOrFunctionRNA *cont_,
44+ const char *identifier,
45+ int len,
46+ const float *default_value,
47+ float hardmin,
48+ float hardmax,
49+ const char *ui_name,
50+ const char *ui_description,
51+ float softmin,
52+ float softmax)
53+{
54+ PropertyRNA *prop;
55+
56+ prop = RNA_def_float_vector(cont_,
57+ identifier,
58+ len,
59+ default_value,
60+ hardmin,
61+ hardmax,
62+ ui_name,
63+ ui_description,
64+ softmin,
65+ softmax);
66+ prop->subtype = PROP_TRANSLATION;
67+
68+ RNA_def_property_ui_range(prop, softmin, softmax, 1, RNA_TRANSLATION_PREC_DEFAULT);
69+
70+ return prop;
71+}
72+
73 PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont_,
74 const char *identifier,
75 int len,

@Campbell Barton (campbellbarton), @Brecht Van Lommel (brecht), objections?

Bastien Montagne (mont29) changed the subtype of this task from "Report" to "Bug".Jan 15 2020, 4:26 PM

Went ahead and pushed the proposed fix.

Note that this isn't a bug strictly speaking, just a visual inconsistency. It also increases the visual precision quite a bit for other units - but since we already use the same precision elsewhere, I think it's good to make them match.

Eugene Du (APEC) added a comment.EditedApr 14 2020, 9:38 AM

Can I open this again?
Yes it now visually have the same numbers, but it incorrect because rounding to integer is still exist.


You might think 0.5 mm its a nothing, but in 3d modeling app it's a huge difference between 65 mm and 65.5mm.
However in Edit Mode it show correct position coordinate numbers, but incorrect edge length.

It's still a visual inconsistency.

The same thing is for degree angles.
Tell me, maybe I'm writing in vain here? And do I need to create a new request?


there should be strict specificity in this question, to what number after the decimal point should the value be rounded.
Example how it's look in Modo. It rounding to the fourth number after the decimal point in all values if there are more than four numbers.