[Bf-blender-cvs] [a5cd3cb99fd] greasepencil-refactor: GPencil: Rename GP_STYLE_* to GP_MATERIAL_*
Antonio Vazquez
noreply at git.blender.org
Thu Jan 9 17:28:13 CET 2020
Commit: a5cd3cb99fd1dd442035ae5b522129e3572f506a
Author: Antonio Vazquez
Date: Thu Jan 9 17:28:06 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rBa5cd3cb99fd1dd442035ae5b522129e3572f506a
GPencil: Rename GP_STYLE_* to GP_MATERIAL_*
This makes code easy to understand.
===================================================================
M source/blender/blenkernel/intern/gpencil.c
M source/blender/blenkernel/intern/material.c
M source/blender/blenloader/intern/versioning_280.c
M source/blender/blenloader/intern/versioning_defaults.c
M source/blender/draw/engines/gpencil/gpencil_draw_data.c
M source/blender/draw/engines/gpencil/gpencil_engine.c
M source/blender/draw/engines/overlay/overlay_gpencil.c
M source/blender/draw/engines/overlay/overlay_outline.c
M source/blender/editors/gpencil/drawgpencil.c
M source/blender/editors/gpencil/gpencil_add_monkey.c
M source/blender/editors/gpencil/gpencil_add_stroke.c
M source/blender/editors/gpencil/gpencil_convert.c
M source/blender/editors/gpencil/gpencil_data.c
M source/blender/editors/gpencil/gpencil_edit.c
M source/blender/editors/gpencil/gpencil_fill.c
M source/blender/editors/gpencil/gpencil_merge.c
M source/blender/editors/gpencil/gpencil_ops_versioning.c
M source/blender/editors/gpencil/gpencil_paint.c
M source/blender/editors/gpencil/gpencil_primitive.c
M source/blender/editors/gpencil/gpencil_utils.c
M source/blender/editors/gpencil/gpencil_vertex_ops.c
M source/blender/editors/interface/interface_eyedropper_gpencil_color.c
M source/blender/makesdna/DNA_material_types.h
M source/blender/makesrna/intern/rna_material.c
===================================================================
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 4ea2258ca06..af38de70a05 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2399,7 +2399,7 @@ bool BKE_gpencil_merge_materials_table_get(Object *ob,
gp_style_secondary = ma_secondary->gp_style;
if ((gp_style_primary == NULL) || (gp_style_secondary == NULL) ||
- (gp_style_secondary->flag & GP_STYLE_COLOR_LOCKED)) {
+ (gp_style_secondary->flag & GP_MATERIAL_LOCKED)) {
continue;
}
@@ -2409,13 +2409,13 @@ bool BKE_gpencil_merge_materials_table_get(Object *ob,
}
/* Check materials have same stroke and fill attributes. */
- if ((gp_style_primary->flag & GP_STYLE_STROKE_SHOW) !=
- (gp_style_secondary->flag & GP_STYLE_STROKE_SHOW)) {
+ if ((gp_style_primary->flag & GP_MATERIAL_STROKE_SHOW) !=
+ (gp_style_secondary->flag & GP_MATERIAL_STROKE_SHOW)) {
continue;
}
- if ((gp_style_primary->flag & GP_STYLE_FILL_SHOW) !=
- (gp_style_secondary->flag & GP_STYLE_FILL_SHOW)) {
+ if ((gp_style_primary->flag & GP_MATERIAL_FILL_SHOW) !=
+ (gp_style_secondary->flag & GP_MATERIAL_FILL_SHOW)) {
continue;
}
@@ -2813,7 +2813,7 @@ void BKE_gpencil_recalc_geometry_caches(Object *ob,
if (gps->flag & GP_STROKE_RECALC_GEOMETRY) {
/* Calculate triangles cache for filling area (must be done only after changes) */
if ((gps->tot_triangles == 0) || (gps->triangles == NULL)) {
- if ((gps->totpoints > 2) && (gp_style->flag & GP_STYLE_FILL_SHOW) &&
+ if ((gps->totpoints > 2) && (gp_style->flag & GP_MATERIAL_FILL_SHOW) &&
((gp_style->fill_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH) || (gp_style->fill_style > 0) ||
(gpl->blend_mode != eGplBlendMode_Regular))) {
BKE_gpencil_triangulate_stroke_fill((bGPdata *)ob->data, gps);
@@ -3210,7 +3210,8 @@ static int gpencil_check_same_material_color(Object *ob_gp, float color[4], Mate
float hsv2[4];
rgb_to_hsv_v(gp_style->fill_rgba, hsv2);
hsv2[3] = gp_style->fill_rgba[3];
- if ((gp_style->fill_style == GP_STYLE_FILL_STYLE_SOLID) && (compare_v4v4(hsv1, hsv2, 0.01f))) {
+ if ((gp_style->fill_style == GP_MATERIAL_FILL_STYLE_SOLID) &&
+ (compare_v4v4(hsv1, hsv2, 0.01f))) {
*r_mat = ma;
return i - 1;
}
@@ -3235,24 +3236,24 @@ static Material *gpencil_add_from_curve_material(Main *bmain,
/* Stroke color. */
if (gpencil_lines) {
ARRAY_SET_ITEMS(gp_style->stroke_rgba, 0.0f, 0.0f, 0.0f, 1.0f);
- gp_style->flag |= GP_STYLE_STROKE_SHOW;
+ gp_style->flag |= GP_MATERIAL_STROKE_SHOW;
}
else {
linearrgb_to_srgb_v4(gp_style->stroke_rgba, cu_color);
- gp_style->flag &= ~GP_STYLE_STROKE_SHOW;
+ gp_style->flag &= ~GP_MATERIAL_STROKE_SHOW;
}
/* Fill color. */
linearrgb_to_srgb_v4(gp_style->fill_rgba, cu_color);
/* Fill is false if the original curve hasn't material assigned, so enable it. */
if (fill) {
- gp_style->flag |= GP_STYLE_FILL_SHOW;
+ gp_style->flag |= GP_MATERIAL_FILL_SHOW;
}
/* Check at least one is enabled. */
- if (((gp_style->flag & GP_STYLE_STROKE_SHOW) == 0) &&
- ((gp_style->flag & GP_STYLE_FILL_SHOW) == 0)) {
- gp_style->flag |= GP_STYLE_STROKE_SHOW;
+ if (((gp_style->flag & GP_MATERIAL_STROKE_SHOW) == 0) &&
+ ((gp_style->flag & GP_MATERIAL_FILL_SHOW) == 0)) {
+ gp_style->flag |= GP_MATERIAL_STROKE_SHOW;
}
return mat_gp;
@@ -3411,12 +3412,12 @@ static void gpencil_convert_spline(Main *bmain,
mat_gp->gp_style->stroke_rgba[3] = mat_curve->a;
/* Set fill and stroke depending of curve type (3D or 2D). */
if ((cu->flag & CU_3D) || ((cu->flag & (CU_FRONT | CU_BACK)) == 0)) {
- mat_gp->gp_style->flag |= GP_STYLE_STROKE_SHOW;
- mat_gp->gp_style->flag &= ~GP_STYLE_FILL_SHOW;
+ mat_gp->gp_style->flag |= GP_MATERIAL_STROKE_SHOW;
+ mat_gp->gp_style->flag &= ~GP_MATERIAL_FILL_SHOW;
}
else {
- mat_gp->gp_style->flag &= ~GP_STYLE_STROKE_SHOW;
- mat_gp->gp_style->flag |= GP_STYLE_FILL_SHOW;
+ mat_gp->gp_style->flag &= ~GP_MATERIAL_STROKE_SHOW;
+ mat_gp->gp_style->flag |= GP_MATERIAL_FILL_SHOW;
}
}
}
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 21637f24c44..c5504af3521 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -128,7 +128,7 @@ void BKE_material_init_gpencil_settings(Material *ma)
gp_style->texture_opacity = 1.0f;
gp_style->texture_pixsize = 100.0f;
- gp_style->flag |= GP_STYLE_STROKE_SHOW;
+ gp_style->flag |= GP_MATERIAL_STROKE_SHOW;
}
}
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 518cbdee8ed..88937d0e52d 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -2839,8 +2839,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* grease pencil main material show switches */
for (Material *mat = bmain->materials.first; mat; mat = mat->id.next) {
if (mat->gp_style) {
- mat->gp_style->flag |= GP_STYLE_STROKE_SHOW;
- mat->gp_style->flag |= GP_STYLE_FILL_SHOW;
+ mat->gp_style->flag |= GP_MATERIAL_STROKE_SHOW;
+ mat->gp_style->flag |= GP_MATERIAL_FILL_SHOW;
}
}
}
@@ -4361,20 +4361,20 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
/* Set Checker material as Solid. This fill mode has been removed and replaced
* by textures. */
- if (gp_style->fill_style == GP_STYLE_FILL_STYLE_CHECKER) {
- gp_style->fill_style = GP_STYLE_FILL_STYLE_SOLID;
+ if (gp_style->fill_style == GP_MATERIAL_FILL_STYLE_CHECKER) {
+ gp_style->fill_style = GP_MATERIAL_FILL_STYLE_SOLID;
}
/* Update Alpha channel for texture opacity. */
- if (gp_style->fill_style == GP_STYLE_FILL_STYLE_TEXTURE) {
+ if (gp_style->fill_style == GP_MATERIAL_FILL_STYLE_TEXTURE) {
gp_style->fill_rgba[3] *= gp_style->texture_opacity;
}
/* Stroke stencil mask to mix = 1. */
- if (gp_style->flag & GP_STYLE_STROKE_PATTERN) {
+ if (gp_style->flag & GP_MATERIAL_STROKE_PATTERN) {
gp_style->mix_stroke_factor = 1.0f;
- gp_style->flag &= ~GP_STYLE_STROKE_PATTERN;
+ gp_style->flag &= ~GP_MATERIAL_STROKE_PATTERN;
}
/* Mix disabled, set mix factor to 0. */
- else if ((gp_style->flag & GP_STYLE_STROKE_TEX_MIX) == 0) {
+ else if ((gp_style->flag & GP_MATERIAL_STROKE_TEX_MIX) == 0) {
gp_style->mix_stroke_factor = 0.0f;
}
}
diff --git a/source/blender/blenloader/intern/versioning_defaults.c b/source/blender/blenloader/intern/versioning_defaults.c
index effc4c6fa30..f3394307a7d 100644
--- a/source/blender/blenloader/intern/versioning_defaults.c
+++ b/source/blender/blenloader/intern/versioning_defaults.c
@@ -609,14 +609,14 @@ void BLO_update_defaults_startup_blend(Main *bmain, const char *app_template)
if (ma == NULL) {
ma = BKE_material_add_gpencil(bmain, "Dots Stroke");
}
- ma->gp_style->mode = GP_STYLE_MODE_DOTS;
+ ma->gp_style->mode = GP_MATERIAL_MODE_DOT;
/* Boxes Stroke. */
ma = BLI_findstring(&bmain->materials, "Boxes Stroke", offsetof(ID, name) + 2);
if (ma == NULL) {
ma = BKE_material_add_gpencil(bmain, "Boxes Stroke");
}
- ma->gp_style->mode = GP_STYLE_MODE_BOX;
+ ma->gp_style->mode = GP_MATERIAL_MODE_SQUARE;
/* Reset all grease pencil brushes. */
Scene *scene = bmain->scenes.first;
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_data.c b/source/blender/draw/engines/gpencil/gpencil_draw_data.c
index 12941fab42a..b4835543b89 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_data.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_data.c
@@ -123,34 +123,34 @@ GPENCIL_MaterialPool *gpencil_material_pool_create(GPENCIL_PrivateData *pd, Obje
gpMaterial *mat_data = &pool->mat_data[mat_id];
MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, i + 1);
- if (gp_style->mode == GP_STYLE_MODE_LINE) {
+ if (gp_style->mode == GP_MATERIAL_MODE_LINE) {
mat_data->flag = 0;
}
else {
switch (gp_style->alignment_mode) {
- case GP_STYLE_FOLLOW_PATH:
+ case GP_MATERIAL_FOLLOW_PATH:
mat_data->flag = GP_STROKE_ALIGNMENT_STROKE;
break;
- case GP_STYLE_FOLLOW_OBJ:
+ case GP_MATERIAL_FOLLOW_OBJ:
mat_data->flag = GP_STROKE_ALIGNMENT_OBJECT;
break;
- case GP_STYLE_FOLLOW_FIXED:
+ case GP_MATERIAL_FOLLOW_FIXED:
default:
mat_data->flag = GP_STROKE_ALIGNMENT_FIXED;
break;
}
- if (gp_style->mode == GP_STYLE_MODE_DOTS) {
+ if (gp_style->mode == GP_MATERIAL_MODE_DOT) {
mat_data->flag |= GP_STROKE_DOTS;
}
}
- if ((gp_style->mode != GP_STYLE_MODE_LINE) || (gp_style->flag & GP_STYLE_DISABLE_STENCIL)) {
+ if ((gp_style->mode != GP_MATERIAL_MODE_LINE) || (gp_style->flag & GP_MATERIAL_DISABLE_STENCIL)) {
mat_data->flag |= GP_STROKE_OVERLAP;
}
/* Stroke Style */
- if ((gp_style->stroke_style == GP_STYLE_STROKE_STYLE_TEXTURE) && (gp_style->sima)) {
+ if ((gp_style->stroke_style == GP_MATERIAL_STROKE_STYLE_TEXTURE) && (gp_style->sima)) {
bool premul;
pool->tex_stroke[mat_id] = gpencil_image_texture_get(gp_style->sima, &premul);
mat_data->flag |= pool->tex_stroke[mat_id] ? GP_STROKE_TEXTURE_USE : 0;
@@ -159,7 +159,7 @@ GPENCIL_MaterialPool *gpencil_material_pool_create(GPENCIL_PrivateData *pd, Obje
mat_data->stroke_texture_mix = 1.0f - gp_style->mix_stroke_factor;
mat_data->stroke_u_scale = 500.0f / gp_style->t
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list