Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFalk David <falkdavid@gmx.de>2021-02-09 12:33:21 +0300
committerFalk David <falkdavid@gmx.de>2021-02-14 22:51:10 +0300
commit2d3b29de4fc72d5e293deccd2317c001ede703e3 (patch)
treecb4205e7cef6a49b796f5b5d10b31c5f1a63f9f0 /source/blender/editors/mesh/editmesh_inset.c
parenta9092768c0034ca9736d5a386e3aa5dc3232c4cd (diff)
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
Diffstat (limited to 'source/blender/editors/mesh/editmesh_inset.c')
-rw-r--r--source/blender/editors/mesh/editmesh_inset.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/editors/mesh/editmesh_inset.c b/source/blender/editors/mesh/editmesh_inset.c
index 8427458d9cc..9000a942e50 100644
--- a/source/blender/editors/mesh/editmesh_inset.c
+++ b/source/blender/editors/mesh/editmesh_inset.c
@@ -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),