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.
This commit is contained in:
Julian Eisel 2020-01-16 12:08:17 +01:00
parent 25cb12dc71
commit 003be8aa7c
Notes: blender-bot 2023-02-14 06:00:49 +01:00
Referenced by issue #70367, Units display visual bug (rounding to integer)
3 changed files with 41 additions and 1 deletions

View File

@ -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);

View File

@ -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,

View File

@ -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,