[Bf-blender-cvs] [003be8aa7c6] master: UI: Use same precision in "Move" redo panel as elsewhere

Julian Eisel noreply at git.blender.org
Thu Jan 16 12:14:45 CET 2020


Commit: 003be8aa7c6d837d43bdadb99f60cd5f6dca72bd
Author: Julian Eisel
Date:   Thu Jan 16 12:08:17 2020 +0100
Branches: master
https://developer.blender.org/rB003be8aa7c6d837d43bdadb99f60cd5f6dca72bd

UI: Use same precision in "Move" redo panel as elsewhere

The floating "Move" redo panel showed transform values with less
precision than in other places (e.g. sidebar and properties editor).
With Millimeters as unit it would even round to full integers, which
may be an issue since you typically work at higher precisions with this
unit.

Note that this only applies to the visual precision, internally we use
full floating point `float`s still.

Fixes T70367.

===================================================================

M	source/blender/editors/transform/transform_ops.c
M	source/blender/makesrna/RNA_define.h
M	source/blender/makesrna/intern/rna_define.c

===================================================================

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,



More information about the Bf-blender-cvs mailing list