Page MenuHome

Restore grid spacing info in 3D views (as present in 2.79)

Authored by Jon Ross (zlsa) on Jul 16 2019, 8:39 AM.



This patch restores prior functionality from 2.79 and before by displaying the current grid spacing in the 3D view.


Also added was a new flag in the eUserpref_UI_Flag enum: USER_SHOW_GRIDSPACING, and a corresponding checkbox in the user preferences. I'm not sure if this is the right (or the best) way to do this, so feedback is welcome.

If I understand correctly, then this option is disabled by default when loading files from before 2.80 (which I believe is the more sane option.)

This legend only shows up when all of the following conditions are met:

  1. The "Grid Spacing" checkbox in the User Preferences (Viewport > Display) is checked.
  2. The 3D view is in orthographic mode.
  3. The 3D view is facing one of the preset cardinal axes.
  4. The unit system is either Metric or Imperial.

If any of the conditions are not met, the legend is not drawn.

This patch resolves T61286.

Diff Detail

rB Blender

Event Timeline

Jon Ross (zlsa) edited the summary of this revision. (Show Details)
Jon Ross (zlsa) edited the summary of this revision. (Show Details)Jul 16 2019, 8:42 AM

Use the existing function in draw_manager to draw text in 3D view.
We already have a patch that proposes to fix the same problem (D4325).
And the problem presented in patch D4379 needs to be resolved first.

Jon Ross (zlsa) abandoned this revision.Jul 16 2019, 8:38 PM

I didn't even see that after searching for it! I'll close this in favor of yours, which seems to handle unit scale properly.

(Side note: I was under the impression ED_view3d_grid_view_scale would return the unit-scale-normalized grid spacing, but it appears that it does not.)