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:
authorPhilipp Oeser <info@graphics-engineer.com>2019-12-04 13:05:02 +0300
committerPhilipp Oeser <info@graphics-engineer.com>2019-12-19 15:53:56 +0300
commite0afee86b3527bd30cad8319385ccb3bc2a255b4 (patch)
tree7f802d3899f7ae7e11eea5f75a5b9880e39e9d4e /source/blender/draw/intern/draw_manager_text.c
parent701338d31c7718ae64637c3fe24ddd03a977ae0c (diff)
Fix T72128: Overlay: Edge indices stacking on top of edge measurements
Make indices accommodate into the measures of edgelength and edgeangle so this results in a nice stack of up to three rows. Maniphest Tasks: T72128 Differential Revision: https://developer.blender.org/D6357
Diffstat (limited to 'source/blender/draw/intern/draw_manager_text.c')
-rw-r--r--source/blender/draw/intern/draw_manager_text.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/source/blender/draw/intern/draw_manager_text.c b/source/blender/draw/intern/draw_manager_text.c
index 38e8544de07..4abc96375a3 100644
--- a/source/blender/draw/intern/draw_manager_text.c
+++ b/source/blender/draw/intern/draw_manager_text.c
@@ -213,14 +213,23 @@ void DRW_text_edit_mesh_measure_stats(ARegion *ar,
float grid = unit->system ? unit->scale_length : v3d->grid;
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 */
- const bool do_edge_textpair = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGE_LEN) &&
- (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGE_ANG);
- const short edge_texpair_sep = (short)(5.0f * U.dpi_fac);
float clip_planes[4][4];
/* allow for displaying shape keys and deform mods */
BMIter iter;
+ /* when 2 or more edge-info options are enabled, space apart */
+ short edge_tex_count = 0;
+ if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGE_LEN) {
+ edge_tex_count += 1;
+ }
+ if (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGE_ANG) {
+ edge_tex_count += 1;
+ }
+ if ((v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_INDICES) && (em->selectmode & SCE_SELECT_EDGE)) {
+ edge_tex_count += 1;
+ }
+ const short edge_tex_sep = (short)((edge_tex_count - 1) * 5.0f * U.dpi_fac);
+
/* make the precision of the display value proportionate to the gridsize */
if (grid <= 0.01f) {
@@ -290,7 +299,7 @@ void DRW_text_edit_mesh_measure_stats(ARegion *ar,
numstr,
numstr_len,
0,
- (do_edge_textpair) ? edge_texpair_sep : 0,
+ edge_tex_sep,
txt_flag,
col);
}
@@ -352,7 +361,7 @@ void DRW_text_edit_mesh_measure_stats(ARegion *ar,
numstr,
numstr_len,
0,
- (do_edge_textpair) ? -edge_texpair_sep : 0,
+ -edge_tex_sep,
txt_flag,
col);
}
@@ -494,6 +503,9 @@ void DRW_text_edit_mesh_measure_stats(ARegion *ar,
if (em->selectmode & SCE_SELECT_EDGE) {
BMEdge *e;
+ const bool use_edge_tex_sep = (edge_tex_count == 2);
+ const bool use_edge_tex_len = (v3d->overlay.edit_flag & V3D_OVERLAY_EDIT_EDGE_LEN);
+
BM_ITER_MESH_INDEX (e, &iter, em->bm, BM_EDGES_OF_MESH, i) {
if (BM_elem_flag_test(e, BM_ELEM_SELECT)) {
float v1_clip[3], v2_clip[3];
@@ -506,7 +518,14 @@ void DRW_text_edit_mesh_measure_stats(ARegion *ar,
mul_m4_v3(ob->obmat, vmid);
numstr_len = BLI_snprintf_rlen(numstr, sizeof(numstr), "%d", i);
- DRW_text_cache_add(dt, vmid, numstr, numstr_len, 0, 0, txt_flag, col);
+ DRW_text_cache_add(dt,
+ vmid,
+ numstr,
+ numstr_len,
+ 0,
+ (use_edge_tex_sep) ? (use_edge_tex_len) ? -edge_tex_sep : edge_tex_sep : 0,
+ txt_flag,
+ col);
}
}
}