[Bf-blender-cvs] [92a69a383fb] greasepencil-object: Cleanup: some missing renames from last commit
Campbell Barton
noreply at git.blender.org
Tue May 29 08:52:14 CEST 2018
Commit: 92a69a383fb45107d91b334cc3cb01f25893fea4
Author: Campbell Barton
Date: Tue May 29 08:50:43 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB92a69a383fb45107d91b334cc3cb01f25893fea4
Cleanup: some missing renames from last commit
Also whitespace edits
===================================================================
M source/blender/draw/engines/gpencil/gpencil_draw_utils.c
M source/blender/editors/gpencil/gpencil_paint.c
===================================================================
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
index d2ac45e9c8d..0b2fa2e05b3 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_utils.c
@@ -74,7 +74,7 @@ static bool gpencil_can_draw_stroke(struct MaterialGPencilStyle *gp_style, const
/* calc bounding box in 2d using flat projection data */
static void gpencil_calc_2d_bounding_box(
- const float(*points2d)[2], int totpoints, float minv[2], float maxv[2], bool expand)
+ const float(*points2d)[2], int totpoints, float minv[2], float maxv[2], bool expand)
{
minv[0] = points2d[0][0];
minv[1] = points2d[0][1];
@@ -109,7 +109,8 @@ static void gpencil_calc_2d_bounding_box(
}
/* calc texture coordinates using flat projected points */
-static void gpencil_calc_stroke_fill_uv(const float(*points2d)[2], int totpoints, float minv[2], float maxv[2], float(*r_uv)[2])
+static void gpencil_calc_stroke_fill_uv(
+ const float(*points2d)[2], int totpoints, float minv[2], float maxv[2], float(*r_uv)[2])
{
float d[2];
d[0] = maxv[0] - minv[0];
@@ -229,12 +230,13 @@ void DRW_gpencil_triangulate_stroke_fill(bGPDstroke *gps)
}
/* recalc the internal geometry caches for fill and uvs */
-static void DRW_gpencil_recalc_geometry_caches(Object *ob, MaterialGPencilStyle *gp_style, bGPDstroke *gps) {
+static void DRW_gpencil_recalc_geometry_caches(Object *ob, MaterialGPencilStyle *gp_style, bGPDstroke *gps)
+{
if (gps->flag & GP_STROKE_RECALC_CACHES) {
/* 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->fill[3] > GPENCIL_ALPHA_OPACITY_THRESH) || (gp_style->fill_style > 0)))
+ ((gp_style->fill_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH) || (gp_style->fill_style > 0)))
{
DRW_gpencil_triangulate_stroke_fill(gps);
}
@@ -249,15 +251,16 @@ static void DRW_gpencil_recalc_geometry_caches(Object *ob, MaterialGPencilStyle
}
/* create shading group for filling */
-static DRWShadingGroup *DRW_gpencil_shgroup_fill_create(GPENCIL_e_data *e_data, GPENCIL_Data *vedata, DRWPass *pass,
- GPUShader *shader, bGPdata *gpd, MaterialGPencilStyle *gp_style, int id)
+static DRWShadingGroup *DRW_gpencil_shgroup_fill_create(
+ GPENCIL_e_data *e_data, GPENCIL_Data *vedata, DRWPass *pass,
+ GPUShader *shader, bGPdata *gpd, MaterialGPencilStyle *gp_style, int id)
{
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
/* e_data.gpencil_fill_sh */
DRWShadingGroup *grp = DRW_shgroup_create(shader, pass);
- DRW_shgroup_uniform_vec4(grp, "color2", gp_style->scolor, 1);
+ DRW_shgroup_uniform_vec4(grp, "color2", gp_style->mix_rgba, 1);
stl->shgroups[id].fill_style = gp_style->fill_style;
DRW_shgroup_uniform_int(grp, "fill_type", &stl->shgroups[id].fill_style, 1);
DRW_shgroup_uniform_float(grp, "mix_factor", &gp_style->mix_factor, 1);
@@ -281,7 +284,9 @@ static DRWShadingGroup *DRW_gpencil_shgroup_fill_create(GPENCIL_e_data *e_data,
DRW_shgroup_uniform_int(grp, "xraymode", (const int *) &gpd->xray_mode, 1);
/* image texture */
- if ((gp_style->fill_style == GP_STYLE_FILL_STYLE_TEXTURE) || (gp_style->fill_style == GP_STYLE_FILL_STYLE_PATTERN) || (gp_style->flag & GP_STYLE_COLOR_TEX_MIX)) {
+ if ((gp_style->flag & GP_STYLE_COLOR_TEX_MIX) ||
+ ELEM(gp_style->fill_style, GP_STYLE_FILL_STYLE_TEXTURE, GP_STYLE_FILL_STYLE_PATTERN))
+ {
ImBuf *ibuf;
Image *image = gp_style->ima;
ImageUser iuser = { NULL };
@@ -315,8 +320,9 @@ static DRWShadingGroup *DRW_gpencil_shgroup_fill_create(GPENCIL_e_data *e_data,
}
/* create shading group for strokes */
-DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(GPENCIL_e_data *e_data, GPENCIL_Data *vedata, DRWPass *pass, GPUShader *shader, Object *ob,
- bGPdata *gpd, MaterialGPencilStyle *gp_style, int id, bool onion)
+DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(
+ GPENCIL_e_data *e_data, GPENCIL_Data *vedata, DRWPass *pass, GPUShader *shader, Object *ob,
+ bGPdata *gpd, MaterialGPencilStyle *gp_style, int id, bool onion)
{
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
const float *viewport_size = DRW_viewport_size_get();
@@ -405,8 +411,9 @@ DRWShadingGroup *DRW_gpencil_shgroup_stroke_create(GPENCIL_e_data *e_data, GPENC
}
/* create shading group for volumetrics */
-static DRWShadingGroup *DRW_gpencil_shgroup_point_create(GPENCIL_e_data *e_data, GPENCIL_Data *vedata, DRWPass *pass, GPUShader *shader, Object *ob,
- bGPdata *gpd, MaterialGPencilStyle *gp_style, int id, bool onion)
+static DRWShadingGroup *DRW_gpencil_shgroup_point_create(
+ GPENCIL_e_data *e_data, GPENCIL_Data *vedata, DRWPass *pass, GPUShader *shader, Object *ob,
+ bGPdata *gpd, MaterialGPencilStyle *gp_style, int id, bool onion)
{
GPENCIL_StorageList *stl = ((GPENCIL_Data *)vedata)->stl;
const float *viewport_size = DRW_viewport_size_get();
@@ -417,7 +424,7 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create(GPENCIL_e_data *e_data,
DRW_shgroup_uniform_vec2(grp, "Viewport", viewport_size, 1);
DRW_shgroup_uniform_float(grp, "pixsize", stl->storage->pixsize, 1);
DRW_shgroup_uniform_float(grp, "pixelsize", &U.pixelsize, 1);
-
+
/* avoid wrong values */
if ((gpd) && (gpd->pixfactor == 0)) {
gpd->pixfactor = GP_DEFAULT_PIX_FACTOR;
@@ -498,16 +505,17 @@ static DRWShadingGroup *DRW_gpencil_shgroup_point_create(GPENCIL_e_data *e_data,
}
/* add fill shading group to pass */
-static void gpencil_add_fill_shgroup(GpencilBatchCache *cache, DRWShadingGroup *fillgrp,
- Object *ob, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps,
- const float tintcolor[4], const bool onion, const bool custonion)
+static void gpencil_add_fill_shgroup(
+ GpencilBatchCache *cache, DRWShadingGroup *fillgrp,
+ Object *ob, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps,
+ const float tintcolor[4], const bool onion, const bool custonion)
{
MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1);
if (gps->totpoints >= 3) {
float tfill[4];
/* set color using material, tint color and opacity */
- interp_v3_v3v3(tfill, gps->runtime.tmp_fill, tintcolor, tintcolor[3]);
- tfill[3] = gps->runtime.tmp_fill[3] * gpl->opacity;
+ interp_v3_v3v3(tfill, gps->runtime.tmp_fill_rgba, tintcolor, tintcolor[3]);
+ tfill[3] = gps->runtime.tmp_fill_rgba[3] * gpl->opacity;
if ((tfill[3] > GPENCIL_ALPHA_OPACITY_THRESH) || (gp_style->fill_style > 0)) {
const float *color;
if (!onion) {
@@ -518,7 +526,7 @@ static void gpencil_add_fill_shgroup(GpencilBatchCache *cache, DRWShadingGroup *
color = tintcolor;
}
else {
- ARRAY_SET_ITEMS(tfill, UNPACK3(gps->runtime.tmp_fill), tintcolor[3]);
+ ARRAY_SET_ITEMS(tfill, UNPACK3(gps->runtime.tmp_fill_rgba), tintcolor[3]);
color = tfill;
}
}
@@ -545,12 +553,12 @@ static void gpencil_add_stroke_shgroup(GpencilBatchCache *cache, DRWShadingGroup
if (!onion) {
/* if special stroke, use fill color as stroke color */
if (gps->flag & GP_STROKE_NOFILL) {
- interp_v3_v3v3(tcolor, gps->runtime.tmp_fill, tintcolor, tintcolor[3]);
- tcolor[3] = gps->runtime.tmp_fill[3] * opacity;
+ interp_v3_v3v3(tcolor, gps->runtime.tmp_fill_rgba, tintcolor, tintcolor[3]);
+ tcolor[3] = gps->runtime.tmp_fill_rgba[3] * opacity;
}
else {
- interp_v3_v3v3(tcolor, gps->runtime.tmp_rgb, tintcolor, tintcolor[3]);
- tcolor[3] = gps->runtime.tmp_rgb[3] * opacity;
+ interp_v3_v3v3(tcolor, gps->runtime.tmp_stroke_rgba, tintcolor, tintcolor[3]);
+ tcolor[3] = gps->runtime.tmp_stroke_rgba[3] * opacity;
}
copy_v4_v4(ink, tcolor);
}
@@ -559,7 +567,7 @@ static void gpencil_add_stroke_shgroup(GpencilBatchCache *cache, DRWShadingGroup
copy_v4_v4(ink, tintcolor);
}
else {
- ARRAY_SET_ITEMS(tcolor, gps->runtime.tmp_rgb[0], gps->runtime.tmp_rgb[1], gps->runtime.tmp_rgb[2], opacity);
+ ARRAY_SET_ITEMS(tcolor, UNPACK3(gps->runtime.tmp_stroke_rgba), opacity);
copy_v4_v4(ink, tcolor);
}
}
@@ -580,7 +588,7 @@ static void gpencil_add_stroke_shgroup(GpencilBatchCache *cache, DRWShadingGroup
/* add edit points shading group to pass */
static void gpencil_add_editpoints_shgroup(
- GPENCIL_StorageList *stl, GpencilBatchCache *cache, ToolSettings *ts, Object *ob,
+ GPENCIL_StorageList *stl, GpencilBatchCache *cache, ToolSettings *ts, Object *ob,
bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf, bGPDstroke *gps)
{
MaterialGPencilStyle *gp_style = BKE_material_gpencil_settings_get(ob, gps->mat_nr + 1);
@@ -601,7 +609,10 @@ static void gpencil_add_editpoints_shgroup(
}
if (cache->batch_edlin[cache->cache_idx]) {
if ((obact) && (obact == ob) && (gpd->flag & GP_DATA_STROKE_SHOW_EDIT_LINES)) {
- DRW_shgroup_call_add(stl->g_data->shgrps_edit_line, cache->batch_edlin[cache->cache_idx], gpf->runtime.viewmatrix);
+ DRW_shgroup_call_add(
+ stl->g_data->shgrps_edit_line,
+ cache->batch_edlin[cache->cache_idx],
+ gpf->runtime.viewmatrix);
}
}
/* edit points */
@@ -614,7 +625,10 @@ static void gpencil_add_editpoints_shgroup(
if (cache->batch_edit[cache->cache_idx]) {
if ((obact) && (obact == ob)) {
/* edit pass */
- DRW_shgroup_call_add(stl->g_data->shgrps_edit_point, cache->batch_edit[cache->cache_idx], gpf->runtime.viewmatrix);
+ DRW_shgroup_call_add(
+ stl->g_data->shgrps_edit_point,
+ cache->batch_edit[cache->cache_idx],
+ gpf->runtime.viewmatrix);
}
}
}
@@ -623,8 +637,10 @@ static void gpencil_add_editpoints_shgroup(
}
/* function to draw strokes for onion only */
-static void gpencil_draw_onion_strokes(GpencilBatchCache *cache, GPENCIL_e_data *e_data, void *vedata, Object *ob,
- bGPdata *gpd, bGPDlayer *gpl, bGPDframe *gpf, const float opacity, const float tintcolor[4], const bool custonion)
+static void gpencil_draw_onion_strokes(
+ GpencilBatchCache *cache, GPENCIL_e_data *e_data, void *vedata, Object *ob,
+ bGPdata *gp
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list