[Bf-blender-cvs] [1b9dd08d028] soc-2021-uv-editor-improvements: Merge branch 'master' into soc-2021-uv-editor-improvements

Siddhartha Jejurkar noreply at git.blender.org
Wed Sep 22 17:39:03 CEST 2021


Commit: 1b9dd08d0281f00ba96b2e6b74c7c9b662663c1b
Author: Siddhartha Jejurkar
Date:   Wed Sep 22 21:07:15 2021 +0530
Branches: soc-2021-uv-editor-improvements
https://developer.blender.org/rB1b9dd08d0281f00ba96b2e6b74c7c9b662663c1b

Merge branch 'master' into soc-2021-uv-editor-improvements

===================================================================



===================================================================

diff --cc source/blender/draw/engines/overlay/overlay_grid.c
index 9d0f03b0cfe,60cda9f2d61..e3e3c23d347
--- a/source/blender/draw/engines/overlay/overlay_grid.c
+++ b/source/blender/draw/engines/overlay/overlay_grid.c
@@@ -63,40 -61,22 +63,31 @@@ void OVERLAY_grid_init(OVERLAY_Data *ve
  
    if (pd->space_type == SPACE_IMAGE) {
      SpaceImage *sima = (SpaceImage *)draw_ctx->space_data;
-     View2D *v2d = &draw_ctx->region->v2d;
+     if (sima->mode == SI_MODE_UV || !ED_space_image_has_buffer(sima)) {
+       shd->grid_flag = GRID_BACK | PLANE_IMAGE | SHOW_GRID;
+     }
+     else {
+       shd->grid_flag = 0;
+     }
  
-     shd->grid_flag = ED_space_image_has_buffer(sima) ? 0 : PLANE_IMAGE | SHOW_GRID;
      shd->grid_distance = 1.0f;
-     copy_v3_fl3(
-         shd->grid_size, (float)sima->tile_grid_shape[0], (float)sima->tile_grid_shape[1], 1.0f);
- 
-     /**
-      * Previously the UV/Image Editor grid was static :
-      * - 0-1 UV space divided into 4x4 divisions marked by thick grid lines (1 grid unit = 0.25 UV
-      *   units)
-      * - 0-1 UV space divided into 16x16 divisions marked by thin grid lines (1 grid unit = 0.0625
-      *   UV units)
-      *
-      * The new UV/Image Editor grid now supports 2 grid types :
-      * - Subdividing grid : Similar to the 3D viewport grid (zooming in adds more divisions to the
-      *   grid) [T89789]
-      * - Dynamic grid : Users create a desired NxN grid by using options exposed in UI [T78389]
-      */
- 
-     if (sima->flag & SI_DYNAMIC_GRID) {
-       shd->grid_flag |= DYNAMIC_GRID;
-       /* Temporary fix : dynamic_grid_size is not using the default value (=1) assignd in RNA */
-       sima->dynamic_grid_size = (sima->dynamic_grid_size == 0) ? 1 : sima->dynamic_grid_size;
+     copy_v3_fl3(shd->grid_size, 1.0f, 1.0f, 1.0f);
+     if (sima->mode == SI_MODE_UV) {
+       shd->grid_size[0] = (float)sima->tile_grid_shape[0];
+       shd->grid_size[1] = (float)sima->tile_grid_shape[1];
+     }
+     for (int step = 0; step < 8; step++) {
+       shd->grid_steps[step] = powf(4, step) * (1.0f / 16.0f);
      }
 +    /* N denotes the grid dimension when zoomed out (NxN grid).
 +     * While zooming in, each grid division further subdivides into smaller NxN divisions
 +     *
 +     * If this value is changed, then also update the value in initSnapSpatial()
 +     * TODO? : Probably best to move this value to SpaceImage/View2D struct */
 +    int N = 8;
 +    shd->zoom_factor = ED_space_image_zoom_level(v2d, N);
 +
 +    ED_space_image_grid_steps(sima, shd->grid_steps, N);
      return;
    }



More information about the Bf-blender-cvs mailing list