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:
authorCampbell Barton <ideasman42@gmail.com>2010-11-23 17:14:06 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-11-23 17:14:06 +0300
commit0e9b664fce0ab0c3d5bbf9042c76ffdff8c60fbc (patch)
tree943ca96ca1edb78117fabb5a874121fbd7b05156 /source/blender/editors
parent4aeeee88198b97ede58b09188f588746b0dfe8f1 (diff)
Changes to the ortho grid drawing based on discussion with Ton.
- ortho grid now draws scaled by the view3d 'Scale' setting, venomgfx noticed this was missing. - so as not to confuse add scale next to unit display text, so rather then "Metres" it shows "Metres x 1.5" otherwise its confusing that grid lines are not in exact units. - changed grid spacing to grid scale (needed for more logical behavior with units) - when units are enabled grey out subdivisions.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index f05c28fad27..f8e972d1122 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -243,7 +243,7 @@ static void drawgrid_draw(ARegion *ar, float wx, float wy, float x, float y, flo
#define GRID_MIN_PX 6.0f
-static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, char **grid_unit)
+static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **grid_unit)
{
/* extern short bgpicmode; */
RegionView3D *rv3d= ar->regiondata;
@@ -266,7 +266,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, char **grid_u
x= (wx)*fx/fw;
y= (wy)*fy/fw;
- vec4[0]=vec4[1]= (unit->system) ? 1.0 : v3d->grid;
+ vec4[0]=vec4[1]= v3d->grid;
vec4[2]= 0.0;
vec4[3]= 1.0;
@@ -306,7 +306,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, char **grid_u
/* Store the smallest drawn grid size units name so users know how big each grid cell is */
if(*grid_unit==NULL) {
*grid_unit= bUnit_GetNameDisplay(usys, i);
- rv3d->gridview= (scalar / unit->scale_length);
+ rv3d->gridview= (scalar / unit->scale_length) * v3d->grid;
}
blend_fac= 1-((GRID_MIN_PX*2)/dx_scalar);
@@ -2287,7 +2287,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
int retopo= 0, sculptparticle= 0;
unsigned int lay_used;
Object *obact = OBACT;
- char *grid_unit= NULL;
+ const char *grid_unit= NULL;
/* from now on all object derived meshes check this */
v3d->customdata_mask= get_viewedit_datamask(CTX_wm_screen(C), scene, obact);
@@ -2507,8 +2507,14 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
draw_viewport_name(ar, v3d);
}
if (grid_unit) { /* draw below the viewport name */
+ char tstr[32]= "";
+
UI_ThemeColor(TH_TEXT_HI);
- BLF_draw_default(22, ar->winy-(USER_SHOW_VIEWPORTNAME?40:20), 0.0f, grid_unit, 65535); /* XXX, use real length */
+ if(v3d->grid != 1.0f) {
+ BLI_snprintf(tstr, sizeof(tstr), "%s x %.4g", v3d->grid, grid_unit);
+ }
+
+ BLF_draw_default(22, ar->winy-(USER_SHOW_VIEWPORTNAME?40:20), 0.0f, tstr[0]?tstr : grid_unit, sizeof(tstr)); /* XXX, use real length */
}
ob= OBACT;