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:
authorJacques Lucke <mail@jlucke.com>2018-10-03 11:20:16 +0300
committerJacques Lucke <mail@jlucke.com>2018-10-03 11:20:16 +0300
commit2d21eb79ad48485bc7b3385d6df5c2c25fd88ee0 (patch)
tree57d18e1020c8acc2d46110bd43c0721dc30b7d76 /source/blender/draw/modes/edit_mesh_mode_text.c
parent1c3411ac899d1ae8dfd790249a53054698bdd1e8 (diff)
Units: Support for fixed units
Users can select the main unit they want to use now. Previously the displayed unit always depended on the magnitude of the value. The old behavior can be restored by switching to the "Adaptive" mode for length, mass and time units. Meters, kilograms and seconds are the default units for new and old scenes. The selected unit is also the default unit for user input. E.g. if cm is selected, whenever the user inputs a unitless number into a field of type length, it will be interpreted as cm. Reviewer: brecht Differential: https://developer.blender.org/D3740
Diffstat (limited to 'source/blender/draw/modes/edit_mesh_mode_text.c')
-rw-r--r--source/blender/draw/modes/edit_mesh_mode_text.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/source/blender/draw/modes/edit_mesh_mode_text.c b/source/blender/draw/modes/edit_mesh_mode_text.c
index e81f181d636..d2bfc75a2bf 100644
--- a/source/blender/draw/modes/edit_mesh_mode_text.c
+++ b/source/blender/draw/modes/edit_mesh_mode_text.c
@@ -66,7 +66,6 @@ void DRW_edit_mesh_mode_text_measure_stats(
uchar col[4] = {0, 0, 0, 255}; /* color of the text to draw */
float area; /* area of the face */
float grid = unit->system ? unit->scale_length : v3d->grid;
- const bool do_split = (unit->flag & USER_UNIT_OPT_SPLIT) != 0;
const bool do_global = (v3d->flag & V3D_GLOBAL_STATS) != 0;
const bool do_moving = (G.moving & G_TRANSFORM_EDIT) != 0;
/* when 2 edge-info options are enabled, space apart */
@@ -118,9 +117,9 @@ void DRW_edit_mesh_mode_text_measure_stats(
}
if (unit->system) {
- numstr_len = bUnit_AsString(
- numstr, sizeof(numstr), len_v3v3(v1, v2) * unit->scale_length, 3,
- unit->system, B_UNIT_LENGTH, do_split, false);
+ numstr_len = bUnit_AsString2(
+ numstr, sizeof(numstr), len_v3v3(v1, v2) * unit->scale_length, 3,
+ B_UNIT_LENGTH, unit, false);
}
else {
numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), conv_float, len_v3v3(v1, v2));
@@ -231,10 +230,10 @@ void DRW_edit_mesh_mode_text_measure_stats(
mul_m4_v3(ob->obmat, vmid);
if (unit->system) {
- numstr_len = bUnit_AsString(
+ numstr_len = bUnit_AsString2(
numstr, sizeof(numstr),
(double)(area * unit->scale_length * unit->scale_length),
- 3, unit->system, B_UNIT_AREA, do_split, false);
+ 3, B_UNIT_AREA, unit, false);
}
else {
numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), conv_float, area);