diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2012-05-20 00:16:29 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2012-05-20 00:16:29 +0400 |
commit | 436b63eea5cf994a8aa934a41b34737e2b09ae03 (patch) | |
tree | efadab75c490e9b34acc46d634909c72eaa4cbbe | |
parent | ed679693c9ec825b50666b89a4b1a883e77e58fb (diff) |
Fix [#31535] Radian Unit System Button Ignored for Face Angles display.
Also avoid multiplying each vertex three times with obmat...
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index e69538345bb..111af7fb914 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2951,6 +2951,7 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS if (me->drawflag & ME_DRAWEXTRA_FACEANG) { BMFace *efa; + int is_rad = unit->system_rotation == USER_UNIT_ROT_RADIANS; UI_GetThemeColor3ubv(TH_DRAWEXTRA_FACEANG, col); @@ -2961,37 +2962,41 @@ static void draw_em_measure_stats(View3D *v3d, Object *ob, BMEditMesh *em, UnitS if (is_face_sel || do_moving) { BMIter liter; BMLoop *loop; - int cent_ok = FALSE; + int is_first = TRUE; BM_ITER_ELEM(loop, &liter, efa, BM_LOOPS_OF_FACE) { if (is_face_sel || (do_moving && BM_elem_flag_test(loop->v, BM_ELEM_SELECT))) { - /* yes, we should avoid triple matrix multiply every vertex for 'global' */ float angle; /* lazy init center calc */ - if (cent_ok == FALSE) { + if (is_first) { BM_face_calc_center_bounds(efa, vmid); - cent_ok = TRUE; + /* Avoid triple matrix multiply every vertex for 'global' */ + if (do_global) { + copy_v3_v3(v1, loop->prev->v->co); + copy_v3_v3(v2, loop->v->co); + mul_mat3_m4_v3(ob->obmat, v1); + mul_mat3_m4_v3(ob->obmat, v2); + } + is_first = FALSE; } if (do_global) { - copy_v3_v3(v1, loop->prev->v->co); - copy_v3_v3(v2, loop->v->co); copy_v3_v3(v3, loop->next->v->co); - mul_mat3_m4_v3(ob->obmat, v1); - mul_mat3_m4_v3(ob->obmat, v2); mul_mat3_m4_v3(ob->obmat, v3); angle = angle_v3v3v3(v1, v2, v3); interp_v3_v3v3(fvec, vmid, v2, 0.8f); + copy_v3_v3(v1, v2); + copy_v3_v3(v2, v3); } else { angle = angle_v3v3v3(loop->prev->v->co, loop->v->co, loop->next->v->co); interp_v3_v3v3(fvec, vmid, loop->v->co, 0.8f); } - BLI_snprintf(numstr, sizeof(numstr), "%.3f", RAD2DEGF(angle)); + BLI_snprintf(numstr, sizeof(numstr), "%.3f", is_rad ? angle : RAD2DEGF(angle)); view3d_cached_text_draw_add(fvec, numstr, 0, txt_flag, col); } } |