[Bf-blender-cvs] [9399ae1697c] greasepencil-object: Change Grid to work as 3D Grid
Antonioya
noreply at git.blender.org
Sun Jul 29 17:21:46 CEST 2018
Commit: 9399ae1697cf83d000d3d1616f4009cd631ba586
Author: Antonioya
Date: Sun Jul 29 17:21:38 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB9399ae1697cf83d000d3d1616f4009cd631ba586
Change Grid to work as 3D Grid
Now the scale is the size and the subdivisions the number of cuts inside this "bounding box"
===================================================================
M source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M source/blender/makesdna/DNA_gpencil_types.h
===================================================================
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index 6b4e07281f4..dd5db85f3f4 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -686,7 +686,8 @@ GPUBatch *DRW_gpencil_get_grid(void)
const char *grid_unit = NULL;
const int gridlines = v3d->overlay.gpencil_grid_lines;
const float grid_scale = v3d->overlay.gpencil_grid_scale * ED_scene_grid_scale(scene, &grid_unit);
- const float grid = gridlines * grid_scale;
+ const float grid = grid_scale;
+ const float space = (grid_scale / gridlines);
const uint vertex_len = 2 * (gridlines * 4 + 2);
@@ -701,8 +702,9 @@ GPUBatch *DRW_gpencil_get_grid(void)
GPU_vertbuf_data_alloc(vbo, vertex_len);
int idx = 0;
+
for (int a = 1; a <= gridlines; a++) {
- const float line = a * grid_scale;
+ const float line = a * space;
set_grid_point(vbo, idx, col_grid, pos_id, color_id, -grid, -line, axis);
idx++;
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 9127214bb43..8febfbc8ffc 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -42,7 +42,7 @@ struct MDeformVert;
/* TODO: add size as userprefs parameter */
#define GP_OBGPENCIL_DEFAULT_SIZE 0.2f
#define GP_DEFAULT_PIX_FACTOR 1.0f
-#define GP_DEFAULT_GRID_LINES 15
+#define GP_DEFAULT_GRID_LINES 4
#define GP_MAX_INPUT_SAMPLES 10
/* ***************************************** */
More information about the Bf-blender-cvs
mailing list