diff options
-rw-r--r-- | release/scripts/startup/bl_ui/space_view3d_toolbar.py | 2 | ||||
-rw-r--r-- | source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl | 29 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 2 |
3 files changed, 26 insertions, 7 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py index 2ec1e20116c..81804f6a399 100644 --- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py +++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py @@ -1729,7 +1729,7 @@ class VIEW3D_PT_tools_grease_pencil_brush_option(View3DPanel, Panel): col.separator() subcol = col.column(align=True) - if ma and ma.grease_pencil.mode != 'DOTS': + if ma and ma.grease_pencil.mode == 'LINE': subcol.enabled = False subcol.prop(gp_settings, "gradient_factor", slider=True) subcol.prop(gp_settings, "gradient_shape") 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 204d1962a51..b7206ac2e80 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_point_frag.glsl @@ -24,23 +24,40 @@ out vec4 fragColor; #define GPENCIL_COLOR_PATTERN 2 /* Function to check the point inside ellipse */ -float checkpoint(vec2 pt, vec2 radius) +float check_ellipse_point(vec2 pt, vec2 radius) { float p = (pow(pt.x, 2) / pow(radius.x, 2)) + (pow(pt.y, 2) / pow(radius.y, 2)); return p; } +/* Function to check the point inside box */ +vec2 check_box_point(vec2 pt, vec2 radius) +{ + vec2 rtn; + rtn.x = abs(pt.x) / radius.x; + rtn.y = abs(pt.y) / radius.y; + + return rtn; +} + void main() { vec2 centered = mTexCoord - vec2(0.5); - float ellip = checkpoint(centered, vec2(gradient_s / 2.0)); + float ellip = check_ellipse_point(centered, vec2(gradient_s / 2.0)); + vec2 box; if (mode != GPENCIL_MODE_BOX) { if (ellip > 1.0) { discard; } } + else { + box = check_box_point(centered, vec2(gradient_s / 2.0)); + if ((box.x > 1.0) || (box.y > 1.0)) { + discard; + } + } vec4 tmp_color = texture2D(myTexture, mTexCoord); @@ -70,11 +87,13 @@ void main() fragColor.a = min(text_color.a * mColor.a, mColor.a); } - if ((mode == GPENCIL_MODE_DOTS) && (gradient_f < 1.0)) { - float dist = length(centered) * 2; + if (gradient_f < 1.0) { + float dist = length(centered) * 2.0; float decay = dist * (1.0 - gradient_f) * fragColor.a; fragColor.a = clamp(fragColor.a - decay, 0.0, 1.0); - fragColor.a = fragColor.a * (1.0 - ellip); + if (mode == GPENCIL_MODE_DOTS) { + fragColor.a = fragColor.a * (1.0 - ellip); + } } if (fragColor.a < 0.0035) { diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index 6dc5a9cfd6a..d5c9dfb8d02 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -1246,7 +1246,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna) RNA_def_property_float_default(prop, 1.0f); RNA_def_property_ui_text(prop, "Border Opacity Factor", - "Amount of gradient for Dot strokes (set to 1 for full solid)"); + "Amount of gradient for Dot and Box strokes (set to 1 for full solid)"); RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); /* gradient shape ratio */ |