[Bf-blender-cvs] [5a37f69467a] greasepencil-object: New Draw mode "Boxes"
Antonio Vazquez
noreply at git.blender.org
Wed Feb 28 10:28:35 CET 2018
Commit: 5a37f69467ac06d2d1bb78553b9901c984d17422
Author: Antonio Vazquez
Date: Wed Feb 28 10:28:24 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rB5a37f69467ac06d2d1bb78553b9901c984d17422
New Draw mode "Boxes"
This draw rectangles instead of Dots and allow new artistic effects.
===================================================================
M source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M source/blender/draw/engines/gpencil/gpencil_engine.h
M source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
M source/blender/makesdna/DNA_brush_types.h
M source/blender/makesrna/intern/rna_palette.c
===================================================================
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 224b68e3599..09de1ce5f74 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -457,6 +457,7 @@ DRWShadingGroup *DRW_gpencil_shgroup_point_create(GPENCIL_e_data *e_data, GPENCI
stl->shgroups[id].keep_size = (int)((gpd) && (gpd->flag & GP_DATA_STROKE_KEEPTHICKNESS));
DRW_shgroup_uniform_int(grp, "keep_size", &stl->shgroups[id].keep_size, 1);
+ stl->shgroups[id].mode = palcolor->mode;
stl->shgroups[id].stroke_style = palcolor->stroke_style;
stl->shgroups[id].color_type = GPENCIL_COLOR_SOLID;
if ((palcolor->stroke_style == STROKE_STYLE_TEXTURE) && (!onion)) {
@@ -472,9 +473,11 @@ DRWShadingGroup *DRW_gpencil_shgroup_point_create(GPENCIL_e_data *e_data, GPENCI
stl->storage->obj_scale = 1.0f;
stl->storage->keep_size = 0;
stl->storage->pixfactor = GP_DEFAULT_PIX_FACTOR;
+ stl->storage->mode = palcolor->mode;
DRW_shgroup_uniform_float(grp, "objscale", &stl->storage->obj_scale, 1);
DRW_shgroup_uniform_int(grp, "keep_size", &stl->storage->keep_size, 1);
DRW_shgroup_uniform_int(grp, "color_type", &stl->storage->color_type, 1);
+ DRW_shgroup_uniform_int(grp, "mode", &stl->storage->mode, 1);
if (gpd) {
DRW_shgroup_uniform_float(grp, "pixfactor", &gpd->pixfactor, 1);
}
diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.h b/source/blender/draw/engines/gpencil/gpencil_engine.h
index 65887aa2a7e..f5fdaba4ea6 100644
--- a/source/blender/draw/engines/gpencil/gpencil_engine.h
+++ b/source/blender/draw/engines/gpencil/gpencil_engine.h
@@ -143,6 +143,7 @@ typedef struct GPENCIL_shgroup {
int s_clamp;
int stroke_style;
int color_type;
+ int mode;
int t_mix;
int t_flip;
int t_clamp;
@@ -158,6 +159,7 @@ typedef struct GPENCIL_Storage {
float unit_matrix[4][4];
int stroke_style;
int color_type;
+ int mode;
int xray;
int keep_size;
float obj_scale;
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
index e77e3df13aa..ad90a30af4a 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl
@@ -1,4 +1,5 @@
uniform int color_type;
+uniform int mode;
uniform sampler2D myTexture;
in vec4 mColor;
@@ -7,6 +8,9 @@ out vec4 fragColor;
#define texture2D texture
+#define GPENCIL_MODE_DOTS 1
+#define GPENCIL_MODE_BOX 2
+
/* keep this list synchronized with list in gpencil_engine.h */
#define GPENCIL_COLOR_SOLID 0
#define GPENCIL_COLOR_TEXTURE 1
@@ -19,7 +23,7 @@ void main()
const float rad_squared = 0.25;
// round point with jaggy edges
- if (dist_squared > rad_squared)
+ if ((mode == GPENCIL_MODE_DOTS) && (dist_squared > rad_squared))
discard;
vec4 tmp_color = texture2D(myTexture, mTexCoord);
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 9692c849b30..01913e021e4 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -194,6 +194,7 @@ typedef enum ePaletteColor_Flag {
typedef enum ePaletteColor_Mode {
PAC_MODE_LINE = 0, /* line */
PAC_MODE_DOTS = 1, /* dots */
+ PAC_MODE_BOX = 2, /* rectangles */
} ePaletteColor_Mode;
typedef struct Palette {
diff --git a/source/blender/makesrna/intern/rna_palette.c b/source/blender/makesrna/intern/rna_palette.c
index db1dee1f651..49ff54f74f7 100644
--- a/source/blender/makesrna/intern/rna_palette.c
+++ b/source/blender/makesrna/intern/rna_palette.c
@@ -236,6 +236,7 @@ static void rna_def_palettecolor(BlenderRNA *brna)
static EnumPropertyItem palettecolor_mode_types_items[] = {
{ PAC_MODE_LINE, "LINE", 0, "Line", "Draw strokes using a continuous line" },
{ PAC_MODE_DOTS, "DOTS", 0, "Dots", "Draw strokes using separated dots" },
+ { PAC_MODE_BOX, "BOX", 0, "Boxes", "Draw strokes using separated rectangle boxes" },
{ 0, NULL, 0, NULL, NULL }
};
More information about the Bf-blender-cvs
mailing list