From 8a62fa9855124dbfa4001eccc073cb0ee65f9212 Mon Sep 17 00:00:00 2001 From: Antonio Vazquez Date: Fri, 27 Mar 2020 12:31:30 +0100 Subject: GPencil: Cleanup of unused code a arguments --- .../blender/draw/intern/draw_cache_impl_gpencil.c | 2 +- source/blender/editors/gpencil/annotate_draw.c | 53 ++-- source/blender/editors/gpencil/annotate_paint.c | 2 +- source/blender/editors/gpencil/drawgpencil.c | 280 --------------------- source/blender/editors/gpencil/gpencil_convert.c | 24 +- source/blender/editors/gpencil/gpencil_edit.c | 2 +- source/blender/editors/gpencil/gpencil_fill.c | 4 +- source/blender/editors/gpencil/gpencil_intern.h | 4 +- source/blender/editors/gpencil/gpencil_paint.c | 7 +- source/blender/editors/gpencil/gpencil_primitive.c | 17 +- .../blender/editors/gpencil/gpencil_sculpt_paint.c | 3 +- source/blender/editors/gpencil/gpencil_select.c | 2 +- source/blender/editors/gpencil/gpencil_utils.c | 15 +- .../blender/editors/gpencil/gpencil_vertex_paint.c | 3 +- .../blender/editors/gpencil/gpencil_weight_paint.c | 3 +- source/blender/editors/include/ED_gpencil.h | 1 - 16 files changed, 49 insertions(+), 373 deletions(-) (limited to 'source') diff --git a/source/blender/draw/intern/draw_cache_impl_gpencil.c b/source/blender/draw/intern/draw_cache_impl_gpencil.c index 349eb6b00ae..502bc1a3967 100644 --- a/source/blender/draw/intern/draw_cache_impl_gpencil.c +++ b/source/blender/draw/intern/draw_cache_impl_gpencil.c @@ -544,7 +544,7 @@ static void gpencil_sbuffer_stroke_ensure(bGPdata *gpd, bool do_stroke, bool do_ float origin[3]; bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd); ToolSettings *ts = scene->toolsettings; - ED_gpencil_drawing_reference_get(scene, ob, gpl, ts->gpencil_v3d_align, origin); + ED_gpencil_drawing_reference_get(scene, ob, ts->gpencil_v3d_align, origin); for (int i = 0; i < vert_len; i++) { ED_gpencil_tpoint_to_point(region, origin, &tpoints[i], &gps->points[i]); diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c index 5c396ca9041..fc62defd757 100644 --- a/source/blender/editors/gpencil/annotate_draw.c +++ b/source/blender/editors/gpencil/annotate_draw.c @@ -209,7 +209,6 @@ static void annotation_calc_2d_stroke_fxy( /* draw a given stroke - just a single dot (only one point) */ static void annotation_draw_stroke_point(const bGPDspoint *points, short thickness, - short UNUSED(dflag), short sflag, int offsx, int offsy, @@ -252,12 +251,8 @@ static void annotation_draw_stroke_point(const bGPDspoint *points, } /* draw a given stroke in 3d (i.e. in 3d-space), using simple ogl lines */ -static void annotation_draw_stroke_3d(const bGPDspoint *points, - int totpoints, - short thickness, - short UNUSED(sflag), - const float ink[4], - bool cyclic) +static void annotation_draw_stroke_3d( + const bGPDspoint *points, int totpoints, short thickness, const float ink[4], bool cyclic) { float curpressure = points[0].pressure; float cyclic_fpt[3]; @@ -550,9 +545,7 @@ static bool annotation_can_draw_stroke(const bGPDstroke *gps, const int dflag) } /* draw a set of strokes */ -static void annotation_draw_strokes(bGPdata *UNUSED(gpd), - bGPDlayer *UNUSED(gpl), - const bGPDframe *gpf, +static void annotation_draw_strokes(const bGPDframe *gpf, int offsx, int offsy, int winx, @@ -587,11 +580,11 @@ static void annotation_draw_strokes(bGPdata *UNUSED(gpd), /* 3D Lines - OpenGL primitives-based */ if (gps->totpoints == 1) { annotation_draw_stroke_point( - gps->points, lthick, dflag, gps->flag, offsx, offsy, winx, winy, color); + gps->points, lthick, gps->flag, offsx, offsy, winx, winy, color); } else { annotation_draw_stroke_3d( - gps->points, gps->totpoints, lthick, gps->flag, color, gps->flag & GP_STROKE_CYCLIC); + gps->points, gps->totpoints, lthick, color, gps->flag & GP_STROKE_CYCLIC); } if (no_xray) { @@ -605,7 +598,7 @@ static void annotation_draw_strokes(bGPdata *UNUSED(gpd), /* 2D Strokes... */ if (gps->totpoints == 1) { annotation_draw_stroke_point( - gps->points, lthick, dflag, gps->flag, offsx, offsy, winx, winy, color); + gps->points, lthick, gps->flag, offsx, offsy, winx, winy, color); } else { annotation_draw_stroke_2d(gps->points, @@ -626,15 +619,13 @@ static void annotation_draw_strokes(bGPdata *UNUSED(gpd), } /* Draw selected verts for strokes being edited */ -static void annotation_draw_strokes_edit(bGPdata *UNUSED(gpd), - bGPDlayer *gpl, +static void annotation_draw_strokes_edit(bGPDlayer *gpl, const bGPDframe *gpf, int offsx, int offsy, int winx, int winy, short dflag, - short UNUSED(lflag), float alpha) { /* if alpha 0 do not draw */ @@ -754,15 +745,8 @@ static void annotation_draw_strokes_edit(bGPdata *UNUSED(gpd), /* ----- General Drawing ------ */ /* draw onion-skinning for a layer */ -static void annotation_draw_onionskins(bGPdata *gpd, - bGPDlayer *gpl, - bGPDframe *gpf, - int offsx, - int offsy, - int winx, - int winy, - int UNUSED(cfra), - int dflag) +static void annotation_draw_onionskins( + bGPDlayer *gpl, bGPDframe *gpf, int offsx, int offsy, int winx, int winy, int dflag) { const float alpha = 1.0f; float color[4]; @@ -781,8 +765,7 @@ static void annotation_draw_onionskins(bGPdata *gpd, /* alpha decreases with distance from curframe index */ fac = 1.0f - ((float)(gpf->framenum - gf->framenum) / (float)(gpl->gstep + 1)); color[3] = alpha * fac * 0.66f; - annotation_draw_strokes( - gpd, gpl, gf, offsx, offsy, winx, winy, dflag, gpl->thickness, color); + annotation_draw_strokes(gf, offsx, offsy, winx, winy, dflag, gpl->thickness, color); } else { break; @@ -793,8 +776,7 @@ static void annotation_draw_onionskins(bGPdata *gpd, /* draw the strokes for the ghost frames (at half of the alpha set by user) */ if (gpf->prev) { color[3] = (alpha / 7); - annotation_draw_strokes( - gpd, gpl, gpf->prev, offsx, offsy, winx, winy, dflag, gpl->thickness, color); + annotation_draw_strokes(gpf->prev, offsx, offsy, winx, winy, dflag, gpl->thickness, color); } } else { @@ -815,8 +797,7 @@ static void annotation_draw_onionskins(bGPdata *gpd, /* alpha decreases with distance from curframe index */ fac = 1.0f - ((float)(gf->framenum - gpf->framenum) / (float)(gpl->gstep_next + 1)); color[3] = alpha * fac * 0.66f; - annotation_draw_strokes( - gpd, gpl, gf, offsx, offsy, winx, winy, dflag, gpl->thickness, color); + annotation_draw_strokes(gf, offsx, offsy, winx, winy, dflag, gpl->thickness, color); } else { break; @@ -827,8 +808,7 @@ static void annotation_draw_onionskins(bGPdata *gpd, /* draw the strokes for the ghost frames (at half of the alpha set by user) */ if (gpf->next) { color[3] = (alpha / 4); - annotation_draw_strokes( - gpd, gpl, gpf->next, offsx, offsy, winx, winy, dflag, gpl->thickness, color); + annotation_draw_strokes(gpf->next, offsx, offsy, winx, winy, dflag, gpl->thickness, color); } } else { @@ -875,11 +855,11 @@ static void annotation_draw_data_layers( /* Draw 'onionskins' (frame left + right) */ if (gpl->onion_flag & GP_LAYER_ONIONSKIN) { - annotation_draw_onionskins(gpd, gpl, gpf, offsx, offsy, winx, winy, cfra, dflag); + annotation_draw_onionskins(gpl, gpf, offsx, offsy, winx, winy, dflag); } /* draw the strokes already in active frame */ - annotation_draw_strokes(gpd, gpl, gpf, offsx, offsy, winx, winy, dflag, lthick, ink); + annotation_draw_strokes(gpf, offsx, offsy, winx, winy, dflag, lthick, ink); /* Draw verts of selected strokes: * - when doing OpenGL renders, we don't want to be showing these, as that ends up flickering @@ -892,8 +872,7 @@ static void annotation_draw_data_layers( /* XXX: perhaps we don't want to show these when users are drawing... */ if ((G.f & G_FLAG_RENDER_VIEWPORT) == 0 && (gpl->flag & GP_LAYER_LOCKED) == 0 && (gpd->flag & GP_DATA_STROKE_EDITMODE)) { - annotation_draw_strokes_edit( - gpd, gpl, gpf, offsx, offsy, winx, winy, dflag, gpl->flag, alpha); + annotation_draw_strokes_edit(gpl, gpf, offsx, offsy, winx, winy, dflag, alpha); } /* Check if may need to draw the active stroke cache, only if this layer is the active layer diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index 9f2c4070b18..8d3770d3971 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -885,7 +885,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, * eraser region (either within stroke painted, or on its lines) * - this assumes that linewidth is irrelevant */ - if (gp_stroke_inside_circle(mval, mvalo, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { + if (gp_stroke_inside_circle(mval, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { if ((gp_stroke_eraser_is_occluded(p, pt1, pc1[0], pc1[1]) == false) || (gp_stroke_eraser_is_occluded(p, pt2, pc2[0], pc2[1]) == false)) { /* Edge is affected - Check individual points now */ diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 7107aacad37..7b1e985fb7d 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -160,48 +160,6 @@ static void gp_calc_2d_stroke_fxy( } /* ----------- Volumetric Strokes --------------- */ -/* draw a 2D strokes in "volumetric" style */ -static void gp_draw_stroke_volumetric_2d(const bGPDspoint *points, - int totpoints, - short thickness, - short UNUSED(dflag), - short sflag, - int offsx, - int offsy, - int winx, - int winy, - const float diff_mat[4][4], - const float ink[4]) -{ - GPUVertFormat *format = immVertexFormat(); - uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); - uint size = GPU_vertformat_attr_add(format, "size", GPU_COMP_F32, 1, GPU_FETCH_FLOAT); - uint color = GPU_vertformat_attr_add( - format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT); - - immBindBuiltinProgram(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR); - GPU_program_point_size(true); - immBegin(GPU_PRIM_POINTS, totpoints); - - const bGPDspoint *pt = points; - for (int i = 0; i < totpoints; i++, pt++) { - /* transform position to 2D */ - float co[2]; - float fpt[3]; - - mul_v3_m4v3(fpt, diff_mat, &pt->x); - gp_calc_2d_stroke_fxy(fpt, sflag, offsx, offsy, winx, winy, co); - - gp_set_point_varying_color(pt, ink, color, false); - immAttr1f(size, pt->pressure * thickness); /* TODO: scale based on view transform */ - immVertex2f(pos, co[0], co[1]); - } - - immEnd(); - immUnbindProgram(); - GPU_program_point_size(false); -} - /* draw a 3D stroke in "volumetric" style */ static void gp_draw_stroke_volumetric_3d(const bGPDspoint *points, int totpoints, @@ -234,50 +192,6 @@ static void gp_draw_stroke_volumetric_3d(const bGPDspoint *points, /* ----- Existing Strokes Drawing (3D and Point) ------ */ -/* draw a given stroke - just a single dot (only one point) */ -static void gp_draw_stroke_point(const bGPDspoint *points, - short thickness, - short UNUSED(dflag), - short sflag, - int offsx, - int offsy, - int winx, - int winy, - const float diff_mat[4][4], - const float ink[4]) -{ - const bGPDspoint *pt = points; - - /* get final position using parent matrix */ - float fpt[3]; - mul_v3_m4v3(fpt, diff_mat, &pt->x); - - GPUVertFormat *format = immVertexFormat(); - uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); - - if (sflag & GP_STROKE_3DSPACE) { - immBindBuiltinProgram(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); - } - else { - immBindBuiltinProgram(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); - - /* get 2D coordinates of point */ - float co[3] = {0.0f}; - gp_calc_2d_stroke_fxy(fpt, sflag, offsx, offsy, winx, winy, co); - copy_v3_v3(fpt, co); - } - - gp_set_point_uniform_color(pt, ink); - /* set point thickness (since there's only one of these) */ - immUniform1f("size", (float)(thickness + 2) * pt->pressure); - - immBegin(GPU_PRIM_POINTS, 1); - immVertex3fv(pos, fpt); - immEnd(); - - immUnbindProgram(); -} - /* draw a given stroke in 3d (i.e. in 3d-space) */ static void gp_draw_stroke_3d(tGPDdraw *tgpw, short thickness, const float ink[4], bool cyclic) { @@ -370,200 +284,6 @@ static void gp_draw_stroke_3d(tGPDdraw *tgpw, short thickness, const float ink[4 immUnbindProgram(); } -/* ----- Fancy 2D-Stroke Drawing ------ */ - -/* draw a given stroke in 2d */ -static void gp_draw_stroke_2d(const bGPDspoint *points, - int totpoints, - short thickness_s, - short dflag, - short sflag, - bool UNUSED(debug), - int offsx, - int offsy, - int winx, - int winy, - const float diff_mat[4][4], - const float ink[4]) -{ - /* otherwise thickness is twice that of the 3D view */ - float thickness = (float)thickness_s * 0.5f; - - /* strokes in Image Editor need a scale factor, since units there are not pixels! */ - float scalefac = 1.0f; - if ((dflag & GP_DRAWDATA_IEDITHACK) && (dflag & GP_DRAWDATA_ONLYV2D)) { - scalefac = 0.001f; - } - - /* TODO: fancy++ with the magic of shaders */ - - /* tessellation code - draw stroke as series of connected quads (triangle strips in fact) - * with connection edges rotated to minimize shrinking artifacts, and rounded endcaps. - */ - { - const bGPDspoint *pt1, *pt2; - float s0[2], s1[2]; /* segment 'center' points */ - float pm[2]; /* normal from previous segment. */ - int i; - float fpt[3]; - - GPUVertFormat *format = immVertexFormat(); - const struct { - uint pos, color; - } attr_id = { - .pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT), - .color = GPU_vertformat_attr_add( - format, "color", GPU_COMP_U8, 4, GPU_FETCH_INT_TO_FLOAT_UNIT), - }; - - immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); - immBegin(GPU_PRIM_TRI_STRIP, totpoints * 2 + 4); - - /* get x and y coordinates from first point */ - mul_v3_m4v3(fpt, diff_mat, &points->x); - gp_calc_2d_stroke_fxy(fpt, sflag, offsx, offsy, winx, winy, s0); - - for (i = 0, pt1 = points, pt2 = points + 1; i < (totpoints - 1); i++, pt1++, pt2++) { - float t0[2], t1[2]; /* tessellated coordinates */ - float m1[2], m2[2]; /* gradient and normal */ - float mt[2], sc[2]; /* gradient for thickness, point for end-cap */ - float pthick; /* thickness at segment point */ - - /* Get x and y coordinates from point2 - * (point1 has already been computed in previous iteration). */ - mul_v3_m4v3(fpt, diff_mat, &pt2->x); - gp_calc_2d_stroke_fxy(fpt, sflag, offsx, offsy, winx, winy, s1); - - /* calculate gradient and normal - 'angle'=(ny/nx) */ - m1[1] = s1[1] - s0[1]; - m1[0] = s1[0] - s0[0]; - normalize_v2(m1); - m2[1] = -m1[0]; - m2[0] = m1[1]; - - /* always use pressure from first point here */ - pthick = (pt1->pressure * thickness * scalefac); - - /* color of point */ - gp_set_point_varying_color(pt1, ink, attr_id.color, false); - - /* if the first segment, start of segment is segment's normal */ - if (i == 0) { - /* draw start cap first - * - make points slightly closer to center (about halfway across) - */ - mt[0] = m2[0] * pthick * 0.5f; - mt[1] = m2[1] * pthick * 0.5f; - sc[0] = s0[0] - (m1[0] * pthick * 0.75f); - sc[1] = s0[1] - (m1[1] * pthick * 0.75f); - - t0[0] = sc[0] - mt[0]; - t0[1] = sc[1] - mt[1]; - t1[0] = sc[0] + mt[0]; - t1[1] = sc[1] + mt[1]; - - /* First two points of cap. */ - immVertex2fv(attr_id.pos, t0); - immVertex2fv(attr_id.pos, t1); - - /* calculate points for start of segment */ - mt[0] = m2[0] * pthick; - mt[1] = m2[1] * pthick; - - t0[0] = s0[0] - mt[0]; - t0[1] = s0[1] - mt[1]; - t1[0] = s0[0] + mt[0]; - t1[1] = s0[1] + mt[1]; - - /* Last two points of start cap (and first two points of first segment). */ - immVertex2fv(attr_id.pos, t0); - immVertex2fv(attr_id.pos, t1); - } - /* if not the first segment, use bisector of angle between segments */ - else { - float mb[2]; /* bisector normal */ - float athick, dfac; /* actual thickness, difference between thicknesses */ - - /* calculate gradient of bisector (as average of normals) */ - mb[0] = (pm[0] + m2[0]) / 2; - mb[1] = (pm[1] + m2[1]) / 2; - normalize_v2(mb); - - /* calculate gradient to apply - * - as basis, use just pthick * bisector gradient - * - if cross-section not as thick as it should be, add extra padding to fix it - */ - mt[0] = mb[0] * pthick; - mt[1] = mb[1] * pthick; - athick = len_v2(mt); - dfac = pthick - (athick * 2); - - if (((athick * 2.0f) < pthick) && (IS_EQF(athick, pthick) == 0)) { - mt[0] += (mb[0] * dfac); - mt[1] += (mb[1] * dfac); - } - - /* calculate points for start of segment */ - t0[0] = s0[0] - mt[0]; - t0[1] = s0[1] - mt[1]; - t1[0] = s0[0] + mt[0]; - t1[1] = s0[1] + mt[1]; - - /* Last two points of previous segment, and first two points of current segment. */ - immVertex2fv(attr_id.pos, t0); - immVertex2fv(attr_id.pos, t1); - } - - /* if last segment, also draw end of segment (defined as segment's normal) */ - if (i == totpoints - 2) { - /* for once, we use second point's pressure (otherwise it won't be drawn) */ - pthick = (pt2->pressure * thickness * scalefac); - - /* color of point */ - gp_set_point_varying_color(pt2, ink, attr_id.color, false); - - /* calculate points for end of segment */ - mt[0] = m2[0] * pthick; - mt[1] = m2[1] * pthick; - - t0[0] = s1[0] - mt[0]; - t0[1] = s1[1] - mt[1]; - t1[0] = s1[0] + mt[0]; - t1[1] = s1[1] + mt[1]; - - /* Last two points of last segment (and first two points of end cap). */ - immVertex2fv(attr_id.pos, t0); - immVertex2fv(attr_id.pos, t1); - - /* draw end cap as last step - * - make points slightly closer to center (about halfway across) - */ - mt[0] = m2[0] * pthick * 0.5f; - mt[1] = m2[1] * pthick * 0.5f; - sc[0] = s1[0] + (m1[0] * pthick * 0.75f); - sc[1] = s1[1] + (m1[1] * pthick * 0.75f); - - t0[0] = sc[0] - mt[0]; - t0[1] = sc[1] - mt[1]; - t1[0] = sc[0] + mt[0]; - t1[1] = sc[1] + mt[1]; - - /* Last two points of end cap. */ - immVertex2fv(attr_id.pos, t0); - immVertex2fv(attr_id.pos, t1); - } - - /* store computed point2 coordinates as point1 ones of next segment. */ - copy_v2_v2(s0, s1); - /* store stroke's 'natural' normal for next stroke to use */ - copy_v2_v2(pm, m2); - } - - immEnd(); - immUnbindProgram(); - } -} - /* ----- Strokes Drawing ------ */ /* Helper for doing all the checks on whether a stroke can be drawn */ diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c index 6e2c6936b1a..8470fcad9d7 100644 --- a/source/blender/editors/gpencil/gpencil_convert.c +++ b/source/blender/editors/gpencil/gpencil_convert.c @@ -152,7 +152,6 @@ static const EnumPropertyItem *rna_GPConvert_mode_items(bContext *UNUSED(C), * - assumes that the active space is the 3D-View */ static void gp_strokepoint_convertcoords(bContext *C, - bGPdata *UNUSED(gpd), bGPDlayer *gpl, bGPDstroke *gps, bGPDspoint *source_pt, @@ -633,7 +632,6 @@ static void gp_stroke_to_path_add_point(tGpTimingData *gtd, } static void gp_stroke_to_path(bContext *C, - bGPdata *gpd, bGPDlayer *gpl, bGPDstroke *gps, Curve *cu, @@ -708,7 +706,7 @@ static void gp_stroke_to_path(bContext *C, bp = &nu->bp[old_nbp - 1]; /* First point */ - gp_strokepoint_convertcoords(C, gpd, gpl, gps, gps->points, p, subrect); + gp_strokepoint_convertcoords(C, gpl, gps, gps->points, p, subrect); if (prev_bp) { interp_v3_v3v3(p1, bp->vec, prev_bp->vec, -GAP_DFAC); if (do_gtd) { @@ -737,7 +735,7 @@ static void gp_stroke_to_path(bContext *C, /* Second point */ /* Note dt2 is always negative, which marks the gap. */ if (gps->totpoints > 1) { - gp_strokepoint_convertcoords(C, gpd, gpl, gps, gps->points + 1, next_p, subrect); + gp_strokepoint_convertcoords(C, gpl, gps, gps->points + 1, next_p, subrect); interp_v3_v3v3(p2, p, next_p, -GAP_DFAC); if (do_gtd) { dt2 = interpf(gps->points[1].time, gps->points[0].time, -GAP_DFAC); @@ -759,9 +757,9 @@ static void gp_stroke_to_path(bContext *C, float p[3], next_p[3]; float dt = 0.0f; - gp_strokepoint_convertcoords(C, gpd, gpl, gps, gps->points, p, subrect); + gp_strokepoint_convertcoords(C, gpl, gps, gps->points, p, subrect); if (gps->totpoints > 1) { - gp_strokepoint_convertcoords(C, gpd, gpl, gps, gps->points + 1, next_p, subrect); + gp_strokepoint_convertcoords(C, gpl, gps, gps->points + 1, next_p, subrect); interp_v3_v3v3(p, p, next_p, -GAP_DFAC); if (do_gtd) { dt = interpf(gps->points[1].time, gps->points[0].time, -GAP_DFAC); @@ -794,7 +792,7 @@ static void gp_stroke_to_path(bContext *C, float width = pt->pressure * (gps->thickness + gpl->line_change) * WIDTH_CORR_FAC; /* get coordinates to add at */ - gp_strokepoint_convertcoords(C, gpd, gpl, gps, pt, p, subrect); + gp_strokepoint_convertcoords(C, gpl, gps, pt, p, subrect); gp_stroke_to_path_add_point(gtd, bp, @@ -882,7 +880,6 @@ static void gp_stroke_to_bezier_add_point(tGpTimingData *gtd, } static void gp_stroke_to_bezier(bContext *C, - bGPdata *gpd, bGPDlayer *gpl, bGPDstroke *gps, Curve *cu, @@ -934,13 +931,12 @@ static void gp_stroke_to_bezier(bContext *C, /* get initial coordinates */ pt = gps->points; if (tot) { - gp_strokepoint_convertcoords(C, gpd, gpl, gps, pt, (stitch) ? p3d_prev : p3d_cur, subrect); + gp_strokepoint_convertcoords(C, gpl, gps, pt, (stitch) ? p3d_prev : p3d_cur, subrect); if (tot > 1) { - gp_strokepoint_convertcoords( - C, gpd, gpl, gps, pt + 1, (stitch) ? p3d_cur : p3d_next, subrect); + gp_strokepoint_convertcoords(C, gpl, gps, pt + 1, (stitch) ? p3d_cur : p3d_next, subrect); } if (stitch && tot > 2) { - gp_strokepoint_convertcoords(C, gpd, gpl, gps, pt + 2, p3d_next, subrect); + gp_strokepoint_convertcoords(C, gpl, gps, pt + 2, p3d_next, subrect); } } @@ -1106,7 +1102,7 @@ static void gp_stroke_to_bezier(bContext *C, copy_v3_v3(p3d_cur, p3d_next); if (i + 2 < tot) { - gp_strokepoint_convertcoords(C, gpd, gpl, gps, pt + 2, p3d_next, subrect); + gp_strokepoint_convertcoords(C, gpl, gps, pt + 2, p3d_next, subrect); } prev_bezt = bezt; @@ -1334,7 +1330,6 @@ static void gp_layer_to_curve(bContext *C, switch (mode) { case GP_STROKECONVERT_PATH: gp_stroke_to_path(C, - gpd, gpl, gps, cu, @@ -1350,7 +1345,6 @@ static void gp_layer_to_curve(bContext *C, case GP_STROKECONVERT_CURVE: case GP_STROKECONVERT_POLY: /* convert after */ gp_stroke_to_bezier(C, - gpd, gpl, gps, cu, diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 1b42334499e..858e07b1cce 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -3546,7 +3546,7 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op) GP_REPROJECT_TOP, GP_REPROJECT_CURSOR)) { if (mode != GP_REPROJECT_CURSOR) { - ED_gpencil_drawing_reference_get(scene, ob, gpl, ts->gpencil_v3d_align, origin); + ED_gpencil_drawing_reference_get(scene, ob, ts->gpencil_v3d_align, origin); } else { copy_v3_v3(origin, scene->cursor.location); diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index f61572fffca..e56017d0bed 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -1143,7 +1143,6 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf) gp_stroke_convertcoords_tpoint(tgpf->scene, tgpf->region, tgpf->ob, - tgpf->gpl, point2D, tgpf->depth_arr ? tgpf->depth_arr + i : NULL, &pt->x); @@ -1186,8 +1185,7 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf) if ((tgpf->lock_axis > GP_LOCKAXIS_VIEW) && ((ts->gpencil_v3d_align & GP_PROJECT_DEPTH_VIEW) == 0)) { float origin[3]; - ED_gpencil_drawing_reference_get( - tgpf->scene, tgpf->ob, tgpf->gpl, ts->gpencil_v3d_align, origin); + ED_gpencil_drawing_reference_get(tgpf->scene, tgpf->ob, ts->gpencil_v3d_align, origin); ED_gp_project_stroke_to_plane( tgpf->scene, tgpf->ob, tgpf->rv3d, gps, origin, tgpf->lock_axis - 1); } diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index 79f672274a7..61bca235d17 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -257,8 +257,7 @@ typedef struct GP_SpaceConversion { float mat[4][4]; /* transform matrix on the strokes (introduced in [b770964]) */ } GP_SpaceConversion; -bool gp_stroke_inside_circle( - const float mval[2], const float UNUSED(mvalo[2]), int rad, int x0, int y0, int x1, int y1); +bool gp_stroke_inside_circle(const float mval[2], int rad, int x0, int y0, int x1, int y1); void gp_point_conversion_init(struct bContext *C, GP_SpaceConversion *r_gsc); @@ -304,7 +303,6 @@ bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc, void gp_stroke_convertcoords_tpoint(struct Scene *scene, struct ARegion *region, struct Object *ob, - bGPDlayer *gpl, const struct tGPspoint *point2D, float *depth, float out[3]); diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index 01b0fe80dfc..5ccd8843a3f 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -353,7 +353,7 @@ static void gp_get_3d_reference(tGPsdata *p, float vec[3]) if (p->ownerPtr.type == &RNA_Object) { ob = (Object *)p->ownerPtr.data; } - ED_gpencil_drawing_reference_get(p->scene, ob, p->gpl, *p->align_flag, vec); + ED_gpencil_drawing_reference_get(p->scene, ob, *p->align_flag, vec); } /* Stroke Editing ---------------------------- */ @@ -1356,7 +1356,6 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, bGPDframe *gpf, bGPDstroke *gps, const float mval[2], - const float mvalo[2], const int radius, const rcti *rect) { @@ -1475,7 +1474,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, * eraser region (either within stroke painted, or on its lines) * - this assumes that linewidth is irrelevant */ - if (gp_stroke_inside_circle(mval, mvalo, radius, pc0[0], pc0[1], pc2[0], pc2[1])) { + if (gp_stroke_inside_circle(mval, radius, pc0[0], pc0[1], pc2[0], pc2[1])) { if ((gp_stroke_eraser_is_occluded(p, pt0, pc0[0], pc0[1]) == false) || (gp_stroke_eraser_is_occluded(p, pt1, pc1[0], pc1[1]) == false) || (gp_stroke_eraser_is_occluded(p, pt2, pc2[0], pc2[1]) == false)) { @@ -1632,7 +1631,7 @@ static void gp_stroke_doeraser(tGPsdata *p) * (e.g. 2D space strokes in the 3D view, if the same datablock is shared) */ if (ED_gpencil_stroke_can_use_direct(p->sa, gps)) { - gp_stroke_eraser_dostroke(p, gpf, gps, p->mval, p->mvalo, calc_radius, &rect); + gp_stroke_eraser_dostroke(p, gpf, gps, p->mval, calc_radius, &rect); } } } diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c index 2b30a415086..dfd11484d22 100644 --- a/source/blender/editors/gpencil/gpencil_primitive.c +++ b/source/blender/editors/gpencil/gpencil_primitive.c @@ -954,8 +954,7 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi) /* get origin to reproject point */ float origin[3]; - ED_gpencil_drawing_reference_get( - tgpi->scene, tgpi->ob, tgpi->gpl, ts->gpencil_v3d_align, origin); + ED_gpencil_drawing_reference_get(tgpi->scene, tgpi->ob, ts->gpencil_v3d_align, origin); /* reproject current */ ED_gpencil_tpoint_to_point(tgpi->region, origin, tpt, &spt); ED_gp_project_point_to_plane( @@ -987,13 +986,8 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi) } /* convert screen-coordinates to 3D coordinates */ - gp_stroke_convertcoords_tpoint(tgpi->scene, - tgpi->region, - tgpi->ob, - tgpi->gpl, - p2d, - depth_arr ? depth_arr + i : NULL, - &pt->x); + gp_stroke_convertcoords_tpoint( + tgpi->scene, tgpi->region, tgpi->ob, p2d, depth_arr ? depth_arr + i : NULL, &pt->x); pt->pressure = pressure; pt->strength = strength; @@ -1019,15 +1013,14 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi) for (int i = 0; i < tgpi->gpd->runtime.tot_cp_points; i++) { bGPDcontrolpoint *cp = &cps[i]; gp_stroke_convertcoords_tpoint( - tgpi->scene, tgpi->region, tgpi->ob, tgpi->gpl, (tGPspoint *)cp, NULL, &cp->x); + tgpi->scene, tgpi->region, tgpi->ob, (tGPspoint *)cp, NULL, &cp->x); } } /* reproject to plane */ if (!is_depth) { float origin[3]; - ED_gpencil_drawing_reference_get( - tgpi->scene, tgpi->ob, tgpi->gpl, ts->gpencil_v3d_align, origin); + ED_gpencil_drawing_reference_get(tgpi->scene, tgpi->ob, ts->gpencil_v3d_align, origin); ED_gp_project_stroke_to_plane( tgpi->scene, tgpi->ob, tgpi->rv3d, gps, origin, ts->gp_sculpt.lock_axis - 1); } diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c index 59b14a47d1d..8f3fc5fa268 100644 --- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c +++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c @@ -1495,8 +1495,7 @@ static bool gpsculpt_brush_do_stroke(tGP_BrushEditData *gso, * brush region (either within stroke painted, or on its lines) * - this assumes that linewidth is irrelevant */ - if (gp_stroke_inside_circle( - gso->mval, gso->mval_prev, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { + if (gp_stroke_inside_circle(gso->mval, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { /* Apply operation to these points */ bool ok = false; diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c index f5cd9791324..997a1d2b354 100644 --- a/source/blender/editors/gpencil/gpencil_select.c +++ b/source/blender/editors/gpencil/gpencil_select.c @@ -925,7 +925,7 @@ static bool gp_stroke_do_circle_sel(bGPdata *UNUSED(gpd), * eraser region (either within stroke painted, or on its lines) * - this assumes that linewidth is irrelevant */ - if (gp_stroke_inside_circle(mval, mvalo, radius, x0, y0, x1, y1)) { + if (gp_stroke_inside_circle(mval, radius, x0, y0, x1, y1)) { /* change selection of stroke, and then of both points * (as the last point otherwise wouldn't get selected * as we only do n-1 loops through). diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 276be071e0b..312cb1b50c0 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -494,8 +494,7 @@ const EnumPropertyItem *ED_gpencil_layers_with_new_enum_itemf(bContext *C, * \param x0, y0: The screen-space x and y coordinates of the start of the stroke segment * \param x1, y1: The screen-space x and y coordinates of the end of the stroke segment */ -bool gp_stroke_inside_circle( - const float mval[2], const float UNUSED(mvalo[2]), int rad, int x0, int y0, int x1, int y1) +bool gp_stroke_inside_circle(const float mval[2], int rad, int x0, int y0, int x1, int y1) { /* simple within-radius check for now */ const float screen_co_a[2] = {x0, y0}; @@ -869,8 +868,7 @@ bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc, const RegionView3D *rv3d = gsc->region->regiondata; float rvec[3]; - ED_gpencil_drawing_reference_get( - scene, gsc->ob, gsc->gpl, scene->toolsettings->gpencil_v3d_align, rvec); + ED_gpencil_drawing_reference_get(scene, gsc->ob, scene->toolsettings->gpencil_v3d_align, rvec); float zfac = ED_view3d_calc_zfac(rv3d, rvec, NULL); @@ -905,7 +903,6 @@ bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc, void gp_stroke_convertcoords_tpoint(Scene *scene, ARegion *region, Object *ob, - bGPDlayer *gpl, const tGPspoint *point2D, float *depth, float r_out[3]) @@ -929,7 +926,7 @@ void gp_stroke_convertcoords_tpoint(Scene *scene, /* Current method just converts each point in screen-coordinates to * 3D-coordinates using the 3D-cursor as reference. */ - ED_gpencil_drawing_reference_get(scene, ob, gpl, ts->gpencil_v3d_align, rvec); + ED_gpencil_drawing_reference_get(scene, ob, ts->gpencil_v3d_align, rvec); zfac = ED_view3d_calc_zfac(region->regiondata, rvec, NULL); if (ED_view3d_project_float_global(region, rvec, mval_prj, V3D_PROJ_TEST_NOP) == @@ -948,8 +945,10 @@ void gp_stroke_convertcoords_tpoint(Scene *scene, * Get drawing reference point for conversion or projection of the stroke * \param[out] r_vec : Reference point found */ -void ED_gpencil_drawing_reference_get( - const Scene *scene, const Object *ob, bGPDlayer *UNUSED(gpl), char align_flag, float r_vec[3]) +void ED_gpencil_drawing_reference_get(const Scene *scene, + const Object *ob, + char align_flag, + float r_vec[3]) { const float *fp = scene->cursor.location; diff --git a/source/blender/editors/gpencil/gpencil_vertex_paint.c b/source/blender/editors/gpencil/gpencil_vertex_paint.c index 0c3b29ab1ea..10867bd1e0d 100644 --- a/source/blender/editors/gpencil/gpencil_vertex_paint.c +++ b/source/blender/editors/gpencil/gpencil_vertex_paint.c @@ -897,8 +897,7 @@ static void gp_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso, * brush region (either within stroke painted, or on its lines) * - this assumes that linewidth is irrelevant */ - if (gp_stroke_inside_circle( - gso->mval, gso->mval_prev, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { + if (gp_stroke_inside_circle(gso->mval, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { /* To each point individually... */ pt = &gps->points[i]; diff --git a/source/blender/editors/gpencil/gpencil_weight_paint.c b/source/blender/editors/gpencil/gpencil_weight_paint.c index 51d5df1f405..2ebf1aba353 100644 --- a/source/blender/editors/gpencil/gpencil_weight_paint.c +++ b/source/blender/editors/gpencil/gpencil_weight_paint.c @@ -449,8 +449,7 @@ static void gp_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso, * brush region (either within stroke painted, or on its lines) * - this assumes that linewidth is irrelevant */ - if (gp_stroke_inside_circle( - gso->mval, gso->mval_prev, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { + if (gp_stroke_inside_circle(gso->mval, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { /* To each point individually... */ pt = &gps->points[i]; diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index 66aa301f08c..511e892f29a 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -233,7 +233,6 @@ void ED_gp_project_point_to_plane(const struct Scene *scene, struct bGPDspoint *pt); void ED_gpencil_drawing_reference_get(const struct Scene *scene, const struct Object *ob, - struct bGPDlayer *gpl, char align_flag, float vec[3]); void ED_gpencil_project_stroke_to_view(struct bContext *C, -- cgit v1.2.3