[Bf-blender-cvs] [ce5454091cb] greasepencil-refactor: GPencil: Remove Checker Fill mode
Antonio Vazquez
noreply at git.blender.org
Wed Dec 11 16:43:34 CET 2019
Commit: ce5454091cb12bb74a20f1776172f739cefae8f1
Author: Antonio Vazquez
Date: Wed Dec 11 16:43:27 2019 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rBce5454091cb12bb74a20f1776172f739cefae8f1
GPencil: Remove Checker Fill mode
This mode is redundant with textures and only adds complexity for something that can be solved easily using a checker texture.
Also, old files are patched as SOLID fill.
===================================================================
M release/scripts/presets/gpencil_material/fill_only.py
M release/scripts/presets/gpencil_material/stroke_and_fill.py
M release/scripts/presets/gpencil_material/stroke_only.py
M release/scripts/startup/bl_operators/presets.py
M release/scripts/startup/bl_ui/properties_material_gpencil.py
M source/blender/blenkernel/intern/material.c
M source/blender/blenloader/intern/versioning_280.c
M source/blender/draw/engines/gpencil/gpencil_draw_data.c
M source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl
M source/blender/editors/gpencil/drawgpencil.c
M source/blender/editors/gpencil/gpencil_ops_versioning.c
M source/blender/makesdna/DNA_material_types.h
M source/blender/makesrna/intern/rna_material.c
===================================================================
diff --git a/release/scripts/presets/gpencil_material/fill_only.py b/release/scripts/presets/gpencil_material/fill_only.py
index c60811d25bc..f99e6928557 100644
--- a/release/scripts/presets/gpencil_material/fill_only.py
+++ b/release/scripts/presets/gpencil_material/fill_only.py
@@ -22,7 +22,6 @@ gpcolor.pattern_shift = (0.0, 0.0)
gpcolor.pattern_scale = (1.0, 1.0)
gpcolor.pattern_radius = 0.5
gpcolor.pattern_angle = 0.0
-gpcolor.pattern_gridsize = 0.1
gpcolor.use_fill_pattern = False
gpcolor.texture_offset = (0.0, 0.0)
gpcolor.texture_scale = (1.0, 1.0)
diff --git a/release/scripts/presets/gpencil_material/stroke_and_fill.py b/release/scripts/presets/gpencil_material/stroke_and_fill.py
index ee18eeb0114..c03cfc2bd22 100644
--- a/release/scripts/presets/gpencil_material/stroke_and_fill.py
+++ b/release/scripts/presets/gpencil_material/stroke_and_fill.py
@@ -22,7 +22,6 @@ gpcolor.pattern_shift = (0.0, 0.0)
gpcolor.pattern_scale = (1.0, 1.0)
gpcolor.pattern_radius = 0.5
gpcolor.pattern_angle = 0.0
-gpcolor.pattern_gridsize = 0.1
gpcolor.use_fill_pattern = False
gpcolor.texture_offset = (0.0, 0.0)
gpcolor.texture_scale = (1.0, 1.0)
diff --git a/release/scripts/presets/gpencil_material/stroke_only.py b/release/scripts/presets/gpencil_material/stroke_only.py
index 3ca05c6a073..8c814f39905 100644
--- a/release/scripts/presets/gpencil_material/stroke_only.py
+++ b/release/scripts/presets/gpencil_material/stroke_only.py
@@ -22,7 +22,6 @@ gpcolor.pattern_shift = (0.0, 0.0)
gpcolor.pattern_scale = (1.0, 1.0)
gpcolor.pattern_radius = 0.5
gpcolor.pattern_angle = 0.0
-gpcolor.pattern_gridsize = 0.1
gpcolor.use_fill_pattern = False
gpcolor.texture_offset = (0.0, 0.0)
gpcolor.texture_scale = (1.0, 1.0)
diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py
index 3595e059df3..a8ef354cc1b 100644
--- a/release/scripts/startup/bl_operators/presets.py
+++ b/release/scripts/startup/bl_operators/presets.py
@@ -687,7 +687,6 @@ class AddPresetGpencilMaterial(AddPresetBase, Operator):
"gpcolor.pattern_scale",
"gpcolor.pattern_radius",
"gpcolor.pattern_angle",
- "gpcolor.pattern_gridsize",
"gpcolor.use_fill_pattern",
"gpcolor.texture_offset",
"gpcolor.texture_scale",
diff --git a/release/scripts/startup/bl_ui/properties_material_gpencil.py b/release/scripts/startup/bl_ui/properties_material_gpencil.py
index 1f4ec108c58..4e014441fb8 100644
--- a/release/scripts/startup/bl_ui/properties_material_gpencil.py
+++ b/release/scripts/startup/bl_ui/properties_material_gpencil.py
@@ -198,27 +198,24 @@ class MATERIAL_PT_gpencil_fillcolor(GPMaterialButtonsPanel, Panel):
if gpcolor.fill_style != 'TEXTURE':
col.prop(gpcolor, "fill_color", text="Base Color")
- if gpcolor.fill_style in {'GRADIENT', 'CHECKER'}:
+ if gpcolor.fill_style == 'GRADIENT':
col.prop(gpcolor, "mix_color", text="Secondary Color")
if gpcolor.fill_style == 'GRADIENT':
col.prop(gpcolor, "mix_factor", text="Mix Factor", slider=True)
- if gpcolor.fill_style in {'GRADIENT', 'CHECKER'}:
+ if gpcolor.fill_style == 'GRADIENT':
col.prop(gpcolor, "flip", text="Flip Colors")
col.prop(gpcolor, "pattern_shift", text="Location")
col.prop(gpcolor, "pattern_scale", text="Scale")
- if gpcolor.gradient_type == 'RADIAL' and gpcolor.fill_style not in {'SOLID', 'CHECKER'}:
+ if gpcolor.gradient_type == 'RADIAL' and gpcolor.fill_style == 'SOLID':
col.prop(gpcolor, "pattern_radius", text="Radius")
else:
if gpcolor.fill_style != 'SOLID':
col.prop(gpcolor, "pattern_angle", text="Angle")
- if gpcolor.fill_style == 'CHECKER':
- col.prop(gpcolor, "pattern_gridsize", text="Box Size")
-
# Texture
if gpcolor.fill_style == 'TEXTURE' or (gpcolor.use_fill_texture_mix is True and gpcolor.fill_style == 'SOLID'):
col.template_ID(gpcolor, "fill_image", open="image.open")
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 54432c8da74..21637f24c44 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -121,7 +121,6 @@ void BKE_material_init_gpencil_settings(Material *ma)
/* set basic settings */
gp_style->stroke_rgba[3] = 1.0f;
gp_style->fill_rgba[3] = 1.0f;
- gp_style->pattern_gridsize = 0.1f;
gp_style->gradient_radius = 0.5f;
ARRAY_SET_ITEMS(gp_style->mix_rgba, 1.0f, 1.0f, 1.0f, 0.2f);
ARRAY_SET_ITEMS(gp_style->gradient_scale, 1.0f, 1.0f);
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index a35e4cc0d75..258b4142397 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -4309,5 +4309,15 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
}
}
+
+ /* Set Checker material as Solid for Grease Pencil. This fill mode has been removed
+ * and replaced by textures. */
+ {
+ for (Material *mat = bmain->materials.first; mat; mat = mat->id.next) {
+ if ((mat->gp_style) && (mat->gp_style->fill_style == GP_STYLE_FILL_STYLE_CHECKER)) {
+ mat->gp_style->fill_style = GP_STYLE_FILL_STYLE_SOLID;
+ }
+ }
+ }
}
}
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_data.c b/source/blender/draw/engines/gpencil/gpencil_draw_data.c
index 52e67cb2030..116d237d7e1 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_data.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_data.c
@@ -151,19 +151,6 @@ GPENCIL_MaterialPool *gpencil_material_pool_create(GPENCIL_PrivateData *pd, Obje
mat_data->flag &= ~GP_FILL_TEXTURE_USE;
copy_v4_v4(mat_data->fill_color, gp_style->fill_rgba);
}
- else if (gp_style->fill_style == GP_STYLE_FILL_STYLE_CHECKER) {
- pool->tex_fill[mat_id] = pd->checker_tex;
- mat_data->flag |= GP_FILL_TEXTURE_USE;
- gpencil_uv_transform_get(gp_style->gradient_shift,
- gp_style->gradient_scale,
- gp_style->gradient_angle,
- mat_data->fill_uv_transform);
- copy_v4_v4(mat_data->fill_color, gp_style->fill_rgba);
- copy_v4_v4(mat_data->fill_mix_color, gp_style->mix_rgba);
- if (gp_style->flag & GP_STYLE_COLOR_FLIP_FILL) {
- swap_v4_v4(mat_data->fill_color, mat_data->fill_mix_color);
- }
- }
else /* if (gp_style->fill_style == GP_STYLE_FILL_STYLE_SOLID) */ {
pool->tex_fill[mat_id] = NULL;
mat_data->flag &= ~GP_FILL_TEXTURE_USE;
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index ed2f962ab05..8237bb358b0 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -179,9 +179,8 @@ void gpencil_object_visible_stroke_iter(Object *ob,
#define SOLID 0
#define GRADIENT 1
#define RADIAL 2
-#define CHECKER 3
-#define TEXTURE 4
-#define PATTERN 5
+#define TEXTURE 3
+#define PATTERN 4
/* Verify if must fade object or not. */
static bool gpencil_fade_object_check(GPENCIL_StorageList *stl, Object *ob)
@@ -542,9 +541,6 @@ static DRWShadingGroup *gpencil_shgroup_fill_create(GPENCIL_e_data *e_data,
stl->shgroups[id].fill_style = RADIAL;
}
break;
- case GP_STYLE_FILL_STYLE_CHECKER:
- stl->shgroups[id].fill_style = CHECKER;
- break;
case GP_STYLE_FILL_STYLE_TEXTURE:
if (gp_style->flag & GP_STYLE_FILL_PATTERN) {
stl->shgroups[id].fill_style = PATTERN;
@@ -563,7 +559,6 @@ static DRWShadingGroup *gpencil_shgroup_fill_create(GPENCIL_e_data *e_data,
DRW_shgroup_uniform_float(grp, "gradient_angle", &gp_style->gradient_angle, 1);
DRW_shgroup_uniform_float(grp, "gradient_radius", &gp_style->gradient_radius, 1);
- DRW_shgroup_uniform_float(grp, "pattern_gridsize", &gp_style->pattern_gridsize, 1);
DRW_shgroup_uniform_vec2(grp, "gradient_scale", gp_style->gradient_scale, 1);
DRW_shgroup_uniform_vec2(grp, "gradient_shift", gp_style->gradient_shift, 1);
diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl
index 8285541e0b4..b61251555c9 100644
--- a/source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl
+++ b/source/blender/draw/engines/gpencil/shaders/gpencil_fill_frag.glsl
@@ -4,7 +4,6 @@ uniform float mix_factor;
uniform float gradient_angle;
uniform float gradient_radius;
-uniform float pattern_gridsize;
uniform vec2 gradient_scale;
uniform vec2 gradient_shift;
@@ -36,9 +35,8 @@ uniform float fade_ob_factor;
#define SOLID 0
#define GRADIENT 1
#define RADIAL 2
-#define CHECKER 3
-#define TEXTURE 4
-#define PATTERN 5
+#define TEXTURE 3
+#define PATTERN 4
#define GP_XRAY_FRONT 0
#define GP_XRAY_3DSPACE 1
@@ -110,7 +108,6 @@ void main()
texture_read_as_srgb(
myTexture, myTexturePremultiplied, clamp(rot_tex * texture_scale, 0.0, 1.0));
vec4 text_color = vec4(tmp_color[0], tmp_color[1], tmp_color[2], tmp_color[3] * texture_opacity);
- vec4 checker_color;
/* wireframe with x-ray discard */
if ((viewport_xray == 1) && (shading_type[0] == OB_WIRE)) {
@@ -159,20 +156,6 @@ void main()
texture_flip,
fragColor);
}
- /* Checkerboard */
- if (fill_type == CHECKER) {
- vec2 pos = rot / pattern_gridsize;
- if ((fract(pos.x) < 0.5 && fract(pos.y) < 0.5) ||
- (fract(pos.x) > 0.5 && fract(pos.y) > 0.5)) {
- checker_color = (texture_flip == 0) ? finalColor : color2;
- }
- else {
- checker_color = (texture_flip == 0) ? color2 : finalColor;
- }
- /* mix with texture */
- fragColor = (texture_mix =
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list