diff options
-rw-r--r-- | source/blender/blenlib/intern/math_matrix.c | 1 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 76 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_mesh.c | 6 |
3 files changed, 42 insertions, 41 deletions
diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index 6e8f4622488..6c06da2e32d 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -309,6 +309,7 @@ void mul_v3_m4v3(float *in, float mat[][4], float *vec) in[2]= x*mat[0][2] + y*mat[1][2] + mat[2][2]*vec[2] + mat[3][2]; } +/* same as mul_m4_v3() but doesnt apply translation component */ void mul_mat3_m4_v3(float mat[][4], float *vec) { float x,y; diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 981c11114b2..6e9b437dbc5 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -2082,13 +2082,15 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E Mesh *me= ob->data; EditEdge *eed; EditFace *efa; - float v1[3], v2[3], v3[3], v4[3], x, y, z; + float v1[3], v2[3], v3[3], v4[3], vmid[3]; float fvec[3]; char val[32]; /* Stores the measurement display text here */ char conv_float[5]; /* Use a float conversion matching the grid size */ float area, col[3]; /* area of the face, color of the text to draw */ float grid= unit->system ? unit->scale_length : v3d->grid; - int do_split= unit->flag & USER_UNIT_OPT_SPLIT; + const int do_split= unit->flag & USER_UNIT_OPT_SPLIT; + const int do_global= v3d->flag & V3D_GLOBAL_STATS; + const int do_moving= G.moving; if(v3d->flag2 & V3D_RENDER_OVERRIDE) return; @@ -2121,24 +2123,22 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E for(eed= em->edges.first; eed; eed= eed->next) { /* draw non fgon edges, or selected edges, or edges next to selected verts while draging */ - if((eed->h != EM_FGON) && ((eed->f & SELECT) || (G.moving && ((eed->v1->f & SELECT) || (eed->v2->f & SELECT)) ))) { - VECCOPY(v1, eed->v1->co); - VECCOPY(v2, eed->v2->co); - - x= 0.5f*(v1[0]+v2[0]); - y= 0.5f*(v1[1]+v2[1]); - z= 0.5f*(v1[2]+v2[2]); - - if(v3d->flag & V3D_GLOBAL_STATS) { - mul_m4_v3(ob->obmat, v1); - mul_m4_v3(ob->obmat, v2); + if((eed->h != EM_FGON) && ((eed->f & SELECT) || (do_moving && ((eed->v1->f & SELECT) || (eed->v2->f & SELECT)) ))) { + copy_v3_v3(v1, eed->v1->co); + copy_v3_v3(v2, eed->v2->co); + + interp_v3_v3v3(vmid, v1, v2, 0.5f); + + if(do_global) { + mul_mat3_m4_v3(ob->obmat, v1); + mul_mat3_m4_v3(ob->obmat, v2); } if(unit->system) bUnit_AsString(val, sizeof(val), len_v3v3(v1, v2)*unit->scale_length, 3, unit->system, B_UNIT_LENGTH, do_split, FALSE); else sprintf(val, conv_float, len_v3v3(v1, v2)); - view3d_cached_text_draw_add(x, y, z, val, 0, 0); + view3d_cached_text_draw_add(vmid[0], vmid[1], vmid[2], val, 0, 0); } } } @@ -2153,18 +2153,18 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E glColor3fv(col); for(efa= em->faces.first; efa; efa= efa->next) { - if((efa->f & SELECT)) { // XXX || (G.moving && faceselectedOR(efa, SELECT)) ) { - VECCOPY(v1, efa->v1->co); - VECCOPY(v2, efa->v2->co); - VECCOPY(v3, efa->v3->co); + if((efa->f & SELECT)) { // XXX || (do_moving && faceselectedOR(efa, SELECT)) ) { + copy_v3_v3(v1, efa->v1->co); + copy_v3_v3(v2, efa->v2->co); + copy_v3_v3(v3, efa->v3->co); if (efa->v4) { - VECCOPY(v4, efa->v4->co); + copy_v3_v3(v4, efa->v4->co); } - if(v3d->flag & V3D_GLOBAL_STATS) { - mul_m4_v3(ob->obmat, v1); - mul_m4_v3(ob->obmat, v2); - mul_m4_v3(ob->obmat, v3); - if (efa->v4) mul_m4_v3(ob->obmat, v4); + if(do_global) { + mul_mat3_m4_v3(ob->obmat, v1); + mul_mat3_m4_v3(ob->obmat, v2); + mul_mat3_m4_v3(ob->obmat, v3); + if (efa->v4) mul_mat3_m4_v3(ob->obmat, v4); } if (efa->v4) @@ -2192,20 +2192,20 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E glColor3fv(col); for(efa= em->faces.first; efa; efa= efa->next) { - VECCOPY(v1, efa->v1->co); - VECCOPY(v2, efa->v2->co); - VECCOPY(v3, efa->v3->co); + copy_v3_v3(v1, efa->v1->co); + copy_v3_v3(v2, efa->v2->co); + copy_v3_v3(v3, efa->v3->co); if(efa->v4) { - VECCOPY(v4, efa->v4->co); + copy_v3_v3(v4, efa->v4->co); } else { - VECCOPY(v4, v3); + copy_v3_v3(v4, v3); } - if(v3d->flag & V3D_GLOBAL_STATS) { - mul_m4_v3(ob->obmat, v1); - mul_m4_v3(ob->obmat, v2); - mul_m4_v3(ob->obmat, v3); - mul_m4_v3(ob->obmat, v4); + if(do_global) { + mul_mat3_m4_v3(ob->obmat, v1); + mul_mat3_m4_v3(ob->obmat, v2); + mul_mat3_m4_v3(ob->obmat, v3); + mul_mat3_m4_v3(ob->obmat, v4); /* intentionally executed even for tri's */ } e1= efa->e1; @@ -2215,19 +2215,19 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E /* Calculate the angles */ - if( (e4->f & e1->f & SELECT) || (G.moving && (efa->v1->f & SELECT)) ) { + if( (e4->f & e1->f & SELECT) || (do_moving && (efa->v1->f & SELECT)) ) { /* Vec 1 */ sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v4, v1, v2))); interp_v3_v3v3(fvec, efa->cent, efa->v1->co, 0.8f); view3d_cached_text_draw_add(fvec[0], fvec[1], fvec[2], val, 0, 0); } - if( (e1->f & e2->f & SELECT) || (G.moving && (efa->v2->f & SELECT)) ) { + if( (e1->f & e2->f & SELECT) || (do_moving && (efa->v2->f & SELECT)) ) { /* Vec 2 */ sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v1, v2, v3))); interp_v3_v3v3(fvec, efa->cent, efa->v2->co, 0.8f); view3d_cached_text_draw_add(fvec[0], fvec[1], fvec[2], val, 0, 0); } - if( (e2->f & e3->f & SELECT) || (G.moving && (efa->v3->f & SELECT)) ) { + if( (e2->f & e3->f & SELECT) || (do_moving && (efa->v3->f & SELECT)) ) { /* Vec 3 */ if(efa->v4) sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v2, v3, v4))); @@ -2238,7 +2238,7 @@ static void draw_em_measure_stats(View3D *v3d, RegionView3D *rv3d, Object *ob, E } /* Vec 4 */ if(efa->v4) { - if( (e3->f & e4->f & SELECT) || (G.moving && (efa->v4->f & SELECT)) ) { + if( (e3->f & e4->f & SELECT) || (do_moving && (efa->v4->f & SELECT)) ) { sprintf(val,"%.3f", RAD2DEG(angle_v3v3v3(v3, v4, v1))); interp_v3_v3v3(fvec, efa->cent, efa->v4->co, 0.8f); view3d_cached_text_draw_add(fvec[0], fvec[1], fvec[2], val, 0, 0); diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index f2a0d5e8955..6e172e3bdd0 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -1847,17 +1847,17 @@ static void rna_def_mesh(BlenderRNA *brna) prop= RNA_def_property(srna, "draw_edge_length", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_EDGELEN); - RNA_def_property_ui_text(prop, "Edge Length", "Displays selected edge lengths"); + RNA_def_property_ui_text(prop, "Edge Length", "Displays selected edge lengths, Using global values when set in the transform panel"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "draw_edge_angle", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_EDGEANG); - RNA_def_property_ui_text(prop, "Edge Angles", "Displays the angles in the selected edges in degrees"); + RNA_def_property_ui_text(prop, "Edge Angles", "Displays the angles in the selected edges in degrees, Using global values when set in the transform panel"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); prop= RNA_def_property(srna, "draw_face_area", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "drawflag", ME_DRAW_FACEAREA); - RNA_def_property_ui_text(prop, "Face Area", "Displays the area of selected faces"); + RNA_def_property_ui_text(prop, "Face Area", "Displays the area of selected faces, Using global values when set in the transform panel"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); /* editflag */ |