Fix T85488: Display units inset operator

The inset operator would display the inset thickness and depth as
Blender units during transform. This meant that when the scene units
were set to something different than meters, the display value would
give different results than entering the same number using the value
input. (Similar to D10325)

The fix makes sure that the numbers are always displayed in the correct
scene units.

Reviewed By: campbellbarton

Maniphest Tasks: T85488

Differential Revision: https://developer.blender.org/D10366
This commit is contained in:
Falk David 2021-02-09 10:33:21 +01:00
parent a9092768c0
commit 2d3b29de4f
Notes: blender-bot 2023-02-14 07:31:32 +01:00
Referenced by issue #85488, Inset operator status bar shows Thickness value in wrong units
1 changed files with 14 additions and 3 deletions

View File

@ -97,9 +97,20 @@ static void edbm_inset_update_header(wmOperator *op, bContext *C)
outputNumInput(&opdata->num_input, flts_str, &sce->unit);
}
else {
BLI_snprintf(flts_str, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "thickness"));
BLI_snprintf(
flts_str + NUM_STR_REP_LEN, NUM_STR_REP_LEN, "%f", RNA_float_get(op->ptr, "depth"));
BKE_unit_value_as_string(flts_str,
NUM_STR_REP_LEN,
RNA_float_get(op->ptr, "thickness"),
4,
B_UNIT_LENGTH,
&sce->unit,
true);
BKE_unit_value_as_string(flts_str + NUM_STR_REP_LEN,
NUM_STR_REP_LEN,
RNA_float_get(op->ptr, "depth"),
4,
B_UNIT_LENGTH,
&sce->unit,
true);
}
BLI_snprintf(msg,
sizeof(msg),