Units display visual bug (rounding to integer) #70367

Closed
opened 2019-09-29 19:51:39 +02:00 by Eugene Du · 11 comments

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: ba90d2efa5
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 {key 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

**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: `ba90d2efa5` 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 {key 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
Author

Added subscriber: @APEC

Added subscriber: @APEC
Member
Added subscribers: @WilliamReynish, @JulianEisel, @JacquesLucke, @lichtwerk
Member

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

CC @WilliamReynish
CC @JacquesLucke
CC @JulianEisel

I agree this looks like an unneccessary inconsistency [compared to how it is displayed elsewhere...]. CC @WilliamReynish CC @JacquesLucke CC @JulianEisel

Changed status from 'Needs Developer To Reproduce' to: 'Confirmed'

Changed status from 'Needs Developer To Reproduce' to: 'Confirmed'
Member

Added subscribers: @ideasman42, @brecht

Added subscribers: @ideasman42, @brecht
Member

Would propose this as a fix: P1209: Potential fix for #70367

diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index b2d8671fbce..09992e8be0e 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -720,7 +720,7 @@ static void TRANSFORM_OT_translate(struct wmOperatorType *ot)
   ot->poll = ED_operator_screenactive;
   ot->poll_property = transform_poll_property;
 
-  RNA_def_float_vector_xyz(
+  RNA_def_float_translation(
       ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Move", "", -FLT_MAX, FLT_MAX);
 
   WM_operatortype_props_advanced_begin(ot);
diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h
index 0beb14614ec..349b30fa64e 100644
--- a/source/blender/makesrna/RNA_define.h
+++ b/source/blender/makesrna/RNA_define.h
@@ -233,6 +233,16 @@ PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont,
                                   const char *ui_description,
                                   float softmin,
                                   float softmax);
+PropertyRNA *RNA_def_float_translation(StructOrFunctionRNA *cont,
+                                       const char *identifier,
+                                       int len,
+                                       const float *default_value,
+                                       float hardmin,
+                                       float hardmax,
+                                       const char *ui_name,
+                                       const char *ui_description,
+                                       float softmin,
+                                       float softmax);
 PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont,
                                     const char *identifier,
                                     int len,
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index 55aa529a30e..73a59cbba11 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -3888,6 +3888,36 @@ PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont_,
   return prop;
 }
 
+PropertyRNA *RNA_def_float_translation(StructOrFunctionRNA *cont_,
+                                       const char *identifier,
+                                       int len,
+                                       const float *default_value,
+                                       float hardmin,
+                                       float hardmax,
+                                       const char *ui_name,
+                                       const char *ui_description,
+                                       float softmin,
+                                       float softmax)
+{
+  PropertyRNA *prop;
+
+  prop = RNA_def_float_vector(cont_,
+                              identifier,
+                              len,
+                              default_value,
+                              hardmin,
+                              hardmax,
+                              ui_name,
+                              ui_description,
+                              softmin,
+                              softmax);
+  prop->subtype = PROP_TRANSLATION;
+
+  RNA_def_property_ui_range(prop, softmin, softmax, 1, RNA_TRANSLATION_PREC_DEFAULT);
+
+  return prop;
+}
+
 PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont_,
                                     const char *identifier,
                                     int len,

@ideasman42, @brecht, objections?

Would propose this as a fix: [P1209: Potential fix for #70367](https://archive.blender.org/developer/P1209.txt) ``` diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index b2d8671fbce..09992e8be0e 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -720,7 +720,7 @@ static void TRANSFORM_OT_translate(struct wmOperatorType *ot) ot->poll = ED_operator_screenactive; ot->poll_property = transform_poll_property; - RNA_def_float_vector_xyz( + RNA_def_float_translation( ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Move", "", -FLT_MAX, FLT_MAX); WM_operatortype_props_advanced_begin(ot); diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index 0beb14614ec..349b30fa64e 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -233,6 +233,16 @@ PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont, const char *ui_description, float softmin, float softmax); +PropertyRNA *RNA_def_float_translation(StructOrFunctionRNA *cont, + const char *identifier, + int len, + const float *default_value, + float hardmin, + float hardmax, + const char *ui_name, + const char *ui_description, + float softmin, + float softmax); PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont, const char *identifier, int len, diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 55aa529a30e..73a59cbba11 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -3888,6 +3888,36 @@ PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont_, return prop; } +PropertyRNA *RNA_def_float_translation(StructOrFunctionRNA *cont_, + const char *identifier, + int len, + const float *default_value, + float hardmin, + float hardmax, + const char *ui_name, + const char *ui_description, + float softmin, + float softmax) +{ + PropertyRNA *prop; + + prop = RNA_def_float_vector(cont_, + identifier, + len, + default_value, + hardmin, + hardmax, + ui_name, + ui_description, + softmin, + softmax); + prop->subtype = PROP_TRANSLATION; + + RNA_def_property_ui_range(prop, softmin, softmax, 1, RNA_TRANSLATION_PREC_DEFAULT); + + return prop; +} + PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont_, const char *identifier, int len, ``` @ideasman42, @brecht, objections?

This issue was referenced by 003be8aa7c

This issue was referenced by 003be8aa7c6d837d43bdadb99f60cd5f6dca72bd
Member

Changed status from 'Confirmed' to: 'Resolved'

Changed status from 'Confirmed' to: 'Resolved'
Julian Eisel self-assigned this 2020-01-16 12:15:04 +01:00
Member

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.

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.
Author

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

2.png

3.png
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.
4.png
It's still a visual inconsistency.

Can I open this again? Yes it now visually have the same numbers, but it incorrect because rounding to integer is still exist. ![1.png](https://archive.blender.org/developer/F8470718/1.png) ![2.png](https://archive.blender.org/developer/F8470722/2.png) ![3.png](https://archive.blender.org/developer/F8470723/3.png) 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. ![4.png](https://archive.blender.org/developer/F8470704/4.png) It's still a visual inconsistency.
Author

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?
1a.png

1b.png
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.
1c.png

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? ![1a.png](https://archive.blender.org/developer/F8473999/1a.png) ![1b.png](https://archive.blender.org/developer/F8474001/1b.png) 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. ![1c.png](https://archive.blender.org/developer/F8474007/1c.png)
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#70367
No description provided.