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-06 10:53:16 +0300
committerFalk David <falkdavid@gmx.de>2021-02-06 11:07:50 +0300
commiteccc57aa5c791009634ffe8a1e41472ce02317f5 (patch)
tree5bddd8657ae66bed15381f3945728244fe1ea268
parenta5637756491ca1b9baa544ad86f74627f6333d04 (diff)
Fix T85378: Shrink/Fatten display number units
Currently the displayed distance when using the shrink/fatten transform operator does not respect the scene units (they would always be in blender units). This changes makes sure the number is displayed in the correct unit. Reviewed By: mano-wii Maniphest Tasks: T85378 Differential Revision: https://developer.blender.org/D10325
-rw-r--r--source/blender/editors/transform/transform_mode_shrink_fatten.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/editors/transform/transform_mode_shrink_fatten.c b/source/blender/editors/transform/transform_mode_shrink_fatten.c
index 2a5c631df41..ba5b1229f3e 100644
--- a/source/blender/editors/transform/transform_mode_shrink_fatten.c
+++ b/source/blender/editors/transform/transform_mode_shrink_fatten.c
@@ -64,6 +64,7 @@ static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
int i;
char str[UI_MAX_DRAW_STR];
size_t ofs = 0;
+ UnitSettings *unit = &t->scene->unit;
distance = t->values[0];
@@ -74,15 +75,21 @@ static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
t->values_final[0] = distance;
/* header print for NumInput */
- ofs += BLI_strncpy_rlen(str + ofs, TIP_("Shrink/Fatten:"), sizeof(str) - ofs);
+ ofs += BLI_strncpy_rlen(str + ofs, TIP_("Shrink/Fatten: "), sizeof(str) - ofs);
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
- outputNumInput(&(t->num), c, &t->scene->unit);
- ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, " %s", c);
+ outputNumInput(&(t->num), c, unit);
+ ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, "%s", c);
}
else {
/* default header print */
- ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, " %.4f", distance);
+ if (unit != NULL) {
+ ofs += BKE_unit_value_as_string(
+ str + ofs, sizeof(str) - ofs, distance * unit->scale_length, 4, B_UNIT_LENGTH, unit, true);
+ }
+ else {
+ ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, "%.4f", distance);
+ }
}
if (t->proptext[0]) {