diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-06-29 16:28:38 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-06-29 16:47:43 +0300 |
commit | a351eb072658ce6fb84290f80d8f17bb397fb7ff (patch) | |
tree | 8db60cbddbafddd69ceb2f9b3ad32fa82a8dc022 /source/blender/editors/gpencil | |
parent | 399dbb1aa391f04357f91ab875241db3c6041aa5 (diff) |
GPencil: Cleanup function names replace gp_ by gpencil_ prefix
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_add_stroke.c | 17 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_convert.c | 434 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_data.c | 168 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 265 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_fill.c | 98 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_interpolate.c | 50 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_merge.c | 16 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_mesh.c | 34 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_ops.c | 142 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 301 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_primitive.c | 120 |
11 files changed, 803 insertions, 842 deletions
diff --git a/source/blender/editors/gpencil/gpencil_add_stroke.c b/source/blender/editors/gpencil/gpencil_add_stroke.c index 60a4404beaf..39a2d594c13 100644 --- a/source/blender/editors/gpencil/gpencil_add_stroke.c +++ b/source/blender/editors/gpencil/gpencil_add_stroke.c @@ -49,7 +49,10 @@ typedef struct ColorTemplate { } ColorTemplate; /* Add color an ensure duplications (matched by name) */ -static int gp_stroke_material(Main *bmain, Object *ob, const ColorTemplate *pct, const bool fill) +static int gpencil_stroke_material(Main *bmain, + Object *ob, + const ColorTemplate *pct, + const bool fill) { short *totcol = BKE_object_material_len_p(ob); Material *ma = NULL; @@ -224,12 +227,12 @@ void ED_gpencil_create_stroke(bContext *C, Object *ob, float mat[4][4]) bGPDstroke *gps; /* create colors */ - int color_black = gp_stroke_material(bmain, ob, &gp_stroke_material_black, false); - gp_stroke_material(bmain, ob, &gp_stroke_material_white, false); - gp_stroke_material(bmain, ob, &gp_stroke_material_red, false); - gp_stroke_material(bmain, ob, &gp_stroke_material_green, false); - gp_stroke_material(bmain, ob, &gp_stroke_material_blue, false); - gp_stroke_material(bmain, ob, &gp_stroke_material_grey, true); + int color_black = gpencil_stroke_material(bmain, ob, &gp_stroke_material_black, false); + gpencil_stroke_material(bmain, ob, &gp_stroke_material_white, false); + gpencil_stroke_material(bmain, ob, &gp_stroke_material_red, false); + gpencil_stroke_material(bmain, ob, &gp_stroke_material_green, false); + gpencil_stroke_material(bmain, ob, &gp_stroke_material_blue, false); + gpencil_stroke_material(bmain, ob, &gp_stroke_material_grey, true); /* set first color as active and in brushes */ ob->actcol = color_black + 1; diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c index 49b97b1df66..e111ce44bc4 100644 --- a/source/blender/editors/gpencil/gpencil_convert.c +++ b/source/blender/editors/gpencil/gpencil_convert.c @@ -154,12 +154,12 @@ static const EnumPropertyItem *rna_GPConvert_mode_items(bContext *UNUSED(C), /* convert the coordinates from the given stroke point into 3d-coordinates * - assumes that the active space is the 3D-View */ -static void gp_strokepoint_convertcoords(bContext *C, - bGPDlayer *gpl, - bGPDstroke *gps, - bGPDspoint *source_pt, - float p3d[3], - const rctf *subrect) +static void gpencil_strokepoint_convertcoords(bContext *C, + bGPDlayer *gpl, + bGPDstroke *gps, + bGPDspoint *source_pt, + float p3d[3], + const rctf *subrect) { Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); @@ -243,7 +243,7 @@ typedef struct tGpTimingData { /* Init point buffers for timing data. * Note this assumes we only grow those arrays! */ -static void gp_timing_data_set_nbr(tGpTimingData *gtd, const int nbr) +static void gpencil_timing_data_set_nbr(tGpTimingData *gtd, const int nbr) { float *tmp; @@ -269,10 +269,10 @@ static void gp_timing_data_set_nbr(tGpTimingData *gtd, const int nbr) } /* add stroke point to timing buffers */ -static void gp_timing_data_add_point(tGpTimingData *gtd, - const double stroke_inittime, - const float time, - const float delta_dist) +static void gpencil_timing_data_add_point(tGpTimingData *gtd, + const double stroke_inittime, + const float time, + const float delta_dist) { float delta_time = 0.0f; const int cur_point = gtd->cur_point; @@ -308,14 +308,14 @@ static void gp_timing_data_add_point(tGpTimingData *gtd, #define MIN_TIME_DELTA 0.02f /* Loop over next points to find the end of the stroke, and compute */ -static int gp_find_end_of_stroke_idx(tGpTimingData *gtd, - RNG *rng, - const int idx, - const int nbr_gaps, - int *nbr_done_gaps, - const float tot_gaps_time, - const float delta_time, - float *next_delta_time) +static int gpencil_find_end_of_stroke_idx(tGpTimingData *gtd, + RNG *rng, + const int idx, + const int nbr_gaps, + int *nbr_done_gaps, + const float tot_gaps_time, + const float delta_time, + float *next_delta_time) { int j; @@ -365,10 +365,10 @@ static int gp_find_end_of_stroke_idx(tGpTimingData *gtd, return j - 1; } -static void gp_stroke_path_animation_preprocess_gaps(tGpTimingData *gtd, - RNG *rng, - int *nbr_gaps, - float *tot_gaps_time) +static void gpencil_stroke_path_animation_preprocess_gaps(tGpTimingData *gtd, + RNG *rng, + int *nbr_gaps, + float *tot_gaps_time) { int i; float delta_time = 0.0f; @@ -396,16 +396,16 @@ static void gp_stroke_path_animation_preprocess_gaps(tGpTimingData *gtd, } } -static void gp_stroke_path_animation_add_keyframes(ReportList *reports, - PointerRNA ptr, - PropertyRNA *prop, - FCurve *fcu, - Curve *cu, - tGpTimingData *gtd, - RNG *rng, - const float time_range, - const int nbr_gaps, - const float tot_gaps_time) +static void gpencil_stroke_path_animation_add_keyframes(ReportList *reports, + PointerRNA ptr, + PropertyRNA *prop, + FCurve *fcu, + Curve *cu, + tGpTimingData *gtd, + RNG *rng, + const float time_range, + const int nbr_gaps, + const float tot_gaps_time) { /* Use actual recorded timing! */ const float time_start = (float)gtd->start_frame; @@ -431,7 +431,7 @@ static void gp_stroke_path_animation_add_keyframes(ReportList *reports, start_stroke_idx = i; delta_time = next_delta_time; /* find end of that new stroke */ - end_stroke_idx = gp_find_end_of_stroke_idx( + end_stroke_idx = gpencil_find_end_of_stroke_idx( gtd, rng, i, nbr_gaps, &nbr_done_gaps, tot_gaps_time, delta_time, &next_delta_time); /* This one should *never* be negative! */ end_stroke_time = time_start + @@ -489,10 +489,10 @@ static void gp_stroke_path_animation_add_keyframes(ReportList *reports, } } -static void gp_stroke_path_animation(bContext *C, - ReportList *reports, - Curve *cu, - tGpTimingData *gtd) +static void gpencil_stroke_path_animation(bContext *C, + ReportList *reports, + Curve *cu, + tGpTimingData *gtd) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -560,7 +560,7 @@ static void gp_stroke_path_animation(bContext *C, /* Pre-process gaps, in case we don't want to keep their original timing */ if (gtd->mode == GP_STROKECONVERT_TIMING_CUSTOMGAP) { - gp_stroke_path_animation_preprocess_gaps(gtd, rng, &nbr_gaps, &tot_gaps_time); + gpencil_stroke_path_animation_preprocess_gaps(gtd, rng, &nbr_gaps, &tot_gaps_time); } if (gtd->realtime) { @@ -574,7 +574,7 @@ static void gp_stroke_path_animation(bContext *C, printf("GP Stroke Path Conversion: Starting keying!\n"); } - gp_stroke_path_animation_add_keyframes( + gpencil_stroke_path_animation_add_keyframes( reports, ptr, prop, fcu, cu, gtd, rng, time_range, nbr_gaps, tot_gaps_time); BLI_rng_free(rng); @@ -606,16 +606,16 @@ static void gp_stroke_path_animation(bContext *C, /* convert stroke to 3d path */ /* helper */ -static void gp_stroke_to_path_add_point(tGpTimingData *gtd, - BPoint *bp, - const float p[3], - const float prev_p[3], - const bool do_gtd, - const double inittime, - const float time, - const float width, - const float rad_fac, - float minmax_weights[2]) +static void gpencil_stroke_to_path_add_point(tGpTimingData *gtd, + BPoint *bp, + const float p[3], + const float prev_p[3], + const bool do_gtd, + const double inittime, + const float time, + const float width, + const float rad_fac, + float minmax_weights[2]) { copy_v3_v3(bp->vec, p); bp->vec[3] = 1.0f; @@ -634,22 +634,22 @@ static void gp_stroke_to_path_add_point(tGpTimingData *gtd, /* Update timing data */ if (do_gtd) { - gp_timing_data_add_point(gtd, inittime, time, len_v3v3(prev_p, p)); + gpencil_timing_data_add_point(gtd, inittime, time, len_v3v3(prev_p, p)); } } -static void gp_stroke_to_path(bContext *C, - bGPDlayer *gpl, - bGPDstroke *gps, - Curve *cu, - rctf *subrect, - Nurb **curnu, - float minmax_weights[2], - const float rad_fac, - bool stitch, - const bool add_start_point, - const bool add_end_point, - tGpTimingData *gtd) +static void gpencil_stroke_to_path(bContext *C, + bGPDlayer *gpl, + bGPDstroke *gps, + Curve *cu, + rctf *subrect, + Nurb **curnu, + float minmax_weights[2], + const float rad_fac, + bool stitch, + const bool add_start_point, + const bool add_end_point, + tGpTimingData *gtd) { bGPDspoint *pt; Nurb *nu = (curnu) ? *curnu : NULL; @@ -685,7 +685,7 @@ static void gp_stroke_to_path(bContext *C, } if (do_gtd) { - gp_timing_data_set_nbr(gtd, nu->pntsu); + gpencil_timing_data_set_nbr(gtd, nu->pntsu); } /* If needed, make the link between both strokes with two zero-radius additional points */ @@ -713,7 +713,7 @@ static void gp_stroke_to_path(bContext *C, bp = &nu->bp[old_nbp - 1]; /* First point */ - gp_strokepoint_convertcoords(C, gpl, gps, gps->points, p, subrect); + gpencil_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) { @@ -728,21 +728,21 @@ static void gp_stroke_to_path(bContext *C, } } bp++; - gp_stroke_to_path_add_point(gtd, - bp, - p1, - (bp - 1)->vec, - do_gtd, - gps->prev->inittime, - dt1, - 0.0f, - rad_fac, - minmax_weights); + gpencil_stroke_to_path_add_point(gtd, + bp, + p1, + (bp - 1)->vec, + do_gtd, + gps->prev->inittime, + dt1, + 0.0f, + rad_fac, + minmax_weights); /* Second point */ /* Note dt2 is always negative, which marks the gap. */ if (gps->totpoints > 1) { - gp_strokepoint_convertcoords(C, gpl, gps, gps->points + 1, next_p, subrect); + gpencil_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); @@ -755,7 +755,7 @@ static void gp_stroke_to_path(bContext *C, } } bp++; - gp_stroke_to_path_add_point( + gpencil_stroke_to_path_add_point( gtd, bp, p2, p1, do_gtd, gps->inittime, dt2, 0.0f, rad_fac, minmax_weights); old_nbp += 2; @@ -764,9 +764,9 @@ static void gp_stroke_to_path(bContext *C, float p[3], next_p[3]; float dt = 0.0f; - gp_strokepoint_convertcoords(C, gpl, gps, gps->points, p, subrect); + gpencil_strokepoint_convertcoords(C, gpl, gps, gps->points, p, subrect); if (gps->totpoints > 1) { - gp_strokepoint_convertcoords(C, gpl, gps, gps->points + 1, next_p, subrect); + gpencil_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); @@ -781,7 +781,7 @@ static void gp_stroke_to_path(bContext *C, * (which would be expected value) would not work * (it would be *before* gtd->inittime, which is not supported currently). */ - gp_stroke_to_path_add_point( + gpencil_stroke_to_path_add_point( gtd, bp, p, p, do_gtd, gps->inittime, dt, 0.0f, rad_fac, minmax_weights); old_nbp++; @@ -799,18 +799,18 @@ 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, gpl, gps, pt, p, subrect); - - gp_stroke_to_path_add_point(gtd, - bp, - p, - (prev_bp) ? prev_bp->vec : p, - do_gtd, - gps->inittime, - pt->time, - width, - rad_fac, - minmax_weights); + gpencil_strokepoint_convertcoords(C, gpl, gps, pt, p, subrect); + + gpencil_stroke_to_path_add_point(gtd, + bp, + p, + (prev_bp) ? prev_bp->vec : p, + do_gtd, + gps->inittime, + pt->time, + width, + rad_fac, + minmax_weights); prev_bp = bp; } @@ -832,7 +832,7 @@ static void gp_stroke_to_path(bContext *C, dt = GAP_DFAC; /* Rather arbitrary too! */ } /* Note bp has already been incremented in main loop above, so it points to the right place. */ - gp_stroke_to_path_add_point( + gpencil_stroke_to_path_add_point( gtd, bp, p, prev_bp->vec, do_gtd, gps->inittime, dt, 0.0f, rad_fac, minmax_weights); } @@ -850,18 +850,18 @@ static void gp_stroke_to_path(bContext *C, /* convert stroke to 3d bezier */ /* helper */ -static void gp_stroke_to_bezier_add_point(tGpTimingData *gtd, - BezTriple *bezt, - const float p[3], - const float h1[3], - const float h2[3], - const float prev_p[3], - const bool do_gtd, - const double inittime, - const float time, - const float width, - const float rad_fac, - float minmax_weights[2]) +static void gpencil_stroke_to_bezier_add_point(tGpTimingData *gtd, + BezTriple *bezt, + const float p[3], + const float h1[3], + const float h2[3], + const float prev_p[3], + const bool do_gtd, + const double inittime, + const float time, + const float width, + const float rad_fac, + float minmax_weights[2]) { copy_v3_v3(bezt->vec[0], h1); copy_v3_v3(bezt->vec[1], p); @@ -882,22 +882,22 @@ static void gp_stroke_to_bezier_add_point(tGpTimingData *gtd, /* Update timing data */ if (do_gtd) { - gp_timing_data_add_point(gtd, inittime, time, len_v3v3(prev_p, p)); + gpencil_timing_data_add_point(gtd, inittime, time, len_v3v3(prev_p, p)); } } -static void gp_stroke_to_bezier(bContext *C, - bGPDlayer *gpl, - bGPDstroke *gps, - Curve *cu, - rctf *subrect, - Nurb **curnu, - float minmax_weights[2], - const float rad_fac, - bool stitch, - const bool add_start_point, - const bool add_end_point, - tGpTimingData *gtd) +static void gpencil_stroke_to_bezier(bContext *C, + bGPDlayer *gpl, + bGPDstroke *gps, + Curve *cu, + rctf *subrect, + Nurb **curnu, + float minmax_weights[2], + const float rad_fac, + bool stitch, + const bool add_start_point, + const bool add_end_point, + tGpTimingData *gtd) { bGPDspoint *pt; Nurb *nu = (curnu) ? *curnu : NULL; @@ -930,7 +930,7 @@ static void gp_stroke_to_bezier(bContext *C, } if (do_gtd) { - gp_timing_data_set_nbr(gtd, nu->pntsu); + gpencil_timing_data_set_nbr(gtd, nu->pntsu); } tot = gps->totpoints; @@ -938,12 +938,13 @@ static void gp_stroke_to_bezier(bContext *C, /* get initial coordinates */ pt = gps->points; if (tot) { - gp_strokepoint_convertcoords(C, gpl, gps, pt, (stitch) ? p3d_prev : p3d_cur, subrect); + gpencil_strokepoint_convertcoords(C, gpl, gps, pt, (stitch) ? p3d_prev : p3d_cur, subrect); if (tot > 1) { - gp_strokepoint_convertcoords(C, gpl, gps, pt + 1, (stitch) ? p3d_cur : p3d_next, subrect); + gpencil_strokepoint_convertcoords( + C, gpl, gps, pt + 1, (stitch) ? p3d_cur : p3d_next, subrect); } if (stitch && tot > 2) { - gp_strokepoint_convertcoords(C, gpl, gps, pt + 2, p3d_next, subrect); + gpencil_strokepoint_convertcoords(C, gpl, gps, pt + 2, p3d_next, subrect); } } @@ -1020,24 +1021,24 @@ static void gp_stroke_to_bezier(bContext *C, interp_v3_v3v3(h1, p1, bezt->vec[1], BEZT_HANDLE_FAC); interp_v3_v3v3(h2, p1, p2, BEZT_HANDLE_FAC); bezt++; - gp_stroke_to_bezier_add_point(gtd, - bezt, - p1, - h1, - h2, - (bezt - 1)->vec[1], - do_gtd, - gps->prev->inittime, - dt1, - 0.0f, - rad_fac, - minmax_weights); + gpencil_stroke_to_bezier_add_point(gtd, + bezt, + p1, + h1, + h2, + (bezt - 1)->vec[1], + do_gtd, + gps->prev->inittime, + dt1, + 0.0f, + rad_fac, + minmax_weights); /* Second point */ interp_v3_v3v3(h1, p2, p1, BEZT_HANDLE_FAC); interp_v3_v3v3(h2, p2, p3d_cur, BEZT_HANDLE_FAC); bezt++; - gp_stroke_to_bezier_add_point( + gpencil_stroke_to_bezier_add_point( gtd, bezt, p2, h1, h2, p1, do_gtd, gps->inittime, dt2, 0.0f, rad_fac, minmax_weights); old_nbezt += 2; @@ -1062,7 +1063,7 @@ static void gp_stroke_to_bezier(bContext *C, interp_v3_v3v3(h1, p, p3d_cur, -BEZT_HANDLE_FAC); interp_v3_v3v3(h2, p, p3d_cur, BEZT_HANDLE_FAC); bezt = &nu->bezt[old_nbezt]; - gp_stroke_to_bezier_add_point( + gpencil_stroke_to_bezier_add_point( gtd, bezt, p, h1, h2, p, do_gtd, gps->inittime, dt, 0.0f, rad_fac, minmax_weights); old_nbezt++; @@ -1091,25 +1092,25 @@ static void gp_stroke_to_bezier(bContext *C, interp_v3_v3v3(h2, p3d_cur, p3d_prev, -BEZT_HANDLE_FAC); } - gp_stroke_to_bezier_add_point(gtd, - bezt, - p3d_cur, - h1, - h2, - prev_bezt ? prev_bezt->vec[1] : p3d_cur, - do_gtd, - gps->inittime, - pt->time, - width, - rad_fac, - minmax_weights); + gpencil_stroke_to_bezier_add_point(gtd, + bezt, + p3d_cur, + h1, + h2, + prev_bezt ? prev_bezt->vec[1] : p3d_cur, + do_gtd, + gps->inittime, + pt->time, + width, + rad_fac, + minmax_weights); /* shift coord vects */ copy_v3_v3(p3d_prev, p3d_cur); copy_v3_v3(p3d_cur, p3d_next); if (i + 2 < tot) { - gp_strokepoint_convertcoords(C, gpl, gps, pt + 2, p3d_next, subrect); + gpencil_strokepoint_convertcoords(C, gpl, gps, pt + 2, p3d_next, subrect); } prev_bezt = bezt; @@ -1141,18 +1142,18 @@ static void gp_stroke_to_bezier(bContext *C, interp_v3_v3v3(h2, p, prev_bezt->vec[1], -BEZT_HANDLE_FAC); /* Note bezt has already been incremented in main loop above, * so it points to the right place. */ - gp_stroke_to_bezier_add_point(gtd, - bezt, - p, - h1, - h2, - prev_bezt->vec[1], - do_gtd, - gps->inittime, - dt, - 0.0f, - rad_fac, - minmax_weights); + gpencil_stroke_to_bezier_add_point(gtd, + bezt, + p, + h1, + h2, + prev_bezt->vec[1], + do_gtd, + gps->inittime, + dt, + 0.0f, + rad_fac, + minmax_weights); } /* must calculate handles or else we crash */ @@ -1170,7 +1171,7 @@ static void gp_stroke_to_bezier(bContext *C, #undef WIDTH_CORR_FAC #undef BEZT_HANDLE_FAC -static void gp_stroke_finalize_curve_endpoints(Curve *cu) +static void gpencil_stroke_finalize_curve_endpoints(Curve *cu) { /* start */ Nurb *nu = cu->nurb.first; @@ -1205,7 +1206,7 @@ static void gp_stroke_finalize_curve_endpoints(Curve *cu) } } -static void gp_stroke_norm_curve_weights(Curve *cu, const float minmax_weights[2]) +static void gpencil_stroke_norm_curve_weights(Curve *cu, const float minmax_weights[2]) { Nurb *nu; const float delta = minmax_weights[0]; @@ -1236,7 +1237,7 @@ static void gp_stroke_norm_curve_weights(Curve *cu, const float minmax_weights[2 } } -static int gp_camera_view_subrect(bContext *C, rctf *subrect) +static int gpencil_camera_view_subrect(bContext *C, rctf *subrect) { View3D *v3d = CTX_wm_view3d(C); ARegion *region = CTX_wm_region(C); @@ -1258,15 +1259,15 @@ static int gp_camera_view_subrect(bContext *C, rctf *subrect) /* convert a given grease-pencil layer to a 3d-curve representation * (using current view if appropriate) */ -static void gp_layer_to_curve(bContext *C, - ReportList *reports, - bGPdata *gpd, - bGPDlayer *gpl, - const int mode, - const bool norm_weights, - const float rad_fac, - const bool link_strokes, - tGpTimingData *gtd) +static void gpencil_layer_to_curve(bContext *C, + ReportList *reports, + bGPdata *gpd, + bGPDlayer *gpl, + const int mode, + const bool norm_weights, + const float rad_fac, + const bool link_strokes, + tGpTimingData *gtd) { struct Main *bmain = CTX_data_main(C); ViewLayer *view_layer = CTX_data_view_layer(C); @@ -1295,7 +1296,7 @@ static void gp_layer_to_curve(bContext *C, } /* initialize camera framing */ - if (gp_camera_view_subrect(C, &subrect)) { + if (gpencil_camera_view_subrect(C, &subrect)) { subrect_ptr = &subrect; } @@ -1338,33 +1339,33 @@ static void gp_layer_to_curve(bContext *C, switch (mode) { case GP_STROKECONVERT_PATH: - gp_stroke_to_path(C, - gpl, - gps, - cu, - subrect_ptr, - &nu, - minmax_weights, - rad_fac, - stitch, - add_start_point, - add_end_point, - gtd); + gpencil_stroke_to_path(C, + gpl, + gps, + cu, + subrect_ptr, + &nu, + minmax_weights, + rad_fac, + stitch, + add_start_point, + add_end_point, + gtd); break; case GP_STROKECONVERT_CURVE: case GP_STROKECONVERT_POLY: /* convert after */ - gp_stroke_to_bezier(C, - gpl, - gps, - cu, - subrect_ptr, - &nu, - minmax_weights, - rad_fac, - stitch, - add_start_point, - add_end_point, - gtd); + gpencil_stroke_to_bezier(C, + gpl, + gps, + cu, + subrect_ptr, + &nu, + minmax_weights, + rad_fac, + stitch, + add_start_point, + add_end_point, + gtd); break; default: BLI_assert(!"invalid mode"); @@ -1375,16 +1376,16 @@ static void gp_layer_to_curve(bContext *C, /* If link_strokes, be sure first and last points have a zero weight/size! */ if (link_strokes) { - gp_stroke_finalize_curve_endpoints(cu); + gpencil_stroke_finalize_curve_endpoints(cu); } /* Update curve's weights, if needed */ if (norm_weights && ((minmax_weights[0] > 0.0f) || (minmax_weights[1] < 1.0f))) { - gp_stroke_norm_curve_weights(cu, minmax_weights); + gpencil_stroke_norm_curve_weights(cu, minmax_weights); } /* Create the path animation, if needed */ - gp_stroke_path_animation(C, reports, cu, gtd); + gpencil_stroke_path_animation(C, reports, cu, gtd); if (mode == GP_STROKECONVERT_POLY) { for (nu = cu->nurb.first; nu; nu = nu->next) { @@ -1402,7 +1403,7 @@ static void gp_layer_to_curve(bContext *C, /* Check a GP layer has valid timing data! Else, most timing options are hidden in the operator. * op may be NULL. */ -static bool gp_convert_check_has_valid_timing(bContext *C, bGPDlayer *gpl, wmOperator *op) +static bool gpencil_convert_check_has_valid_timing(bContext *C, bGPDlayer *gpl, wmOperator *op) { Scene *scene = CTX_data_scene(C); @@ -1450,9 +1451,9 @@ static bool gp_convert_check_has_valid_timing(bContext *C, bGPDlayer *gpl, wmOpe } /* Check end_frame is always > start frame! */ -static void gp_convert_set_end_frame(struct Main *UNUSED(main), - struct Scene *UNUSED(scene), - struct PointerRNA *ptr) +static void gpencil_convert_set_end_frame(struct Main *UNUSED(main), + struct Scene *UNUSED(scene), + struct PointerRNA *ptr) { int start_frame = RNA_int_get(ptr, "start_frame"); int end_frame = RNA_int_get(ptr, "end_frame"); @@ -1462,7 +1463,7 @@ static void gp_convert_set_end_frame(struct Main *UNUSED(main), } } -static bool gp_convert_poll(bContext *C) +static bool gpencil_convert_poll(bContext *C) { Object *ob = CTX_data_active_object(C); Scene *scene = CTX_data_scene(C); @@ -1484,7 +1485,7 @@ static bool gp_convert_poll(bContext *C) (gpf->strokes.first) && (!GPENCIL_ANY_EDIT_MODE(gpd))); } -static int gp_convert_layer_exec(bContext *C, wmOperator *op) +static int gpencil_convert_layer_exec(bContext *C, wmOperator *op) { PropertyRNA *prop = RNA_struct_find_property(op->ptr, "use_timing_data"); Object *ob = CTX_data_active_object(C); @@ -1505,7 +1506,7 @@ static int gp_convert_layer_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - if (!RNA_property_is_set(op->ptr, prop) && !gp_convert_check_has_valid_timing(C, gpl, op)) { + if (!RNA_property_is_set(op->ptr, prop) && !gpencil_convert_check_has_valid_timing(C, gpl, op)) { BKE_report(op->reports, RPT_WARNING, "Current Grease Pencil strokes have no valid timing data, most timing options will " @@ -1542,7 +1543,8 @@ static int gp_convert_layer_exec(bContext *C, wmOperator *op) gtd.offset_time = 0.0f; /* perform conversion */ - gp_layer_to_curve(C, op->reports, gpd, gpl, mode, norm_weights, rad_fac, link_strokes, >d); + gpencil_layer_to_curve( + C, op->reports, gpd, gpl, mode, norm_weights, rad_fac, link_strokes, >d); /* free temp memory */ if (gtd.dists) { @@ -1563,9 +1565,9 @@ static int gp_convert_layer_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static bool gp_convert_poll_property(const bContext *UNUSED(C), - wmOperator *op, - const PropertyRNA *prop) +static bool gpencil_convert_poll_property(const bContext *UNUSED(C), + wmOperator *op, + const PropertyRNA *prop) { PointerRNA *ptr = op->ptr; const char *prop_id = RNA_property_identifier(prop); @@ -1644,9 +1646,9 @@ void GPENCIL_OT_convert(wmOperatorType *ot) /* callbacks */ ot->invoke = WM_menu_invoke; - ot->exec = gp_convert_layer_exec; - ot->poll = gp_convert_poll; - ot->poll_property = gp_convert_poll_property; + ot->exec = gpencil_convert_layer_exec; + ot->poll = gpencil_convert_poll; + ot->poll_property = gpencil_convert_poll_property; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1728,7 +1730,7 @@ void GPENCIL_OT_convert(wmOperatorType *ot) "The end frame of the path control curve (if Realtime is not set)", 1, 100000); - RNA_def_property_update_runtime(prop, gp_convert_set_end_frame); + RNA_def_property_update_runtime(prop, gpencil_convert_set_end_frame); RNA_def_float(ot->srna, "gap_duration", diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 9e929a8997b..dd1da45b495 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -90,7 +90,7 @@ /* Datablock Operators */ /* ******************* Add New Data ************************ */ -static bool gp_data_add_poll(bContext *C) +static bool gpencil_data_add_poll(bContext *C) { /* the base line we have is that we have somewhere to add Grease Pencil data */ @@ -98,7 +98,7 @@ static bool gp_data_add_poll(bContext *C) } /* add new datablock - wrapper around API */ -static int gp_data_add_exec(bContext *C, wmOperator *op) +static int gpencil_data_add_exec(bContext *C, wmOperator *op) { PointerRNA gpd_owner = {NULL}; bGPdata **gpd_ptr = ED_annotation_data_get_pointers(C, &gpd_owner); @@ -145,14 +145,14 @@ void GPENCIL_OT_annotation_add(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* callbacks */ - ot->exec = gp_data_add_exec; - ot->poll = gp_data_add_poll; + ot->exec = gpencil_data_add_exec; + ot->poll = gpencil_data_add_poll; } /* ******************* Unlink Data ************************ */ /* poll callback for adding data/layers - special */ -static bool gp_data_unlink_poll(bContext *C) +static bool gpencil_data_unlink_poll(bContext *C) { bGPdata **gpd_ptr = ED_annotation_data_get_pointers(C, NULL); @@ -168,7 +168,7 @@ static bool gp_data_unlink_poll(bContext *C) } /* unlink datablock - wrapper around API */ -static int gp_data_unlink_exec(bContext *C, wmOperator *op) +static int gpencil_data_unlink_exec(bContext *C, wmOperator *op) { bGPdata **gpd_ptr = ED_annotation_data_get_pointers(C, NULL); @@ -199,8 +199,8 @@ void GPENCIL_OT_data_unlink(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* callbacks */ - ot->exec = gp_data_unlink_exec; - ot->poll = gp_data_unlink_poll; + ot->exec = gpencil_data_unlink_exec; + ot->poll = gpencil_data_unlink_poll; } /* ************************************************ */ @@ -209,7 +209,7 @@ void GPENCIL_OT_data_unlink(wmOperatorType *ot) /* ******************* Add New Layer ************************ */ /* add new layer - wrapper around API */ -static int gp_layer_add_exec(bContext *C, wmOperator *op) +static int gpencil_layer_add_exec(bContext *C, wmOperator *op) { const bool is_annotation = STREQ(op->idname, "GPENCIL_OT_layer_annotation_add"); @@ -268,11 +268,11 @@ void GPENCIL_OT_layer_add(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* callbacks */ - ot->exec = gp_layer_add_exec; + ot->exec = gpencil_layer_add_exec; ot->poll = gpencil_add_poll; } -static bool gp_add_annotation_poll(bContext *C) +static bool gpencil_add_annotation_poll(bContext *C) { return ED_annotation_data_get_pointers(C, NULL) != NULL; } @@ -287,12 +287,12 @@ void GPENCIL_OT_layer_annotation_add(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* callbacks */ - ot->exec = gp_layer_add_exec; - ot->poll = gp_add_annotation_poll; + ot->exec = gpencil_layer_add_exec; + ot->poll = gpencil_add_annotation_poll; } /* ******************* Remove Active Layer ************************* */ -static int gp_layer_remove_exec(bContext *C, wmOperator *op) +static int gpencil_layer_remove_exec(bContext *C, wmOperator *op) { const bool is_annotation = STREQ(op->idname, "GPENCIL_OT_layer_annotation_remove"); @@ -345,11 +345,11 @@ void GPENCIL_OT_layer_remove(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* callbacks */ - ot->exec = gp_layer_remove_exec; + ot->exec = gpencil_layer_remove_exec; ot->poll = gpencil_active_layer_poll; } -static bool gp_active_layer_annotation_poll(bContext *C) +static bool gpencil_active_layer_annotation_poll(bContext *C) { bGPdata *gpd = ED_annotation_data_get_active(C); bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd); @@ -367,8 +367,8 @@ void GPENCIL_OT_layer_annotation_remove(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* callbacks */ - ot->exec = gp_layer_remove_exec; - ot->poll = gp_active_layer_annotation_poll; + ot->exec = gpencil_layer_remove_exec; + ot->poll = gpencil_active_layer_annotation_poll; } /* ******************* Move Layer Up/Down ************************** */ @@ -377,7 +377,7 @@ enum { GP_LAYER_MOVE_DOWN = 1, }; -static int gp_layer_move_exec(bContext *C, wmOperator *op) +static int gpencil_layer_move_exec(bContext *C, wmOperator *op) { const bool is_annotation = STREQ(op->idname, "GPENCIL_OT_layer_annotation_move"); @@ -418,7 +418,7 @@ void GPENCIL_OT_layer_move(wmOperatorType *ot) ot->description = "Move the active Grease Pencil layer up/down in the list"; /* api callbacks */ - ot->exec = gp_layer_move_exec; + ot->exec = gpencil_layer_move_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -441,8 +441,8 @@ void GPENCIL_OT_layer_annotation_move(wmOperatorType *ot) ot->description = "Move the active Annotation layer up/down in the list"; /* api callbacks */ - ot->exec = gp_layer_move_exec; - ot->poll = gp_active_layer_annotation_poll; + ot->exec = gpencil_layer_move_exec; + ot->poll = gpencil_active_layer_annotation_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -451,7 +451,7 @@ void GPENCIL_OT_layer_annotation_move(wmOperatorType *ot) } /* ********************* Duplicate Layer ************************** */ -static int gp_layer_copy_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_layer_copy_exec(bContext *C, wmOperator *UNUSED(op)) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd); @@ -491,7 +491,7 @@ void GPENCIL_OT_layer_duplicate(wmOperatorType *ot) ot->description = "Make a copy of the active Grease Pencil layer"; /* callbacks */ - ot->exec = gp_layer_copy_exec; + ot->exec = gpencil_layer_copy_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -504,7 +504,7 @@ enum { GP_LAYER_COPY_OBJECT_ACT_FRAME = 1, }; -static bool gp_layer_duplicate_object_poll(bContext *C) +static bool gpencil_layer_duplicate_object_poll(bContext *C) { ViewLayer *view_layer = CTX_data_view_layer(C); Object *ob = CTX_data_active_object(C); @@ -529,7 +529,7 @@ static bool gp_layer_duplicate_object_poll(bContext *C) return false; } -static int gp_layer_duplicate_object_exec(bContext *C, wmOperator *op) +static int gpencil_layer_duplicate_object_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -622,8 +622,8 @@ void GPENCIL_OT_layer_duplicate_object(wmOperatorType *ot) ot->description = "Make a copy of the active Grease Pencil layer to new object"; /* callbacks */ - ot->exec = gp_layer_duplicate_object_exec; - ot->poll = gp_layer_duplicate_object_poll; + ot->exec = gpencil_layer_duplicate_object_exec; + ot->poll = gpencil_layer_duplicate_object_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -641,7 +641,7 @@ enum { GP_FRAME_DUP_ALL = 1, }; -static int gp_frame_duplicate_exec(bContext *C, wmOperator *op) +static int gpencil_frame_duplicate_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDlayer *gpl_active = BKE_gpencil_layer_active_get(gpd); @@ -685,7 +685,7 @@ void GPENCIL_OT_frame_duplicate(wmOperatorType *ot) ot->description = "Make a copy of the active Grease Pencil Frame"; /* callbacks */ - ot->exec = gp_frame_duplicate_exec; + ot->exec = gpencil_frame_duplicate_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -700,7 +700,7 @@ enum { GP_FRAME_CLEAN_FILL_ALL = 1, }; -static int gp_frame_clean_fill_exec(bContext *C, wmOperator *op) +static int gpencil_frame_clean_fill_exec(bContext *C, wmOperator *op) { bool changed = false; bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -770,7 +770,7 @@ void GPENCIL_OT_frame_clean_fill(wmOperatorType *ot) ot->description = "Remove 'no fill' boundary strokes"; /* callbacks */ - ot->exec = gp_frame_clean_fill_exec; + ot->exec = gpencil_frame_clean_fill_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -780,7 +780,7 @@ void GPENCIL_OT_frame_clean_fill(wmOperatorType *ot) } /* ********************* Clean Loose Boundaries on Frame ************************** */ -static int gp_frame_clean_loose_exec(bContext *C, wmOperator *op) +static int gpencil_frame_clean_loose_exec(bContext *C, wmOperator *op) { bool changed = false; bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -846,7 +846,7 @@ void GPENCIL_OT_frame_clean_loose(wmOperatorType *ot) ot->description = "Remove loose points"; /* callbacks */ - ot->exec = gp_frame_clean_loose_exec; + ot->exec = gpencil_frame_clean_loose_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -865,7 +865,7 @@ void GPENCIL_OT_frame_clean_loose(wmOperatorType *ot) /* *********************** Hide Layers ******************************** */ -static int gp_hide_exec(bContext *C, wmOperator *op) +static int gpencil_hide_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDlayer *layer = BKE_gpencil_layer_active_get(gpd); @@ -908,7 +908,7 @@ void GPENCIL_OT_hide(wmOperatorType *ot) ot->description = "Hide selected/unselected Grease Pencil layers"; /* callbacks */ - ot->exec = gp_hide_exec; + ot->exec = gpencil_hide_exec; ot->poll = gpencil_active_layer_poll; /* NOTE: we need an active layer to play with */ /* flags */ @@ -922,12 +922,12 @@ void GPENCIL_OT_hide(wmOperatorType *ot) /* ********************** Show All Layers ***************************** */ /* poll callback for showing layers */ -static bool gp_reveal_poll(bContext *C) +static bool gpencil_reveal_poll(bContext *C) { return ED_gpencil_data_get_active(C) != NULL; } -static void gp_reveal_select_frame(bContext *C, bGPDframe *frame, bool select) +static void gpencil_reveal_select_frame(bContext *C, bGPDframe *frame, bool select) { bGPDstroke *gps; for (gps = frame->strokes.first; gps; gps = gps->next) { @@ -948,7 +948,7 @@ static void gp_reveal_select_frame(bContext *C, bGPDframe *frame, bool select) } } -static int gp_reveal_exec(bContext *C, wmOperator *op) +static int gpencil_reveal_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); const bool select = RNA_boolean_get(op->ptr, "select"); @@ -967,14 +967,14 @@ static int gp_reveal_exec(bContext *C, wmOperator *op) if (select) { /* select all strokes on active frame only (same as select all operator) */ if (gpl->actframe) { - gp_reveal_select_frame(C, gpl->actframe, true); + gpencil_reveal_select_frame(C, gpl->actframe, true); } } else { /* deselect strokes on all frames (same as deselect all operator) */ bGPDframe *gpf; for (gpf = gpl->frames.first; gpf; gpf = gpf->next) { - gp_reveal_select_frame(C, gpf, false); + gpencil_reveal_select_frame(C, gpf, false); } } } @@ -996,8 +996,8 @@ void GPENCIL_OT_reveal(wmOperatorType *ot) ot->description = "Show all Grease Pencil layers"; /* callbacks */ - ot->exec = gp_reveal_exec; - ot->poll = gp_reveal_poll; + ot->exec = gpencil_reveal_exec; + ot->poll = gpencil_reveal_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1008,7 +1008,7 @@ void GPENCIL_OT_reveal(wmOperatorType *ot) /* ***************** Lock/Unlock All Layers ************************ */ -static int gp_lock_all_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_lock_all_exec(bContext *C, wmOperator *UNUSED(op)) { bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -1038,8 +1038,8 @@ void GPENCIL_OT_lock_all(wmOperatorType *ot) "Lock all Grease Pencil layers to prevent them from being accidentally modified"; /* callbacks */ - ot->exec = gp_lock_all_exec; - ot->poll = gp_reveal_poll; + ot->exec = gpencil_lock_all_exec; + ot->poll = gpencil_reveal_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1047,7 +1047,7 @@ void GPENCIL_OT_lock_all(wmOperatorType *ot) /* -------------------------- */ -static int gp_unlock_all_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_unlock_all_exec(bContext *C, wmOperator *UNUSED(op)) { bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -1076,8 +1076,8 @@ void GPENCIL_OT_unlock_all(wmOperatorType *ot) ot->description = "Unlock all Grease Pencil layers so that they can be edited"; /* callbacks */ - ot->exec = gp_unlock_all_exec; - ot->poll = gp_reveal_poll; + ot->exec = gpencil_unlock_all_exec; + ot->poll = gpencil_reveal_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1085,7 +1085,7 @@ void GPENCIL_OT_unlock_all(wmOperatorType *ot) /* ********************** Isolate Layer **************************** */ -static int gp_isolate_layer_exec(bContext *C, wmOperator *op) +static int gpencil_isolate_layer_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDlayer *layer = BKE_gpencil_layer_active_get(gpd); @@ -1153,7 +1153,7 @@ void GPENCIL_OT_layer_isolate(wmOperatorType *ot) "Toggle whether the active layer is the only one that can be edited and/or visible"; /* callbacks */ - ot->exec = gp_isolate_layer_exec; + ot->exec = gpencil_isolate_layer_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -1169,7 +1169,7 @@ void GPENCIL_OT_layer_isolate(wmOperatorType *ot) /* ********************** Merge Layer with the next layer **************************** */ -static int gp_merge_layer_exec(bContext *C, wmOperator *op) +static int gpencil_merge_layer_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDlayer *gpl_next = BKE_gpencil_layer_active_get(gpd); @@ -1242,7 +1242,7 @@ void GPENCIL_OT_layer_merge(wmOperatorType *ot) ot->description = "Merge the current layer with the layer below"; /* callbacks */ - ot->exec = gp_merge_layer_exec; + ot->exec = gpencil_merge_layer_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -1251,7 +1251,7 @@ void GPENCIL_OT_layer_merge(wmOperatorType *ot) /* ********************** Change Layer ***************************** */ -static int gp_layer_change_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(evt)) +static int gpencil_layer_change_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(evt)) { uiPopupMenu *pup; uiLayout *layout; @@ -1265,7 +1265,7 @@ static int gp_layer_change_invoke(bContext *C, wmOperator *op, const wmEvent *UN return OPERATOR_INTERFACE; } -static int gp_layer_change_exec(bContext *C, wmOperator *op) +static int gpencil_layer_change_exec(bContext *C, wmOperator *op) { bGPdata *gpd = CTX_data_gpencil_data(C); bGPDlayer *gpl = NULL; @@ -1306,8 +1306,8 @@ void GPENCIL_OT_layer_change(wmOperatorType *ot) ot->description = "Change active Grease Pencil layer"; /* callbacks */ - ot->invoke = gp_layer_change_invoke; - ot->exec = gp_layer_change_exec; + ot->invoke = gpencil_layer_change_invoke; + ot->exec = gpencil_layer_change_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -1318,7 +1318,7 @@ void GPENCIL_OT_layer_change(wmOperatorType *ot) RNA_def_enum_funcs(ot->prop, ED_gpencil_layers_with_new_enum_itemf); } -static int gp_layer_active_exec(bContext *C, wmOperator *op) +static int gpencil_layer_active_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); bGPdata *gpd = (bGPdata *)ob->data; @@ -1352,7 +1352,7 @@ void GPENCIL_OT_layer_active(wmOperatorType *ot) ot->description = "Active Grease Pencil layer"; /* callbacks */ - ot->exec = gp_layer_active_exec; + ot->exec = gpencil_layer_active_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -1373,7 +1373,7 @@ enum { GP_STROKE_MOVE_BOTTOM = 3, }; -static int gp_stroke_arrange_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_arrange_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -1503,7 +1503,7 @@ void GPENCIL_OT_stroke_arrange(wmOperatorType *ot) ot->description = "Arrange selected strokes up/down in the drawing order of the active layer"; /* callbacks */ - ot->exec = gp_stroke_arrange_exec; + ot->exec = gpencil_stroke_arrange_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -1515,7 +1515,7 @@ void GPENCIL_OT_stroke_arrange(wmOperatorType *ot) /* ******************* Move Stroke to new color ************************** */ -static int gp_stroke_change_color_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_change_color_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Material *ma = NULL; @@ -1599,7 +1599,7 @@ void GPENCIL_OT_stroke_change_color(wmOperatorType *ot) ot->description = "Move selected strokes to active material"; /* callbacks */ - ot->exec = gp_stroke_change_color_exec; + ot->exec = gpencil_stroke_change_color_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -1610,7 +1610,7 @@ void GPENCIL_OT_stroke_change_color(wmOperatorType *ot) /* ******************* Lock color of non selected Strokes colors ************************** */ -static int gp_material_lock_unsused_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_material_lock_unsused_exec(bContext *C, wmOperator *UNUSED(op)) { bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -1674,7 +1674,7 @@ void GPENCIL_OT_material_lock_unused(wmOperatorType *ot) ot->description = "Lock any material not used in any selected stroke"; /* api callbacks */ - ot->exec = gp_material_lock_unsused_exec; + ot->exec = gpencil_material_lock_unsused_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -1685,7 +1685,7 @@ void GPENCIL_OT_material_lock_unused(wmOperatorType *ot) /* Drawing Brushes Operators */ /* ******************* Brush resets ************************** */ -static int gp_brush_reset_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_brush_reset_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); ToolSettings *ts = CTX_data_tool_settings(C); @@ -1743,16 +1743,16 @@ void GPENCIL_OT_brush_reset(wmOperatorType *ot) ot->description = "Reset Brush to default parameters"; /* api callbacks */ - ot->exec = gp_brush_reset_exec; + ot->exec = gpencil_brush_reset_exec; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -static Brush *gp_brush_get_first_by_mode(Main *bmain, - Paint *UNUSED(paint), - const enum eContextObjectMode mode, - char tool) +static Brush *gpencil_brush_get_first_by_mode(Main *bmain, + Paint *UNUSED(paint), + const enum eContextObjectMode mode, + char tool) { Brush *brush_next = NULL; for (Brush *brush = bmain->brushes.first; brush; brush = brush_next) { @@ -1782,9 +1782,9 @@ static Brush *gp_brush_get_first_by_mode(Main *bmain, return NULL; } -static void gp_brush_delete_mode_brushes(Main *bmain, - Paint *paint, - const enum eContextObjectMode mode) +static void gpencil_brush_delete_mode_brushes(Main *bmain, + Paint *paint, + const enum eContextObjectMode mode) { Brush *brush_active = paint->brush; Brush *brush_next = NULL; @@ -1847,7 +1847,7 @@ static void gp_brush_delete_mode_brushes(Main *bmain, } } -static int gp_brush_reset_all_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_brush_reset_all_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); ToolSettings *ts = CTX_data_tool_settings(C); @@ -1903,7 +1903,7 @@ static int gp_brush_reset_all_exec(bContext *C, wmOperator *UNUSED(op)) } } - gp_brush_delete_mode_brushes(bmain, paint, mode); + gpencil_brush_delete_mode_brushes(bmain, paint, mode); switch (mode) { case CTX_MODE_PAINT_GPENCIL: { @@ -1930,7 +1930,7 @@ static int gp_brush_reset_all_exec(bContext *C, wmOperator *UNUSED(op)) BKE_paint_toolslots_brush_validate(bmain, paint); /* Set Again the first brush of the mode. */ - Brush *deft_brush = gp_brush_get_first_by_mode(bmain, paint, mode, tool); + Brush *deft_brush = gpencil_brush_get_first_by_mode(bmain, paint, mode, tool); if (deft_brush) { BKE_paint_brush_set(paint, deft_brush); } @@ -1950,7 +1950,7 @@ void GPENCIL_OT_brush_reset_all(wmOperatorType *ot) ot->description = "Delete all mode brushes and recreate a default set"; /* api callbacks */ - ot->exec = gp_brush_reset_all_exec; + ot->exec = gpencil_brush_reset_all_exec; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -2496,7 +2496,7 @@ typedef struct tJoinGPencil_AdtFixData { * Callback to pass to #BKE_fcurves_main_cb() * for RNA Paths attached to each F-Curve used in the #AnimData. */ -static void joined_gpencil_fix_animdata_cb(ID *id, FCurve *fcu, void *user_data) +static void gpencil_joined_fix_animdata_cb(ID *id, FCurve *fcu, void *user_data) { tJoinGPencil_AdtFixData *afd = (tJoinGPencil_AdtFixData *)user_data; ID *src_id = &afd->src_gpd->id; @@ -2721,7 +2721,7 @@ int ED_gpencil_join_objects_exec(bContext *C, wmOperator *op) } /* Fix all the animation data */ - BKE_fcurves_main_cb(bmain, joined_gpencil_fix_animdata_cb, &afd); + BKE_fcurves_main_cb(bmain, gpencil_joined_fix_animdata_cb, &afd); BLI_ghash_free(afd.names_map, MEM_freeN, NULL); /* Only copy over animdata now, after all the remapping has been done, @@ -3415,7 +3415,7 @@ bool ED_gpencil_add_lattice_modifier(const bContext *C, } /* Masking operators */ -static int gp_layer_mask_add_exec(bContext *C, wmOperator *op) +static int gpencil_layer_mask_add_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); if ((ob == NULL) || (ob->type != OB_GPENCIL)) { @@ -3476,14 +3476,14 @@ void GPENCIL_OT_layer_mask_add(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* callbacks */ - ot->exec = gp_layer_mask_add_exec; + ot->exec = gpencil_layer_mask_add_exec; ot->poll = gpencil_add_poll; /* properties */ RNA_def_string(ot->srna, "name", NULL, 128, "Layer", "Name of the layer"); } -static int gp_layer_mask_remove_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_layer_mask_remove_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob = CTX_data_active_object(C); if ((ob == NULL) || (ob->type != OB_GPENCIL)) { @@ -3525,6 +3525,6 @@ void GPENCIL_OT_layer_mask_remove(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* callbacks */ - ot->exec = gp_layer_mask_remove_exec; + ot->exec = gpencil_layer_mask_remove_exec; ot->poll = gpencil_active_layer_poll; } diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 8c738917722..78e2812fdef 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -95,7 +95,7 @@ * \{ */ /* poll callback for all stroke editing operators */ -static bool gp_stroke_edit_poll(bContext *C) +static bool gpencil_stroke_edit_poll(bContext *C) { /* edit only supported with grease pencil objects */ Object *ob = CTX_data_active_object(C); @@ -108,7 +108,7 @@ static bool gp_stroke_edit_poll(bContext *C) } /* poll callback to verify edit mode in 3D view only */ -static bool gp_strokes_edit3d_poll(bContext *C) +static bool gpencil_strokes_edit3d_poll(bContext *C) { /* edit only supported with grease pencil objects */ Object *ob = CTX_data_active_object(C); @@ -120,7 +120,7 @@ static bool gp_strokes_edit3d_poll(bContext *C) * - 1) Editable GP data * - 2) 3D View only */ - return (gp_stroke_edit_poll(C) && ED_operator_view3d_active(C)); + return (gpencil_stroke_edit_poll(C) && ED_operator_view3d_active(C)); } static bool gpencil_editmode_toggle_poll(bContext *C) @@ -789,7 +789,7 @@ void GPENCIL_OT_selection_opacity_toggle(wmOperatorType *ot) /* callbacks */ ot->exec = gpencil_hideselect_toggle_exec; - ot->poll = gp_stroke_edit_poll; + ot->poll = gpencil_stroke_edit_poll; /* flags */ ot->flag = OPTYPE_UNDO | OPTYPE_REGISTER; @@ -802,9 +802,9 @@ void GPENCIL_OT_selection_opacity_toggle(wmOperatorType *ot) * \{ */ /* Make copies of selected point segments in a selected stroke */ -static void gp_duplicate_points(const bGPDstroke *gps, - ListBase *new_strokes, - const char *layername) +static void gpencil_duplicate_points(const bGPDstroke *gps, + ListBase *new_strokes, + const char *layername) { bGPDspoint *pt; int i; @@ -880,7 +880,7 @@ static void gp_duplicate_points(const bGPDstroke *gps, } } -static int gp_duplicate_exec(bContext *C, wmOperator *op) +static int gpencil_duplicate_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -933,7 +933,7 @@ static int gp_duplicate_exec(bContext *C, wmOperator *op) } else { /* delegate to a helper, as there's too much to fit in here (for copying subsets)... */ - gp_duplicate_points(gps, &new_strokes, gpl->info); + gpencil_duplicate_points(gps, &new_strokes, gpl->info); } /* deselect original stroke, or else the originals get moved too @@ -969,8 +969,8 @@ void GPENCIL_OT_duplicate(wmOperatorType *ot) ot->description = "Duplicate the selected Grease Pencil strokes"; /* callbacks */ - ot->exec = gp_duplicate_exec; - ot->poll = gp_stroke_edit_poll; + ot->exec = gpencil_duplicate_exec; + ot->poll = gpencil_stroke_edit_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -983,12 +983,12 @@ void GPENCIL_OT_duplicate(wmOperatorType *ot) * \{ */ /* helper to copy a point to temp area */ -static void copy_move_point(bGPDstroke *gps, - bGPDspoint *temp_points, - MDeformVert *temp_dverts, - int from_idx, - int to_idx, - const bool copy) +static void gpencil_copy_move_point(bGPDstroke *gps, + bGPDspoint *temp_points, + MDeformVert *temp_dverts, + int from_idx, + int to_idx, + const bool copy) { bGPDspoint *pt = &temp_points[from_idx]; bGPDspoint *pt_final = &gps->points[to_idx]; @@ -1053,7 +1053,7 @@ static void gpencil_add_move_points(bGPDframe *gpf, bGPDstroke *gps) BLI_insertlinkafter(&gpf->strokes, gps, gps_new); /* copy selected point data to new stroke */ - copy_move_point(gps_new, gps->points, gps->dvert, i, 0, true); + gpencil_copy_move_point(gps_new, gps->points, gps->dvert, i, 0, true); /* Calc geometry data. */ BKE_gpencil_stroke_geometry_update(gps); @@ -1098,13 +1098,13 @@ static void gpencil_add_move_points(bGPDframe *gpf, bGPDstroke *gps) /* move points to new position */ for (int i = 0; i < oldtotpoints; i++) { - copy_move_point(gps, temp_points, temp_dverts, i, i2, false); + gpencil_copy_move_point(gps, temp_points, temp_dverts, i, i2, false); i2++; } /* If first point, add new point at the beginning. */ if (do_first) { - copy_move_point(gps, temp_points, temp_dverts, 0, 0, true); + gpencil_copy_move_point(gps, temp_points, temp_dverts, 0, 0, true); /* deselect old */ pt = &gps->points[1]; pt->flag &= ~GP_SPOINT_SELECT; @@ -1115,7 +1115,8 @@ static void gpencil_add_move_points(bGPDframe *gpf, bGPDstroke *gps) /* if last point, add new point at the end */ if (do_last) { - copy_move_point(gps, temp_points, temp_dverts, oldtotpoints - 1, gps->totpoints - 1, true); + gpencil_copy_move_point( + gps, temp_points, temp_dverts, oldtotpoints - 1, gps->totpoints - 1, true); /* deselect old */ pt = &gps->points[gps->totpoints - 2]; @@ -1138,7 +1139,7 @@ static void gpencil_add_move_points(bGPDframe *gpf, bGPDstroke *gps) } } -static int gp_extrude_exec(bContext *C, wmOperator *op) +static int gpencil_extrude_exec(bContext *C, wmOperator *op) { Object *obact = CTX_data_active_object(C); bGPdata *gpd = (bGPdata *)obact->data; @@ -1194,8 +1195,8 @@ void GPENCIL_OT_extrude(wmOperatorType *ot) ot->description = "Extrude the selected Grease Pencil points"; /* callbacks */ - ot->exec = gp_extrude_exec; - ot->poll = gp_stroke_edit_poll; + ot->exec = gpencil_extrude_exec; + ot->poll = gpencil_stroke_edit_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1223,9 +1224,9 @@ ListBase gpencil_strokes_copypastebuf = {NULL, NULL}; * This is needed to prevent dangling and unsafe pointers when pasting across data-blocks, * or after a color used by a stroke in the buffer gets deleted (via user action or undo). */ -static GHash *gp_strokes_copypastebuf_colors = NULL; +static GHash *gpencil_strokes_copypastebuf_colors = NULL; -static GHash *gp_strokes_copypastebuf_colors_material_to_name_create(Main *bmain) +static GHash *gpencil_strokes_copypastebuf_colors_material_to_name_create(Main *bmain) { GHash *ma_to_name = BLI_ghash_ptr_new(__func__); @@ -1237,12 +1238,12 @@ static GHash *gp_strokes_copypastebuf_colors_material_to_name_create(Main *bmain return ma_to_name; } -static void gp_strokes_copypastebuf_colors_material_to_name_free(GHash *ma_to_name) +static void gpencil_strokes_copypastebuf_colors_material_to_name_free(GHash *ma_to_name) { BLI_ghash_free(ma_to_name, NULL, MEM_freeN); } -static GHash *gp_strokes_copypastebuf_colors_name_to_material_create(Main *bmain) +static GHash *gpencil_strokes_copypastebuf_colors_name_to_material_create(Main *bmain) { GHash *name_to_ma = BLI_ghash_str_new(__func__); @@ -1254,7 +1255,7 @@ static GHash *gp_strokes_copypastebuf_colors_name_to_material_create(Main *bmain return name_to_ma; } -static void gp_strokes_copypastebuf_colors_name_to_material_free(GHash *name_to_ma) +static void gpencil_strokes_copypastebuf_colors_name_to_material_free(GHash *name_to_ma) { BLI_ghash_free(name_to_ma, MEM_freeN, NULL); } @@ -1267,9 +1268,9 @@ void ED_gpencil_strokes_copybuf_free(void) /* Free the colors buffer * NOTE: This is done before the strokes so that the ptrs are still safe */ - if (gp_strokes_copypastebuf_colors) { - BLI_ghash_free(gp_strokes_copypastebuf_colors, NULL, MEM_freeN); - gp_strokes_copypastebuf_colors = NULL; + if (gpencil_strokes_copypastebuf_colors) { + BLI_ghash_free(gpencil_strokes_copypastebuf_colors, NULL, MEM_freeN); + gpencil_strokes_copypastebuf_colors = NULL; } /* Free the stroke buffer */ @@ -1304,9 +1305,9 @@ GHash *gpencil_copybuf_validate_colormap(bContext *C) GHashIterator gh_iter; /* For each color, check if exist and add if not */ - GHash *name_to_ma = gp_strokes_copypastebuf_colors_name_to_material_create(bmain); + GHash *name_to_ma = gpencil_strokes_copypastebuf_colors_name_to_material_create(bmain); - GHASH_ITER (gh_iter, gp_strokes_copypastebuf_colors) { + GHASH_ITER (gh_iter, gpencil_strokes_copypastebuf_colors) { int *key = BLI_ghashIterator_getKey(&gh_iter); char *ma_name = BLI_ghashIterator_getValue(&gh_iter); Material *ma = BLI_ghash_lookup(name_to_ma, ma_name); @@ -1319,7 +1320,7 @@ GHash *gpencil_copybuf_validate_colormap(bContext *C) } } - gp_strokes_copypastebuf_colors_name_to_material_free(name_to_ma); + gpencil_strokes_copypastebuf_colors_name_to_material_free(name_to_ma); return new_colors; } @@ -1330,7 +1331,7 @@ GHash *gpencil_copybuf_validate_colormap(bContext *C) /** \name Copy Selected Strokes Operator * \{ */ -static int gp_strokes_copy_exec(bContext *C, wmOperator *op) +static int gpencil_strokes_copy_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Object *ob = CTX_data_active_object(C); @@ -1393,7 +1394,7 @@ static int gp_strokes_copy_exec(bContext *C, wmOperator *op) } else { /* delegate to a helper, as there's too much to fit in here (for copying subsets)... */ - gp_duplicate_points(gps, &gpencil_strokes_copypastebuf, gpl->info); + gpencil_duplicate_points(gps, &gpencil_strokes_copypastebuf, gpl->info); } } } @@ -1402,8 +1403,8 @@ static int gp_strokes_copy_exec(bContext *C, wmOperator *op) /* Build up hash of material colors used in these strokes */ if (gpencil_strokes_copypastebuf.first) { - gp_strokes_copypastebuf_colors = BLI_ghash_int_new("GPencil CopyBuf Colors"); - GHash *ma_to_name = gp_strokes_copypastebuf_colors_material_to_name_create(bmain); + gpencil_strokes_copypastebuf_colors = BLI_ghash_int_new("GPencil CopyBuf Colors"); + GHash *ma_to_name = gpencil_strokes_copypastebuf_colors_material_to_name_create(bmain); LISTBASE_FOREACH (bGPDstroke *, gps, &gpencil_strokes_copypastebuf) { if (ED_gpencil_stroke_can_use(C, gps)) { Material *ma = BKE_object_material_get(ob, gps->mat_nr + 1); @@ -1414,13 +1415,13 @@ static int gp_strokes_copy_exec(bContext *C, wmOperator *op) char **ma_name_val; if (!BLI_ghash_ensure_p( - gp_strokes_copypastebuf_colors, &gps->mat_nr, (void ***)&ma_name_val)) { + gpencil_strokes_copypastebuf_colors, &gps->mat_nr, (void ***)&ma_name_val)) { char *ma_name = BLI_ghash_lookup(ma_to_name, ma); *ma_name_val = MEM_dupallocN(ma_name); } } } - gp_strokes_copypastebuf_colors_material_to_name_free(ma_to_name); + gpencil_strokes_copypastebuf_colors_material_to_name_free(ma_to_name); } /* updates (to ensure operator buttons are refreshed, when used via hotkeys) */ @@ -1438,8 +1439,8 @@ void GPENCIL_OT_copy(wmOperatorType *ot) ot->description = "Copy selected Grease Pencil points and strokes"; /* callbacks */ - ot->exec = gp_strokes_copy_exec; - ot->poll = gp_stroke_edit_poll; + ot->exec = gpencil_strokes_copy_exec; + ot->poll = gpencil_stroke_edit_poll; /* flags */ // ot->flag = OPTYPE_REGISTER; @@ -1451,7 +1452,7 @@ void GPENCIL_OT_copy(wmOperatorType *ot) /** \name Paste Selected Strokes Operator * \{ */ -static bool gp_strokes_paste_poll(bContext *C) +static bool gpencil_strokes_paste_poll(bContext *C) { ScrArea *area = CTX_wm_area(C); if (!((area != NULL) && (area->spacetype == SPACE_VIEW3D))) { @@ -1472,7 +1473,7 @@ typedef enum eGP_PasteMode { GP_COPY_TO_ACTIVE = 1, } eGP_PasteMode; -static int gp_strokes_paste_exec(bContext *C, wmOperator *op) +static int gpencil_strokes_paste_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); bGPdata *gpd = (bGPdata *)ob->data; @@ -1607,8 +1608,8 @@ void GPENCIL_OT_paste(wmOperatorType *ot) ot->description = "Paste previously copied strokes to active layer or to original layer"; /* callbacks */ - ot->exec = gp_strokes_paste_exec; - ot->poll = gp_strokes_paste_poll; + ot->exec = gpencil_strokes_paste_exec; + ot->poll = gpencil_strokes_paste_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1627,7 +1628,7 @@ void GPENCIL_OT_paste(wmOperatorType *ot) /** \name Move To Layer Operator * \{ */ -static int gp_move_to_layer_exec(bContext *C, wmOperator *op) +static int gpencil_move_to_layer_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); bGPdata *gpd = (bGPdata *)ob->data; @@ -1733,8 +1734,8 @@ void GPENCIL_OT_move_to_layer(wmOperatorType *ot) "Move selected strokes to another layer"; // XXX: allow moving individual points too? /* callbacks */ - ot->exec = gp_move_to_layer_exec; - ot->poll = gp_stroke_edit_poll; // XXX? + ot->exec = gpencil_move_to_layer_exec; + ot->poll = gpencil_stroke_edit_poll; // XXX? /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1751,7 +1752,7 @@ void GPENCIL_OT_move_to_layer(wmOperatorType *ot) /** \name Add Blank Frame Operator * \{ */ -static int gp_blank_frame_add_exec(bContext *C, wmOperator *op) +static int gpencil_blank_frame_add_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); Scene *scene = CTX_data_scene(C); @@ -1809,7 +1810,7 @@ void GPENCIL_OT_blank_frame_add(wmOperatorType *ot) "(all subsequently existing frames, if any, are shifted right by one frame)"; /* callbacks */ - ot->exec = gp_blank_frame_add_exec; + ot->exec = gpencil_blank_frame_add_exec; ot->poll = gpencil_add_poll; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1829,7 +1830,7 @@ void GPENCIL_OT_blank_frame_add(wmOperatorType *ot) /** \name Delete Active Frame Operator * \{ */ -static bool gp_actframe_delete_poll(bContext *C) +static bool gpencil_actframe_delete_poll(bContext *C) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd); @@ -1838,7 +1839,7 @@ static bool gp_actframe_delete_poll(bContext *C) return (gpl && gpl->actframe); } -static bool gp_annotation_actframe_delete_poll(bContext *C) +static bool annotation_actframe_delete_poll(bContext *C) { bGPdata *gpd = ED_annotation_data_get_active(C); bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd); @@ -1848,7 +1849,7 @@ static bool gp_annotation_actframe_delete_poll(bContext *C) } /* delete active frame - wrapper around API calls */ -static int gp_actframe_delete_exec(bContext *C, wmOperator *op) +static int gpencil_actframe_delete_exec(bContext *C, wmOperator *op) { const bool is_annotation = STREQ(op->idname, "GPENCIL_OT_annotation_active_frame_delete"); @@ -1891,8 +1892,8 @@ void GPENCIL_OT_active_frame_delete(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* callbacks */ - ot->exec = gp_actframe_delete_exec; - ot->poll = gp_actframe_delete_poll; + ot->exec = gpencil_actframe_delete_exec; + ot->poll = gpencil_actframe_delete_poll; } void GPENCIL_OT_annotation_active_frame_delete(wmOperatorType *ot) @@ -1905,8 +1906,8 @@ void GPENCIL_OT_annotation_active_frame_delete(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* callbacks */ - ot->exec = gp_actframe_delete_exec; - ot->poll = gp_annotation_actframe_delete_poll; + ot->exec = gpencil_actframe_delete_exec; + ot->poll = annotation_actframe_delete_poll; } /** \} */ @@ -1915,7 +1916,7 @@ void GPENCIL_OT_annotation_active_frame_delete(wmOperatorType *ot) /** \name Delete All Active Frames * \{ */ -static bool gp_actframe_delete_all_poll(bContext *C) +static bool gpencil_actframe_delete_all_poll(bContext *C) { bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -1925,7 +1926,7 @@ static bool gp_actframe_delete_all_poll(bContext *C) return (gpd && gpd->layers.first); } -static int gp_actframe_delete_all_exec(bContext *C, wmOperator *op) +static int gpencil_actframe_delete_all_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); Scene *scene = CTX_data_scene(C); @@ -1970,8 +1971,8 @@ void GPENCIL_OT_active_frames_delete_all(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* callbacks */ - ot->exec = gp_actframe_delete_all_exec; - ot->poll = gp_actframe_delete_all_poll; + ot->exec = gpencil_actframe_delete_all_exec; + ot->poll = gpencil_actframe_delete_all_poll; } /** \} */ @@ -1999,7 +2000,7 @@ typedef enum eGP_DissolveMode { } eGP_DissolveMode; /* Delete selected strokes */ -static int gp_delete_selected_strokes(bContext *C) +static int gpencil_delete_selected_strokes(bContext *C) { bool changed = false; bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -2057,7 +2058,7 @@ static int gp_delete_selected_strokes(bContext *C) /* ----------------------------------- */ /* Delete selected points but keep the stroke */ -static int gp_dissolve_selected_points(bContext *C, eGP_DissolveMode mode) +static int gpencil_dissolve_selected_points(bContext *C, eGP_DissolveMode mode) { Object *ob = CTX_data_active_object(C); bGPdata *gpd = (bGPdata *)ob->data; @@ -2283,7 +2284,9 @@ typedef struct tGPDeleteIsland { int end_idx; } tGPDeleteIsland; -static void gp_stroke_join_islands(bGPDframe *gpf, bGPDstroke *gps_first, bGPDstroke *gps_last) +static void gpencil_stroke_join_islands(bGPDframe *gpf, + bGPDstroke *gps_first, + bGPDstroke *gps_last) { bGPDspoint *pt = NULL; bGPDspoint *pt_final = NULL; @@ -2518,7 +2521,7 @@ void gpencil_stroke_delete_tagged_points(bGPDframe *gpf, } /* if cyclic, need to join last stroke with first stroke */ if ((is_cyclic) && (gps_first != NULL) && (gps_first != new_stroke)) { - gp_stroke_join_islands(gpf, gps_first, new_stroke); + gpencil_stroke_join_islands(gpf, gps_first, new_stroke); } } @@ -2531,7 +2534,7 @@ void gpencil_stroke_delete_tagged_points(bGPDframe *gpf, } /* Split selected strokes into segments, splitting on selected points */ -static int gp_delete_selected_points(bContext *C) +static int gpencil_delete_selected_points(bContext *C) { Object *ob = CTX_data_active_object(C); bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -2588,7 +2591,7 @@ static int gp_delete_selected_points(bContext *C) /* simple wrapper to external call */ int gpencil_delete_selected_point_wrap(bContext *C) { - return gp_delete_selected_points(C); + return gpencil_delete_selected_points(C); } /** \} */ @@ -2597,22 +2600,22 @@ int gpencil_delete_selected_point_wrap(bContext *C) /** \name Delete Operator * \{ */ -static int gp_delete_exec(bContext *C, wmOperator *op) +static int gpencil_delete_exec(bContext *C, wmOperator *op) { eGP_DeleteMode mode = RNA_enum_get(op->ptr, "type"); int result = OPERATOR_CANCELLED; switch (mode) { case GP_DELETEOP_STROKES: /* selected strokes */ - result = gp_delete_selected_strokes(C); + result = gpencil_delete_selected_strokes(C); break; case GP_DELETEOP_POINTS: /* selected points (breaks the stroke into segments) */ - result = gp_delete_selected_points(C); + result = gpencil_delete_selected_points(C); break; case GP_DELETEOP_FRAME: /* active frame */ - result = gp_actframe_delete_exec(C, op); + result = gpencil_actframe_delete_exec(C, op); break; } @@ -2639,8 +2642,8 @@ void GPENCIL_OT_delete(wmOperatorType *ot) /* callbacks */ ot->invoke = WM_menu_invoke; - ot->exec = gp_delete_exec; - ot->poll = gp_stroke_edit_poll; + ot->exec = gpencil_delete_exec; + ot->poll = gpencil_stroke_edit_poll; /* flags */ ot->flag = OPTYPE_UNDO | OPTYPE_REGISTER; @@ -2660,11 +2663,11 @@ void GPENCIL_OT_delete(wmOperatorType *ot) /** \name Dissolve Operator * \{ */ -static int gp_dissolve_exec(bContext *C, wmOperator *op) +static int gpencil_dissolve_exec(bContext *C, wmOperator *op) { eGP_DissolveMode mode = RNA_enum_get(op->ptr, "type"); - return gp_dissolve_selected_points(C, mode); + return gpencil_dissolve_selected_points(C, mode); } void GPENCIL_OT_dissolve(wmOperatorType *ot) @@ -2687,8 +2690,8 @@ void GPENCIL_OT_dissolve(wmOperatorType *ot) /* callbacks */ ot->invoke = WM_menu_invoke; - ot->exec = gp_dissolve_exec; - ot->poll = gp_stroke_edit_poll; + ot->exec = gpencil_dissolve_exec; + ot->poll = gpencil_stroke_edit_poll; /* flags */ ot->flag = OPTYPE_UNDO | OPTYPE_REGISTER; @@ -2712,7 +2715,7 @@ void GPENCIL_OT_dissolve(wmOperatorType *ot) /* NOTE: For now, we only allow these in the 3D view, as other editors do not * define a cursor or gridstep which can be used */ -static bool gp_snap_poll(bContext *C) +static bool gpencil_snap_poll(bContext *C) { ScrArea *area = CTX_wm_area(C); Object *ob = CTX_data_active_object(C); @@ -2721,7 +2724,7 @@ static bool gp_snap_poll(bContext *C) ((area != NULL) && (area->spacetype == SPACE_VIEW3D)); } -static int gp_snap_to_grid(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_snap_to_grid(bContext *C, wmOperator *UNUSED(op)) { bGPdata *gpd = ED_gpencil_data_get_active(C); RegionView3D *rv3d = CTX_wm_region_data(C); @@ -2788,8 +2791,8 @@ void GPENCIL_OT_snap_to_grid(wmOperatorType *ot) ot->description = "Snap selected points to the nearest grid points"; /* callbacks */ - ot->exec = gp_snap_to_grid; - ot->poll = gp_snap_poll; + ot->exec = gpencil_snap_to_grid; + ot->poll = gpencil_snap_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -2801,7 +2804,7 @@ void GPENCIL_OT_snap_to_grid(wmOperatorType *ot) /** \name Snapping Selection to Cursor Operator * \{ */ -static int gp_snap_to_cursor(bContext *C, wmOperator *op) +static int gpencil_snap_to_cursor(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -2877,8 +2880,8 @@ void GPENCIL_OT_snap_to_cursor(wmOperatorType *ot) ot->description = "Snap selected points/strokes to the cursor"; /* callbacks */ - ot->exec = gp_snap_to_cursor; - ot->poll = gp_snap_poll; + ot->exec = gpencil_snap_to_cursor; + ot->poll = gpencil_snap_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -2897,7 +2900,7 @@ void GPENCIL_OT_snap_to_cursor(wmOperatorType *ot) /** \name Snapping Cursor to Selection Operator * \{ */ -static int gp_snap_cursor_to_sel(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_snap_cursor_to_sel(bContext *C, wmOperator *UNUSED(op)) { Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Object *obact = CTX_data_active_object(C); @@ -2982,8 +2985,8 @@ void GPENCIL_OT_snap_cursor_to_selected(wmOperatorType *ot) ot->description = "Snap cursor to center of selected points"; /* callbacks */ - ot->exec = gp_snap_cursor_to_sel; - ot->poll = gp_snap_poll; + ot->exec = gpencil_snap_cursor_to_sel; + ot->poll = gpencil_snap_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -2995,7 +2998,7 @@ void GPENCIL_OT_snap_cursor_to_selected(wmOperatorType *ot) /** \name Apply Layer Thickness Change to Strokes Operator * \{ */ -static int gp_stroke_apply_thickness_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_stroke_apply_thickness_exec(bContext *C, wmOperator *UNUSED(op)) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd); @@ -3036,7 +3039,7 @@ void GPENCIL_OT_stroke_apply_thickness(wmOperatorType *ot) ot->description = "Apply the thickness change of the layer to its strokes"; /* api callbacks */ - ot->exec = gp_stroke_apply_thickness_exec; + ot->exec = gpencil_stroke_apply_thickness_exec; ot->poll = gpencil_active_layer_poll; } @@ -3052,7 +3055,7 @@ enum { GP_STROKE_CYCLIC_TOGGLE = 3, }; -static int gp_stroke_cyclical_set_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_cyclical_set_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); Object *ob = CTX_data_active_object(C); @@ -3151,7 +3154,7 @@ void GPENCIL_OT_stroke_cyclical_set(wmOperatorType *ot) ot->description = "Close or open the selected stroke adding an edge from last to first point"; /* api callbacks */ - ot->exec = gp_stroke_cyclical_set_exec; + ot->exec = gpencil_stroke_cyclical_set_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -3177,7 +3180,7 @@ enum { GP_STROKE_CAPS_TOGGLE_DEFAULT = 3, }; -static int gp_stroke_caps_set_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_caps_set_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); Object *ob = CTX_data_active_object(C); @@ -3254,7 +3257,7 @@ void GPENCIL_OT_stroke_caps_set(wmOperatorType *ot) ot->description = "Change Stroke caps mode (rounded or flat)"; /* api callbacks */ - ot->exec = gp_stroke_caps_set_exec; + ot->exec = gpencil_stroke_caps_set_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -3426,7 +3429,7 @@ static void gpencil_stroke_join_strokes(bGPDstroke *gps_a, } } -static int gp_stroke_join_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_join_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDlayer *activegpl = BKE_gpencil_layer_active_get(gpd); @@ -3553,7 +3556,7 @@ void GPENCIL_OT_stroke_join(wmOperatorType *ot) ot->description = "Join selected strokes (optionally as new stroke)"; /* api callbacks */ - ot->exec = gp_stroke_join_exec; + ot->exec = gpencil_stroke_join_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -3574,7 +3577,7 @@ void GPENCIL_OT_stroke_join(wmOperatorType *ot) /** \name Stroke Flip Operator * \{ */ -static int gp_stroke_flip_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_stroke_flip_exec(bContext *C, wmOperator *UNUSED(op)) { bGPdata *gpd = ED_gpencil_data_get_active(C); Object *ob = CTX_data_active_object(C); @@ -3624,7 +3627,7 @@ void GPENCIL_OT_stroke_flip(wmOperatorType *ot) ot->description = "Change direction of the points of the selected strokes"; /* api callbacks */ - ot->exec = gp_stroke_flip_exec; + ot->exec = gpencil_stroke_flip_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -3637,7 +3640,7 @@ void GPENCIL_OT_stroke_flip(wmOperatorType *ot) /** \name Stroke Re-project Operator * \{ */ -static int gp_strokes_reproject_exec(bContext *C, wmOperator *op) +static int gpencil_strokes_reproject_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); Scene *scene = CTX_data_scene(C); @@ -3722,8 +3725,8 @@ void GPENCIL_OT_reproject(wmOperatorType *ot) /* callbacks */ ot->invoke = WM_menu_invoke; - ot->exec = gp_strokes_reproject_exec; - ot->poll = gp_strokes_edit3d_poll; + ot->exec = gpencil_strokes_reproject_exec; + ot->poll = gpencil_strokes_edit3d_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -3740,7 +3743,7 @@ void GPENCIL_OT_reproject(wmOperatorType *ot) "Keep original strokes and create a copy before reprojecting instead of reproject them"); } -static int gp_recalc_geometry_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_recalc_geometry_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob = CTX_data_active_object(C); if ((ob == NULL) || (ob->type != OB_GPENCIL)) { @@ -3769,7 +3772,7 @@ void GPENCIL_OT_recalc_geometry(wmOperatorType *ot) ot->description = "Update all internal geometry data"; /* callbacks */ - ot->exec = gp_recalc_geometry_exec; + ot->exec = gpencil_recalc_geometry_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -3783,7 +3786,7 @@ void GPENCIL_OT_recalc_geometry(wmOperatorType *ot) * \{ */ /* helper to smooth */ -static void gp_smooth_stroke(bContext *C, wmOperator *op) +static void gpencil_smooth_stroke(bContext *C, wmOperator *op) { const int repeat = RNA_int_get(op->ptr, "repeat"); float factor = RNA_float_get(op->ptr, "factor"); @@ -3830,7 +3833,7 @@ static void gp_smooth_stroke(bContext *C, wmOperator *op) } /* helper: Count how many points need to be inserted */ -static int gp_count_subdivision_cuts(bGPDstroke *gps) +static int gpencil_count_subdivision_cuts(bGPDstroke *gps) { bGPDspoint *pt; int i; @@ -3848,7 +3851,7 @@ static int gp_count_subdivision_cuts(bGPDstroke *gps) return totnewpoints; } -static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_subdivide_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); bGPDspoint *temp_points; @@ -3867,7 +3870,7 @@ static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op) if (gps->flag & GP_STROKE_SELECT) { /* loop as many times as cuts */ for (int s = 0; s < cuts; s++) { - totnewpoints = gp_count_subdivision_cuts(gps); + totnewpoints = gpencil_count_subdivision_cuts(gps); if (totnewpoints == 0) { continue; } @@ -3967,7 +3970,7 @@ static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op) GP_EDITABLE_STROKES_END(gpstroke_iter); /* smooth stroke */ - gp_smooth_stroke(C, op); + gpencil_smooth_stroke(C, op); /* notifiers */ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); @@ -3988,7 +3991,7 @@ void GPENCIL_OT_stroke_subdivide(wmOperatorType *ot) "them"; /* api callbacks */ - ot->exec = gp_stroke_subdivide_exec; + ot->exec = gpencil_stroke_subdivide_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -4015,7 +4018,7 @@ void GPENCIL_OT_stroke_subdivide(wmOperatorType *ot) } /* ** simplify stroke *** */ -static int gp_stroke_simplify_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_simplify_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); float factor = RNA_float_get(op->ptr, "factor"); @@ -4051,7 +4054,7 @@ void GPENCIL_OT_stroke_simplify(wmOperatorType *ot) ot->description = "Simplify selected stroked reducing number of points"; /* api callbacks */ - ot->exec = gp_stroke_simplify_exec; + ot->exec = gpencil_stroke_simplify_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -4064,7 +4067,7 @@ void GPENCIL_OT_stroke_simplify(wmOperatorType *ot) } /* ** simplify stroke using fixed algorithm *** */ -static int gp_stroke_simplify_fixed_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_simplify_fixed_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); int steps = RNA_int_get(op->ptr, "step"); @@ -4101,7 +4104,7 @@ void GPENCIL_OT_stroke_simplify_fixed(wmOperatorType *ot) ot->description = "Simplify selected stroked reducing number of points using fixed algorithm"; /* api callbacks */ - ot->exec = gp_stroke_simplify_fixed_exec; + ot->exec = gpencil_stroke_simplify_fixed_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -4115,7 +4118,7 @@ void GPENCIL_OT_stroke_simplify_fixed(wmOperatorType *ot) } /* ** Resample stroke *** */ -static int gp_stroke_sample_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_sample_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); const float length = RNA_float_get(op->ptr, "length"); @@ -4150,7 +4153,7 @@ void GPENCIL_OT_stroke_sample(wmOperatorType *ot) ot->description = "Sample stroke points to predefined segment length"; /* api callbacks */ - ot->exec = gp_stroke_sample_exec; + ot->exec = gpencil_stroke_sample_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -4168,7 +4171,7 @@ void GPENCIL_OT_stroke_sample(wmOperatorType *ot) /** \name Stroke Trim Operator * \{ */ -static int gp_stroke_trim_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_stroke_trim_exec(bContext *C, wmOperator *UNUSED(op)) { bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -4225,7 +4228,7 @@ void GPENCIL_OT_stroke_trim(wmOperatorType *ot) ot->description = "Trim selected stroke to first loop or intersection"; /* api callbacks */ - ot->exec = gp_stroke_trim_exec; + ot->exec = gpencil_stroke_trim_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -4247,7 +4250,7 @@ typedef enum eGP_SeparateModes { GP_SEPARATE_LAYER, } eGP_SeparateModes; -static int gp_stroke_separate_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op) { Base *base_new; Main *bmain = CTX_data_main(C); @@ -4447,8 +4450,8 @@ void GPENCIL_OT_stroke_separate(wmOperatorType *ot) /* callbacks */ ot->invoke = WM_menu_invoke; - ot->exec = gp_stroke_separate_exec; - ot->poll = gp_strokes_edit3d_poll; + ot->exec = gpencil_stroke_separate_exec; + ot->poll = gpencil_strokes_edit3d_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -4463,7 +4466,7 @@ void GPENCIL_OT_stroke_separate(wmOperatorType *ot) /** \name Stroke Split Operator * \{ */ -static int gp_stroke_split_exec(bContext *C, wmOperator *UNUSED(op)) +static int gpencil_stroke_split_exec(bContext *C, wmOperator *UNUSED(op)) { Object *ob = CTX_data_active_object(C); bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -4552,8 +4555,8 @@ void GPENCIL_OT_stroke_split(wmOperatorType *ot) ot->description = "Split selected points as new stroke on same frame"; /* callbacks */ - ot->exec = gp_stroke_split_exec; - ot->poll = gp_strokes_edit3d_poll; + ot->exec = gpencil_stroke_split_exec; + ot->poll = gpencil_strokes_edit3d_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -4565,7 +4568,7 @@ void GPENCIL_OT_stroke_split(wmOperatorType *ot) /** \name Stroke Smooth Operator * \{ */ -static int gp_stroke_smooth_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_smooth_exec(bContext *C, wmOperator *op) { bGPdata *gpd = ED_gpencil_data_get_active(C); @@ -4574,7 +4577,7 @@ static int gp_stroke_smooth_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - gp_smooth_stroke(C, op); + gpencil_smooth_stroke(C, op); /* notifiers */ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); @@ -4593,7 +4596,7 @@ void GPENCIL_OT_stroke_smooth(wmOperatorType *ot) ot->description = "Smooth selected strokes"; /* api callbacks */ - ot->exec = gp_stroke_smooth_exec; + ot->exec = gpencil_stroke_smooth_exec; ot->poll = gpencil_active_layer_poll; /* flags */ @@ -4884,7 +4887,7 @@ bool ED_object_gpencil_exit(struct Main *bmain, Object *ob) /** \name Merge By Distance Operator * \{ */ -static bool gp_merge_by_distance_poll(bContext *C) +static bool gpencil_merge_by_distance_poll(bContext *C) { Object *ob = CTX_data_active_object(C); if ((ob == NULL) || (ob->type != OB_GPENCIL)) { @@ -4900,7 +4903,7 @@ static bool gp_merge_by_distance_poll(bContext *C) return ((gpl != NULL) && (ob->mode == OB_MODE_EDIT_GPENCIL)); } -static int gp_merge_by_distance_exec(bContext *C, wmOperator *op) +static int gpencil_merge_by_distance_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); bGPdata *gpd = (bGPdata *)ob->data; @@ -4937,8 +4940,8 @@ void GPENCIL_OT_stroke_merge_by_distance(wmOperatorType *ot) ot->description = "Merge points by distance"; /* api callbacks */ - ot->exec = gp_merge_by_distance_exec; - ot->poll = gp_merge_by_distance_poll; + ot->exec = gpencil_merge_by_distance_exec; + ot->poll = gpencil_merge_by_distance_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index 70c340c6750..9a0c5ad997f 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -162,13 +162,13 @@ typedef struct tGPDfill { } tGPDfill; /* draw a given stroke using same thickness and color for all points */ -static void gp_draw_basic_stroke(tGPDfill *tgpf, - bGPDstroke *gps, - const float diff_mat[4][4], - const bool cyclic, - const float ink[4], - const int flag, - const float thershold) +static void gpencil_draw_basic_stroke(tGPDfill *tgpf, + bGPDstroke *gps, + const float diff_mat[4][4], + const bool cyclic, + const float ink[4], + const int flag, + const float thershold) { bGPDspoint *points = gps->points; @@ -223,7 +223,7 @@ static void gp_draw_basic_stroke(tGPDfill *tgpf, } /* loop all layers */ -static void gp_draw_datablock(tGPDfill *tgpf, const float ink[4]) +static void gpencil_draw_datablock(tGPDfill *tgpf, const float ink[4]) { /* duplicated: etempFlags */ enum { @@ -304,13 +304,13 @@ static void gp_draw_datablock(tGPDfill *tgpf, const float ink[4]) /* 3D Lines with basic shapes and invisible lines */ if ((tgpf->fill_draw_mode == GP_FILL_DMODE_CONTROL) || (tgpf->fill_draw_mode == GP_FILL_DMODE_BOTH)) { - gp_draw_basic_stroke(tgpf, - gps, - tgpw.diff_mat, - gps->flag & GP_STROKE_CYCLIC, - ink, - tgpf->flag, - tgpf->fill_threshold); + gpencil_draw_basic_stroke(tgpf, + gps, + tgpw.diff_mat, + gps->flag & GP_STROKE_CYCLIC, + ink, + tgpf->flag, + tgpf->fill_threshold); } } } @@ -319,7 +319,7 @@ static void gp_draw_datablock(tGPDfill *tgpf, const float ink[4]) } /* draw strokes in offscreen buffer */ -static bool gp_render_offscreen(tGPDfill *tgpf) +static bool gpencil_render_offscreen(tGPDfill *tgpf) { bool is_ortho = false; float winmat[4][4]; @@ -410,7 +410,7 @@ static bool gp_render_offscreen(tGPDfill *tgpf) /* draw strokes */ float ink[4] = {1.0f, 0.0f, 0.0f, 1.0f}; - gp_draw_datablock(tgpf, ink); + gpencil_draw_datablock(tgpf, ink); GPU_matrix_pop_projection(); GPU_matrix_pop(); @@ -667,62 +667,6 @@ static void gpencil_boundaryfill_area(tGPDfill *tgpf) BLI_stack_free(stack); } -/* Check if there are some pixel not filled with green. If no points, means nothing to fill. */ -static bool UNUSED_FUNCTION(gpencil_check_borders)(tGPDfill *tgpf) -{ - ImBuf *ibuf; - void *lock; - ibuf = BKE_image_acquire_ibuf(tgpf->ima, NULL, &lock); - int idx; - int pixel = 0; - float color[4]; - bool found = false; - - /* horizontal lines */ - for (idx = 0; idx < ibuf->x; idx++) { - /* bottom line */ - get_pixel(ibuf, idx, color); - if (color[1] != 1.0f) { - found = true; - break; - } - /* top line */ - pixel = idx + (ibuf->x * (ibuf->y - 1)); - get_pixel(ibuf, pixel, color); - if (color[1] != 1.0f) { - found = true; - break; - } - } - if (!found) { - /* vertical lines */ - for (idx = 0; idx < ibuf->y; idx++) { - /* left line */ - get_pixel(ibuf, ibuf->x * idx, color); - if (color[1] != 1.0f) { - found = true; - break; - } - /* right line */ - pixel = ibuf->x * idx + (ibuf->x - 1); - get_pixel(ibuf, pixel, color); - if (color[1] != 1.0f) { - found = true; - break; - } - } - } - - /* release ibuf */ - if (ibuf) { - BKE_image_release_ibuf(tgpf->ima, ibuf, lock); - } - - tgpf->ima->id.tag |= LIB_TAG_DOIT; - - return found; -} - /* Set a border to create image limits. */ static void gpencil_set_borders(tGPDfill *tgpf, const bool transparent) { @@ -1225,7 +1169,7 @@ static void gpencil_draw_boundary_lines(const bContext *UNUSED(C), tGPDfill *tgp return; } const float ink[4] = {1.0f, 0.0f, 0.0f, 1.0f}; - gp_draw_datablock(tgpf, ink); + gpencil_draw_datablock(tgpf, ink); } /* Drawing callback for modal operator in 3d mode */ @@ -1268,7 +1212,7 @@ static bool gpencil_fill_poll(bContext *C) } /* Allocate memory and initialize values */ -static tGPDfill *gp_session_init_fill(bContext *C, wmOperator *UNUSED(op)) +static tGPDfill *gpencil_session_init_fill(bContext *C, wmOperator *UNUSED(op)) { tGPDfill *tgpf = MEM_callocN(sizeof(tGPDfill), "GPencil Fill Data"); @@ -1401,7 +1345,7 @@ static int gpencil_fill_init(bContext *C, wmOperator *op) } /* check context */ - tgpf = op->customdata = gp_session_init_fill(C, op); + tgpf = op->customdata = gpencil_session_init_fill(C, op); if (tgpf == NULL) { /* something wasn't set correctly in context */ gpencil_fill_exit(C, op); @@ -1501,7 +1445,7 @@ static int gpencil_fill_modal(bContext *C, wmOperator *op, const wmEvent *event) tgpf->active_cfra = CFRA; /* render screen to temp image */ - if (gp_render_offscreen(tgpf)) { + if (gpencil_render_offscreen(tgpf)) { /* Set red borders to create a external limit. */ gpencil_set_borders(tgpf, true); diff --git a/source/blender/editors/gpencil/gpencil_interpolate.c b/source/blender/editors/gpencil/gpencil_interpolate.c index 88ae81ce85a..5e653187edb 100644 --- a/source/blender/editors/gpencil/gpencil_interpolate.c +++ b/source/blender/editors/gpencil/gpencil_interpolate.c @@ -100,10 +100,10 @@ static bool gpencil_view3d_poll(bContext *C) } /* Perform interpolation */ -static void gp_interpolate_update_points(const bGPDstroke *gps_from, - const bGPDstroke *gps_to, - bGPDstroke *new_stroke, - float factor) +static void gpencil_interpolate_update_points(const bGPDstroke *gps_from, + const bGPDstroke *gps_to, + bGPDstroke *new_stroke, + float factor) { /* update points */ for (int i = 0; i < new_stroke->totpoints; i++) { @@ -121,7 +121,7 @@ static void gp_interpolate_update_points(const bGPDstroke *gps_from, /* ****************** Interpolate Interactive *********************** */ /* Helper: free all temp strokes for display. */ -static void gp_interpolate_free_temp_strokes(bGPDframe *gpf) +static void gpencil_interpolate_free_temp_strokes(bGPDframe *gpf) { if (gpf == NULL) { return; @@ -136,7 +136,7 @@ static void gp_interpolate_free_temp_strokes(bGPDframe *gpf) } /* Helper: Untag all strokes. */ -static void gp_interpolate_untag_strokes(bGPDframe *gpf) +static void gpencil_interpolate_untag_strokes(bGPDframe *gpf) { if (gpf == NULL) { return; @@ -150,7 +150,7 @@ static void gp_interpolate_untag_strokes(bGPDframe *gpf) } /* Helper: Update all strokes interpolated */ -static void gp_interpolate_update_strokes(bContext *C, tGPDinterpolate *tgpi) +static void gpencil_interpolate_update_strokes(bContext *C, tGPDinterpolate *tgpi) { bGPdata *gpd = tgpi->gpd; const float shift = tgpi->shift; @@ -160,7 +160,7 @@ static void gp_interpolate_update_strokes(bContext *C, tGPDinterpolate *tgpi) bGPDframe *gpf = tgpil->gpl->actframe; /* Free temp strokes. */ - gp_interpolate_free_temp_strokes(gpf); + gpencil_interpolate_free_temp_strokes(gpf); LISTBASE_FOREACH (bGPDstroke *, new_stroke, &tgpil->interFrame->strokes) { bGPDstroke *gps_from, *gps_to; @@ -178,7 +178,7 @@ static void gp_interpolate_update_strokes(bContext *C, tGPDinterpolate *tgpi) /* update points position */ if ((gps_from) && (gps_to)) { - gp_interpolate_update_points(gps_from, gps_to, new_stroke, factor); + gpencil_interpolate_update_points(gps_from, gps_to, new_stroke, factor); /* Add temp strokes. */ if (gpf) { @@ -195,7 +195,7 @@ static void gp_interpolate_update_strokes(bContext *C, tGPDinterpolate *tgpi) } /* Helper: Verify valid strokes for interpolation */ -static bool gp_interpolate_check_todo(bContext *C, bGPdata *gpd) +static bool gpencil_interpolate_check_todo(bContext *C, bGPdata *gpd) { Object *ob = CTX_data_active_object(C); ToolSettings *ts = CTX_data_tool_settings(C); @@ -245,7 +245,7 @@ static bool gp_interpolate_check_todo(bContext *C, bGPdata *gpd) } /* Helper: Create internal strokes interpolated */ -static void gp_interpolate_set_points(bContext *C, tGPDinterpolate *tgpi) +static void gpencil_interpolate_set_points(bContext *C, tGPDinterpolate *tgpi) { bGPdata *gpd = tgpi->gpd; bGPDlayer *active_gpl = CTX_data_active_gpencil_layer(C); @@ -268,8 +268,8 @@ static void gp_interpolate_set_points(bContext *C, tGPDinterpolate *tgpi) * all layer because it could be anything tagged and it would be removed * at the end of the process when all tagged strokes are removed. */ if (gpl->actframe != NULL) { - gp_interpolate_untag_strokes(gpl->actframe); - gp_interpolate_untag_strokes(gpl->actframe->next); + gpencil_interpolate_untag_strokes(gpl->actframe); + gpencil_interpolate_untag_strokes(gpl->actframe->next); } /* all layers or only active */ @@ -343,7 +343,7 @@ static void gp_interpolate_set_points(bContext *C, tGPDinterpolate *tgpi) new_stroke->totpoints = gps_to->totpoints; } /* update points position */ - gp_interpolate_update_points(gps_from, gps_to, new_stroke, tgpil->factor); + gpencil_interpolate_update_points(gps_from, gps_to, new_stroke, tgpil->factor); } else { /* need an empty stroke to keep index correct for lookup, but resize to smallest size */ @@ -419,7 +419,7 @@ static void gpencil_interpolate_update(bContext *C, wmOperator *op, tGPDinterpol /* apply... */ tgpi->shift = RNA_float_get(op->ptr, "shift"); /* update points position */ - gp_interpolate_update_strokes(C, tgpi); + gpencil_interpolate_update_strokes(C, tgpi); } /* ----------------------- */ @@ -439,7 +439,7 @@ static void gpencil_interpolate_exit(bContext *C, wmOperator *op) /* Clear any temp stroke. */ LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) { - gp_interpolate_free_temp_strokes(gpf); + gpencil_interpolate_free_temp_strokes(gpf); } } @@ -460,7 +460,7 @@ static void gpencil_interpolate_exit(bContext *C, wmOperator *op) } /* Init new temporary interpolation data */ -static bool gp_interpolate_set_init_values(bContext *C, wmOperator *op, tGPDinterpolate *tgpi) +static bool gpencil_interpolate_set_init_values(bContext *C, wmOperator *op, tGPDinterpolate *tgpi) { ToolSettings *ts = CTX_data_tool_settings(C); bGPdata *gpd = CTX_data_gpencil_data(C); @@ -481,18 +481,18 @@ static bool gp_interpolate_set_init_values(bContext *C, wmOperator *op, tGPDinte /* set interpolation weight */ tgpi->shift = RNA_float_get(op->ptr, "shift"); /* set layers */ - gp_interpolate_set_points(C, tgpi); + gpencil_interpolate_set_points(C, tgpi); return 1; } /* Allocate memory and initialize values */ -static tGPDinterpolate *gp_session_init_interpolation(bContext *C, wmOperator *op) +static tGPDinterpolate *gpencil_session_init_interpolation(bContext *C, wmOperator *op) { tGPDinterpolate *tgpi = MEM_callocN(sizeof(tGPDinterpolate), "GPencil Interpolate Data"); /* define initial values */ - gp_interpolate_set_init_values(C, op, tgpi); + gpencil_interpolate_set_init_values(C, op, tgpi); /* return context data for running operator */ return tgpi; @@ -504,7 +504,7 @@ static int gpencil_interpolate_init(bContext *C, wmOperator *op) tGPDinterpolate *tgpi; /* check context */ - tgpi = op->customdata = gp_session_init_interpolation(C, op); + tgpi = op->customdata = gpencil_session_init_interpolation(C, op); if (tgpi == NULL) { /* something wasn't set correctly in context */ gpencil_interpolate_exit(C, op); @@ -546,7 +546,7 @@ static int gpencil_interpolate_invoke(bContext *C, wmOperator *op, const wmEvent } /* need editable strokes */ - if (!gp_interpolate_check_todo(C, gpd)) { + if (!gpencil_interpolate_check_todo(C, gpd)) { BKE_report(op->reports, RPT_ERROR, "Interpolation requires some editable strokes"); return OPERATOR_CANCELLED; } @@ -737,7 +737,7 @@ void GPENCIL_OT_interpolate(wmOperatorType *ot) /* ****************** Interpolate Sequence *********************** */ /* Helper: Perform easing equation calculations for GP interpolation operator */ -static float gp_interpolate_seq_easing_calc(GP_Interpolate_Settings *ipo_settings, float time) +static float gpencil_interpolate_seq_easing_calc(GP_Interpolate_Settings *ipo_settings, float time) { const float begin = 0.0f; const float change = 1.0f; @@ -1014,7 +1014,7 @@ static int gpencil_interpolate_seq_exec(bContext *C, wmOperator *op) } else if (ipo_settings->type >= GP_IPO_BACK) { /* easing equation... */ - factor = gp_interpolate_seq_easing_calc(ipo_settings, factor); + factor = gpencil_interpolate_seq_easing_calc(ipo_settings, factor); } /* create new strokes data with interpolated points reading original stroke */ @@ -1070,7 +1070,7 @@ static int gpencil_interpolate_seq_exec(bContext *C, wmOperator *op) } /* update points position */ - gp_interpolate_update_points(gps_from, gps_to, new_stroke, factor); + gpencil_interpolate_update_points(gps_from, gps_to, new_stroke, factor); /* Calc geometry data. */ BKE_gpencil_stroke_geometry_update(new_stroke); diff --git a/source/blender/editors/gpencil/gpencil_merge.c b/source/blender/editors/gpencil/gpencil_merge.c index 26eec030803..cf806e68837 100644 --- a/source/blender/editors/gpencil/gpencil_merge.c +++ b/source/blender/editors/gpencil/gpencil_merge.c @@ -431,7 +431,7 @@ static int gpencil_analyze_strokes(tGPencilPointCache *src_array, return last; } -static bool gp_strokes_merge_poll(bContext *C) +static bool gpencil_strokes_merge_poll(bContext *C) { /* only supported with grease pencil objects */ Object *ob = CTX_data_active_object(C); @@ -462,7 +462,7 @@ static bool gp_strokes_merge_poll(bContext *C) return (CTX_DATA_COUNT(C, editable_gpencil_strokes) != 0) && ED_operator_view3d_active(C); } -static int gp_stroke_merge_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_merge_exec(bContext *C, wmOperator *op) { const int mode = RNA_enum_get(op->ptr, "mode"); const bool clear_point = RNA_boolean_get(op->ptr, "clear_point"); @@ -546,8 +546,8 @@ void GPENCIL_OT_stroke_merge(wmOperatorType *ot) ot->description = "Create a new stroke with the selected stroke points"; /* api callbacks */ - ot->exec = gp_stroke_merge_exec; - ot->poll = gp_strokes_merge_poll; + ot->exec = gpencil_stroke_merge_exec; + ot->poll = gpencil_strokes_merge_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -563,7 +563,7 @@ void GPENCIL_OT_stroke_merge(wmOperatorType *ot) } /* Merge similar materials. */ -static bool gp_stroke_merge_material_poll(bContext *C) +static bool gpencil_stroke_merge_material_poll(bContext *C) { /* only supported with grease pencil objects */ Object *ob = CTX_data_active_object(C); @@ -574,7 +574,7 @@ static bool gp_stroke_merge_material_poll(bContext *C) return true; } -static int gp_stroke_merge_material_exec(bContext *C, wmOperator *op) +static int gpencil_stroke_merge_material_exec(bContext *C, wmOperator *op) { Object *ob = CTX_data_active_object(C); bGPdata *gpd = (bGPdata *)ob->data; @@ -642,8 +642,8 @@ void GPENCIL_OT_stroke_merge_material(wmOperatorType *ot) ot->description = "Replace materials in strokes merging similar"; /* api callbacks */ - ot->exec = gp_stroke_merge_material_exec; - ot->poll = gp_stroke_merge_material_poll; + ot->exec = gpencil_stroke_merge_material_exec; + ot->poll = gpencil_stroke_merge_material_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; diff --git a/source/blender/editors/gpencil/gpencil_mesh.c b/source/blender/editors/gpencil/gpencil_mesh.c index 03b6252e9ba..763f5687edf 100644 --- a/source/blender/editors/gpencil/gpencil_mesh.c +++ b/source/blender/editors/gpencil/gpencil_mesh.c @@ -57,9 +57,9 @@ #include "gpencil_intern.h" /* Check frame_end is always > start frame! */ -static void gp_bake_set_frame_end(struct Main *UNUSED(main), - struct Scene *UNUSED(scene), - struct PointerRNA *ptr) +static void gpencil_bake_set_frame_end(struct Main *UNUSED(main), + struct Scene *UNUSED(scene), + struct PointerRNA *ptr) { int frame_start = RNA_int_get(ptr, "frame_start"); int frame_end = RNA_int_get(ptr, "frame_end"); @@ -70,7 +70,7 @@ static void gp_bake_set_frame_end(struct Main *UNUSED(main), } /* Extract mesh animation to Grease Pencil. */ -static bool gp_bake_mesh_animation_poll(bContext *C) +static bool gpencil_bake_mesh_animation_poll(bContext *C) { if (CTX_data_mode_enum(C) != CTX_MODE_OBJECT) { return false; @@ -86,7 +86,7 @@ typedef struct GpBakeOb { Object *ob; } GpBakeOb; -static void gp_bake_duplilist(Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *list) +static void gpencil_bake_duplilist(Depsgraph *depsgraph, Scene *scene, Object *ob, ListBase *list) { GpBakeOb *elem = NULL; ListBase *lb; @@ -104,7 +104,7 @@ static void gp_bake_duplilist(Depsgraph *depsgraph, Scene *scene, Object *ob, Li free_object_duplilist(lb); } -static void gp_bake_ob_list(bContext *C, Depsgraph *depsgraph, Scene *scene, ListBase *list) +static void gpencil_bake_ob_list(bContext *C, Depsgraph *depsgraph, Scene *scene, ListBase *list) { GpBakeOb *elem = NULL; @@ -118,7 +118,7 @@ static void gp_bake_ob_list(bContext *C, Depsgraph *depsgraph, Scene *scene, Lis } /* Add duplilist. */ else if (obact->type == OB_EMPTY) { - gp_bake_duplilist(depsgraph, scene, obact, list); + gpencil_bake_duplilist(depsgraph, scene, obact, list); } /* Add other selected objects. */ @@ -135,20 +135,20 @@ static void gp_bake_ob_list(bContext *C, Depsgraph *depsgraph, Scene *scene, Lis /* Add duplilist. */ if (ob->type == OB_EMPTY) { - gp_bake_duplilist(depsgraph, scene, obact, list); + gpencil_bake_duplilist(depsgraph, scene, obact, list); } } CTX_DATA_END; } -static void gp_bake_free_ob_list(ListBase *list) +static void gpencil_bake_free_ob_list(ListBase *list) { LISTBASE_FOREACH_MUTABLE (GpBakeOb *, elem, list) { MEM_SAFE_FREE(elem); } } -static int gp_bake_mesh_animation_exec(bContext *C, wmOperator *op) +static int gpencil_bake_mesh_animation_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); @@ -158,12 +158,12 @@ static int gp_bake_mesh_animation_exec(bContext *C, wmOperator *op) Object *ob_gpencil = NULL; ListBase list = {NULL, NULL}; - gp_bake_ob_list(C, depsgraph, scene, &list); + gpencil_bake_ob_list(C, depsgraph, scene, &list); /* Cannot check this in poll because the active object changes. */ if (list.first == NULL) { BKE_report(op->reports, RPT_INFO, "No valid object selected"); - gp_bake_free_ob_list(&list); + gpencil_bake_free_ob_list(&list); return OPERATOR_CANCELLED; } @@ -202,7 +202,7 @@ static int gp_bake_mesh_animation_exec(bContext *C, wmOperator *op) if ((ob_gpencil == NULL) || (ob_gpencil->type != OB_GPENCIL)) { BKE_report(op->reports, RPT_ERROR, "Target grease pencil object not valid"); - gp_bake_free_ob_list(&list); + gpencil_bake_free_ob_list(&list); return OPERATOR_CANCELLED; } @@ -310,7 +310,7 @@ static int gp_bake_mesh_animation_exec(bContext *C, wmOperator *op) } /* Free memory. */ - gp_bake_free_ob_list(&list); + gpencil_bake_free_ob_list(&list); if (sctx != NULL) { ED_transform_snap_object_context_destroy(sctx); } @@ -359,8 +359,8 @@ void GPENCIL_OT_bake_mesh_animation(wmOperatorType *ot) ot->description = "Bake Mesh Animation to Grease Pencil strokes"; /* callbacks */ - ot->exec = gp_bake_mesh_animation_exec; - ot->poll = gp_bake_mesh_animation_poll; + ot->exec = gpencil_bake_mesh_animation_exec; + ot->poll = gpencil_bake_mesh_animation_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -371,7 +371,7 @@ void GPENCIL_OT_bake_mesh_animation(wmOperatorType *ot) prop = RNA_def_int( ot->srna, "frame_end", 250, 1, 100000, "End Frame", "The end frame of animation", 1, 100000); - RNA_def_property_update_runtime(prop, gp_bake_set_frame_end); + RNA_def_property_update_runtime(prop, gpencil_bake_set_frame_end); prop = RNA_def_int(ot->srna, "step", 1, 1, 100, "Step", "Step between generated frames", 1, 100); diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c index 7b92426efd4..e645668ef1c 100644 --- a/source/blender/editors/gpencil/gpencil_ops.c +++ b/source/blender/editors/gpencil/gpencil_ops.c @@ -63,21 +63,21 @@ static void ed_keymap_gpencil_general(wmKeyConfig *keyconf) /* ==================== */ /* Poll callback for stroke editing mode */ -static bool gp_stroke_editmode_poll(bContext *C) +static bool gpencil_stroke_editmode_poll(bContext *C) { bGPdata *gpd = CTX_data_gpencil_data(C); return (gpd && (gpd->flag & GP_DATA_STROKE_EDITMODE)); } /* Poll callback for stroke painting mode */ -static bool gp_stroke_paintmode_poll(bContext *C) +static bool gpencil_stroke_paintmode_poll(bContext *C) { /* TODO: limit this to mode, but review 2D editors */ bGPdata *gpd = CTX_data_gpencil_data(C); return (gpd && (gpd->flag & GP_DATA_STROKE_PAINTMODE)); } -static bool gp_stroke_paintmode_poll_with_tool(bContext *C, const char gpencil_tool) +static bool gpencil_stroke_paintmode_poll_with_tool(bContext *C, const char gpencil_tool) { /* TODO: limit this to mode, but review 2D editors */ bGPdata *gpd = CTX_data_gpencil_data(C); @@ -95,7 +95,7 @@ static bool gp_stroke_paintmode_poll_with_tool(bContext *C, const char gpencil_t WM_toolsystem_active_tool_is_brush(C) && (brush->gpencil_tool == gpencil_tool)); } -static bool gp_stroke_vertexmode_poll_with_tool(bContext *C, const char gpencil_vertex_tool) +static bool gpencil_stroke_vertexmode_poll_with_tool(bContext *C, const char gpencil_vertex_tool) { bGPdata *gpd = CTX_data_gpencil_data(C); if (!gpd) { @@ -113,7 +113,7 @@ static bool gp_stroke_vertexmode_poll_with_tool(bContext *C, const char gpencil_ (brush->gpencil_vertex_tool == gpencil_vertex_tool)); } -static bool gp_stroke_sculptmode_poll_with_tool(bContext *C, const char gpencil_sculpt_tool) +static bool gpencil_stroke_sculptmode_poll_with_tool(bContext *C, const char gpencil_sculpt_tool) { bGPdata *gpd = CTX_data_gpencil_data(C); if (!gpd) { @@ -131,7 +131,7 @@ static bool gp_stroke_sculptmode_poll_with_tool(bContext *C, const char gpencil_ (brush->gpencil_sculpt_tool == gpencil_sculpt_tool)); } -static bool gp_stroke_weightmode_poll_with_tool(bContext *C, const char gpencil_weight_tool) +static bool gpencil_stroke_weightmode_poll_with_tool(bContext *C, const char gpencil_weight_tool) { bGPdata *gpd = CTX_data_gpencil_data(C); if (!gpd) { @@ -150,31 +150,31 @@ static bool gp_stroke_weightmode_poll_with_tool(bContext *C, const char gpencil_ } /* Poll callback for stroke painting (draw brush) */ -static bool gp_stroke_paintmode_draw_poll(bContext *C) +static bool gpencil_stroke_paintmode_draw_poll(bContext *C) { - return gp_stroke_paintmode_poll_with_tool(C, GPAINT_TOOL_DRAW); + return gpencil_stroke_paintmode_poll_with_tool(C, GPAINT_TOOL_DRAW); } /* Poll callback for stroke painting (erase brush) */ -static bool gp_stroke_paintmode_erase_poll(bContext *C) +static bool gpencil_stroke_paintmode_erase_poll(bContext *C) { - return gp_stroke_paintmode_poll_with_tool(C, GPAINT_TOOL_ERASE); + return gpencil_stroke_paintmode_poll_with_tool(C, GPAINT_TOOL_ERASE); } /* Poll callback for stroke painting (fill) */ -static bool gp_stroke_paintmode_fill_poll(bContext *C) +static bool gpencil_stroke_paintmode_fill_poll(bContext *C) { - return gp_stroke_paintmode_poll_with_tool(C, GPAINT_TOOL_FILL); + return gpencil_stroke_paintmode_poll_with_tool(C, GPAINT_TOOL_FILL); } /* Poll callback for stroke painting (tint) */ -static bool gp_stroke_paintmode_tint_poll(bContext *C) +static bool gpencil_stroke_paintmode_tint_poll(bContext *C) { - return gp_stroke_paintmode_poll_with_tool(C, GPAINT_TOOL_TINT); + return gpencil_stroke_paintmode_poll_with_tool(C, GPAINT_TOOL_TINT); } /* Poll callback for stroke sculpting mode */ -static bool gp_stroke_sculptmode_poll(bContext *C) +static bool gpencil_stroke_sculptmode_poll(bContext *C) { bGPdata *gpd = CTX_data_gpencil_data(C); Object *ob = CTX_data_active_object(C); @@ -194,7 +194,7 @@ static bool gp_stroke_sculptmode_poll(bContext *C) } /* Poll callback for stroke weight paint mode */ -static bool gp_stroke_weightmode_poll(bContext *C) +static bool gpencil_stroke_weightmode_poll(bContext *C) { bGPdata *gpd = CTX_data_gpencil_data(C); Object *ob = CTX_data_active_object(C); @@ -207,7 +207,7 @@ static bool gp_stroke_weightmode_poll(bContext *C) } /* Poll callback for stroke vertex paint mode */ -static bool gp_stroke_vertexmode_poll(bContext *C) +static bool gpencil_stroke_vertexmode_poll(bContext *C) { bGPdata *gpd = CTX_data_gpencil_data(C); Object *ob = CTX_data_active_object(C); @@ -220,91 +220,91 @@ static bool gp_stroke_vertexmode_poll(bContext *C) } /* Poll callback for vertex painting (draw) */ -static bool gp_stroke_vertexmode_draw_poll(bContext *C) +static bool gpencil_stroke_vertexmode_draw_poll(bContext *C) { - return gp_stroke_vertexmode_poll_with_tool(C, GPVERTEX_TOOL_DRAW); + return gpencil_stroke_vertexmode_poll_with_tool(C, GPVERTEX_TOOL_DRAW); } /* Poll callback for vertex painting (blur) */ -static bool gp_stroke_vertexmode_blur_poll(bContext *C) +static bool gpencil_stroke_vertexmode_blur_poll(bContext *C) { - return gp_stroke_vertexmode_poll_with_tool(C, GPVERTEX_TOOL_BLUR); + return gpencil_stroke_vertexmode_poll_with_tool(C, GPVERTEX_TOOL_BLUR); } /* Poll callback for vertex painting (average) */ -static bool gp_stroke_vertexmode_average_poll(bContext *C) +static bool gpencil_stroke_vertexmode_average_poll(bContext *C) { - return gp_stroke_vertexmode_poll_with_tool(C, GPVERTEX_TOOL_AVERAGE); + return gpencil_stroke_vertexmode_poll_with_tool(C, GPVERTEX_TOOL_AVERAGE); } /* Poll callback for vertex painting (smear) */ -static bool gp_stroke_vertexmode_smear_poll(bContext *C) +static bool gpencil_stroke_vertexmode_smear_poll(bContext *C) { - return gp_stroke_vertexmode_poll_with_tool(C, GPVERTEX_TOOL_SMEAR); + return gpencil_stroke_vertexmode_poll_with_tool(C, GPVERTEX_TOOL_SMEAR); } /* Poll callback for vertex painting (replace) */ -static bool gp_stroke_vertexmode_replace_poll(bContext *C) +static bool gpencil_stroke_vertexmode_replace_poll(bContext *C) { - return gp_stroke_vertexmode_poll_with_tool(C, GPVERTEX_TOOL_REPLACE); + return gpencil_stroke_vertexmode_poll_with_tool(C, GPVERTEX_TOOL_REPLACE); } /* Poll callback for sculpt (Smooth) */ -static bool gp_stroke_sculptmode_smooth_poll(bContext *C) +static bool gpencil_stroke_sculptmode_smooth_poll(bContext *C) { - return gp_stroke_sculptmode_poll_with_tool(C, GPSCULPT_TOOL_SMOOTH); + return gpencil_stroke_sculptmode_poll_with_tool(C, GPSCULPT_TOOL_SMOOTH); } /* Poll callback for sculpt (Thickness) */ -static bool gp_stroke_sculptmode_thickness_poll(bContext *C) +static bool gpencil_stroke_sculptmode_thickness_poll(bContext *C) { - return gp_stroke_sculptmode_poll_with_tool(C, GPSCULPT_TOOL_THICKNESS); + return gpencil_stroke_sculptmode_poll_with_tool(C, GPSCULPT_TOOL_THICKNESS); } /* Poll callback for sculpt (Strength) */ -static bool gp_stroke_sculptmode_strength_poll(bContext *C) +static bool gpencil_stroke_sculptmode_strength_poll(bContext *C) { - return gp_stroke_sculptmode_poll_with_tool(C, GPSCULPT_TOOL_STRENGTH); + return gpencil_stroke_sculptmode_poll_with_tool(C, GPSCULPT_TOOL_STRENGTH); } /* Poll callback for sculpt (Grab) */ -static bool gp_stroke_sculptmode_grab_poll(bContext *C) +static bool gpencil_stroke_sculptmode_grab_poll(bContext *C) { - return gp_stroke_sculptmode_poll_with_tool(C, GPSCULPT_TOOL_GRAB); + return gpencil_stroke_sculptmode_poll_with_tool(C, GPSCULPT_TOOL_GRAB); } /* Poll callback for sculpt (Push) */ -static bool gp_stroke_sculptmode_push_poll(bContext *C) +static bool gpencil_stroke_sculptmode_push_poll(bContext *C) { - return gp_stroke_sculptmode_poll_with_tool(C, GPSCULPT_TOOL_PUSH); + return gpencil_stroke_sculptmode_poll_with_tool(C, GPSCULPT_TOOL_PUSH); } /* Poll callback for sculpt (Twist) */ -static bool gp_stroke_sculptmode_twist_poll(bContext *C) +static bool gpencil_stroke_sculptmode_twist_poll(bContext *C) { - return gp_stroke_sculptmode_poll_with_tool(C, GPSCULPT_TOOL_TWIST); + return gpencil_stroke_sculptmode_poll_with_tool(C, GPSCULPT_TOOL_TWIST); } /* Poll callback for sculpt (Pinch) */ -static bool gp_stroke_sculptmode_pinch_poll(bContext *C) +static bool gpencil_stroke_sculptmode_pinch_poll(bContext *C) { - return gp_stroke_sculptmode_poll_with_tool(C, GPSCULPT_TOOL_PINCH); + return gpencil_stroke_sculptmode_poll_with_tool(C, GPSCULPT_TOOL_PINCH); } /* Poll callback for sculpt (Randomize) */ -static bool gp_stroke_sculptmode_randomize_poll(bContext *C) +static bool gpencil_stroke_sculptmode_randomize_poll(bContext *C) { - return gp_stroke_sculptmode_poll_with_tool(C, GPSCULPT_TOOL_RANDOMIZE); + return gpencil_stroke_sculptmode_poll_with_tool(C, GPSCULPT_TOOL_RANDOMIZE); } /* Poll callback for sculpt (Clone) */ -static bool gp_stroke_sculptmode_clone_poll(bContext *C) +static bool gpencil_stroke_sculptmode_clone_poll(bContext *C) { - return gp_stroke_sculptmode_poll_with_tool(C, GPSCULPT_TOOL_CLONE); + return gpencil_stroke_sculptmode_poll_with_tool(C, GPSCULPT_TOOL_CLONE); } /* Poll callback for weight paint (Draw) */ -static bool gp_stroke_weightmode_draw_poll(bContext *C) +static bool gpencil_stroke_weightmode_draw_poll(bContext *C) { - return gp_stroke_weightmode_poll_with_tool(C, GPWEIGHT_TOOL_DRAW); + return gpencil_stroke_weightmode_poll_with_tool(C, GPWEIGHT_TOOL_DRAW); } /* Stroke Editing Keymap - Only when editmode is enabled */ @@ -313,35 +313,35 @@ static void ed_keymap_gpencil_editing(wmKeyConfig *keyconf) wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Edit Mode", 0, 0); /* set poll callback - so that this keymap only gets enabled when stroke editmode is enabled */ - keymap->poll = gp_stroke_editmode_poll; + keymap->poll = gpencil_stroke_editmode_poll; } /* keys for draw with a drawing brush (no fill) */ static void ed_keymap_gpencil_painting_draw(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Paint (Draw brush)", 0, 0); - keymap->poll = gp_stroke_paintmode_draw_poll; + keymap->poll = gpencil_stroke_paintmode_draw_poll; } /* keys for draw with a eraser brush (erase) */ static void ed_keymap_gpencil_painting_erase(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Paint (Erase)", 0, 0); - keymap->poll = gp_stroke_paintmode_erase_poll; + keymap->poll = gpencil_stroke_paintmode_erase_poll; } /* keys for draw with a fill brush */ static void ed_keymap_gpencil_painting_fill(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Paint (Fill)", 0, 0); - keymap->poll = gp_stroke_paintmode_fill_poll; + keymap->poll = gpencil_stroke_paintmode_fill_poll; } /* keys for draw with a tint brush */ static void ed_keymap_gpencil_painting_tint(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Paint (Tint)", 0, 0); - keymap->poll = gp_stroke_paintmode_tint_poll; + keymap->poll = gpencil_stroke_paintmode_tint_poll; } /* Stroke Painting Keymap - Only when paintmode is enabled */ @@ -349,7 +349,7 @@ static void ed_keymap_gpencil_painting(wmKeyConfig *keyconf) { /* set poll callback - so that this keymap only gets enabled when stroke paintmode is enabled */ wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Paint Mode", 0, 0); - keymap->poll = gp_stroke_paintmode_poll; + keymap->poll = gpencil_stroke_paintmode_poll; } /* Stroke Sculpting Keymap - Only when sculptmode is enabled */ @@ -357,7 +357,7 @@ static void ed_keymap_gpencil_sculpting(wmKeyConfig *keyconf) { /* set poll callback - so that this keymap only gets enabled when stroke sculptmode is enabled */ wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Sculpt Mode", 0, 0); - keymap->poll = gp_stroke_sculptmode_poll; + keymap->poll = gpencil_stroke_sculptmode_poll; } /* Stroke Weight Paint Keymap - Only when weight is enabled */ @@ -365,106 +365,106 @@ static void ed_keymap_gpencil_weightpainting(wmKeyConfig *keyconf) { /* set poll callback - so that this keymap only gets enabled when stroke sculptmode is enabled */ wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Weight Mode", 0, 0); - keymap->poll = gp_stroke_weightmode_poll; + keymap->poll = gpencil_stroke_weightmode_poll; } static void ed_keymap_gpencil_vertexpainting(wmKeyConfig *keyconf) { /* set poll callback - so that this keymap only gets enabled when stroke vertex is enabled */ wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Vertex Mode", 0, 0); - keymap->poll = gp_stroke_vertexmode_poll; + keymap->poll = gpencil_stroke_vertexmode_poll; } /* keys for vertex with a draw brush */ static void ed_keymap_gpencil_vertexpainting_draw(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Vertex (Draw)", 0, 0); - keymap->poll = gp_stroke_vertexmode_draw_poll; + keymap->poll = gpencil_stroke_vertexmode_draw_poll; } /* keys for vertex with a blur brush */ static void ed_keymap_gpencil_vertexpainting_blur(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Vertex (Blur)", 0, 0); - keymap->poll = gp_stroke_vertexmode_blur_poll; + keymap->poll = gpencil_stroke_vertexmode_blur_poll; } /* keys for vertex with a average brush */ static void ed_keymap_gpencil_vertexpainting_average(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Vertex (Average)", 0, 0); - keymap->poll = gp_stroke_vertexmode_average_poll; + keymap->poll = gpencil_stroke_vertexmode_average_poll; } /* keys for vertex with a smear brush */ static void ed_keymap_gpencil_vertexpainting_smear(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Vertex (Smear)", 0, 0); - keymap->poll = gp_stroke_vertexmode_smear_poll; + keymap->poll = gpencil_stroke_vertexmode_smear_poll; } /* keys for vertex with a replace brush */ static void ed_keymap_gpencil_vertexpainting_replace(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Vertex (Replace)", 0, 0); - keymap->poll = gp_stroke_vertexmode_replace_poll; + keymap->poll = gpencil_stroke_vertexmode_replace_poll; } /* keys for sculpt with a smooth brush */ static void ed_keymap_gpencil_sculptpainting_smooth(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Sculpt (Smooth)", 0, 0); - keymap->poll = gp_stroke_sculptmode_smooth_poll; + keymap->poll = gpencil_stroke_sculptmode_smooth_poll; } /* keys for sculpt with a thickness brush */ static void ed_keymap_gpencil_sculptpainting_thickness(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Sculpt (Thickness)", 0, 0); - keymap->poll = gp_stroke_sculptmode_thickness_poll; + keymap->poll = gpencil_stroke_sculptmode_thickness_poll; } /* keys for sculpt with a strength brush */ static void ed_keymap_gpencil_sculptpainting_strength(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Sculpt (Strength)", 0, 0); - keymap->poll = gp_stroke_sculptmode_strength_poll; + keymap->poll = gpencil_stroke_sculptmode_strength_poll; } /* keys for sculpt with a grab brush */ static void ed_keymap_gpencil_sculptpainting_grab(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Sculpt (Grab)", 0, 0); - keymap->poll = gp_stroke_sculptmode_grab_poll; + keymap->poll = gpencil_stroke_sculptmode_grab_poll; } /* keys for sculpt with a push brush */ static void ed_keymap_gpencil_sculptpainting_push(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Sculpt (Push)", 0, 0); - keymap->poll = gp_stroke_sculptmode_push_poll; + keymap->poll = gpencil_stroke_sculptmode_push_poll; } /* keys for sculpt with a twist brush */ static void ed_keymap_gpencil_sculptpainting_twist(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Sculpt (Twist)", 0, 0); - keymap->poll = gp_stroke_sculptmode_twist_poll; + keymap->poll = gpencil_stroke_sculptmode_twist_poll; } /* keys for sculpt with a pinch brush */ static void ed_keymap_gpencil_sculptpainting_pinch(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Sculpt (Pinch)", 0, 0); - keymap->poll = gp_stroke_sculptmode_pinch_poll; + keymap->poll = gpencil_stroke_sculptmode_pinch_poll; } /* keys for sculpt with a randomize brush */ static void ed_keymap_gpencil_sculptpainting_randomize(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Sculpt (Randomize)", 0, 0); - keymap->poll = gp_stroke_sculptmode_randomize_poll; + keymap->poll = gpencil_stroke_sculptmode_randomize_poll; } /* keys for sculpt with a clone brush */ static void ed_keymap_gpencil_sculptpainting_clone(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Sculpt (Clone)", 0, 0); - keymap->poll = gp_stroke_sculptmode_clone_poll; + keymap->poll = gpencil_stroke_sculptmode_clone_poll; } /* keys for weight with a draw brush */ static void ed_keymap_gpencil_weightpainting_draw(wmKeyConfig *keyconf) { wmKeyMap *keymap = WM_keymap_ensure(keyconf, "Grease Pencil Stroke Weight (Draw)", 0, 0); - keymap->poll = gp_stroke_weightmode_draw_poll; + keymap->poll = gpencil_stroke_weightmode_draw_poll; } /* ==================== */ diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index a1961ea1630..9af8d463304 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -272,7 +272,7 @@ typedef struct tGPsdata { /* minimum length of new segment before new point can be added */ #define MIN_EUCLIDEAN_PX (U.gp_euclideandist) -static void gp_update_cache(bGPdata *gpd) +static void gpencil_update_cache(bGPdata *gpd) { if (gpd) { DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); @@ -280,19 +280,19 @@ static void gp_update_cache(bGPdata *gpd) } } -static void gp_stroke_added_enable(tGPsdata *p) +static void gpencil_stroke_added_enable(tGPsdata *p) { BLI_assert(p->gpf->strokes.last != NULL); p->flags |= GP_PAINTFLAG_STROKEADDED; /* drawing batch cache is dirty now */ - gp_update_cache(p->gpd); + gpencil_update_cache(p->gpd); } /* ------ */ /* Forward defines for some functions... */ -static void gp_session_validatebuffer(tGPsdata *p); +static void gpencil_session_validatebuffer(tGPsdata *p); /* ******************************************* */ /* Context Wrangling... */ @@ -352,7 +352,7 @@ static bool gpencil_project_check(tGPsdata *p) /* Utilities --------------------------------- */ /* get the reference point for stroke-point conversions */ -static void gp_get_3d_reference(tGPsdata *p, float vec[3]) +static void gpencil_get_3d_reference(tGPsdata *p, float vec[3]) { Object *ob = NULL; if (p->ownerPtr.type == &RNA_Object) { @@ -363,7 +363,7 @@ static void gp_get_3d_reference(tGPsdata *p, float vec[3]) /* Stroke Editing ---------------------------- */ /* check if the current mouse position is suitable for adding a new point */ -static bool gp_stroke_filtermval(tGPsdata *p, const float mval[2], float mvalo[2]) +static bool gpencil_stroke_filtermval(tGPsdata *p, const float mval[2], float mvalo[2]) { Brush *brush = p->brush; int dx = (int)fabsf(mval[0] - mvalo[0]); @@ -410,7 +410,7 @@ static bool gp_stroke_filtermval(tGPsdata *p, const float mval[2], float mvalo[2 } /* reproject stroke to plane locked to axis in 3d cursor location */ -static void gp_reproject_toplane(tGPsdata *p, bGPDstroke *gps) +static void gpencil_reproject_toplane(tGPsdata *p, bGPDstroke *gps) { bGPdata *gpd = p->gpd; Object *obact = (Object *)p->ownerPtr.data; @@ -430,13 +430,15 @@ static void gp_reproject_toplane(tGPsdata *p, bGPDstroke *gps) } /* get drawing origin */ - gp_get_3d_reference(p, origin); + gpencil_get_3d_reference(p, origin); ED_gp_project_stroke_to_plane(p->scene, obact, rv3d, gps, origin, p->lock_axis - 1); } /* convert screen-coordinates to buffer-coordinates */ -/* XXX this method needs a total overhaul! */ -static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[3], float *depth) +static void gpencil_stroke_convertcoords(tGPsdata *p, + const float mval[2], + float out[3], + float *depth) { bGPdata *gpd = p->gpd; @@ -476,7 +478,7 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[ * 3D-coordinates using the 3D-cursor as reference. In general, this * works OK, but it could of course be improved. */ - gp_get_3d_reference(p, rvec); + gpencil_get_3d_reference(p, rvec); zfac = ED_view3d_calc_zfac(p->region->regiondata, rvec, NULL); if (ED_view3d_project_float_global(p->region, rvec, mval_prj, V3D_PROJ_TEST_NOP) == @@ -492,7 +494,7 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[ } /* Apply jitter to stroke point. */ -static void gp_brush_jitter(bGPdata *gpd, tGPspoint *pt, const float amplitude) +static void gpencil_brush_jitter(bGPdata *gpd, tGPspoint *pt, const float amplitude) { const float axis[2] = {0.0f, 1.0f}; /* Jitter is applied perpendicular to the mouse movement vector (2D space). */ @@ -513,8 +515,8 @@ static void gp_brush_jitter(bGPdata *gpd, tGPspoint *pt, const float amplitude) } } -/* apply pressure change depending of the angle of the stroke to simulate a pen with shape */ -static void gp_brush_angle(bGPdata *gpd, Brush *brush, tGPspoint *pt, const float mval[2]) +/* Apply pressure change depending of the angle of the stroke to simulate a pen with shape */ +static void gpencil_brush_angle(bGPdata *gpd, Brush *brush, tGPspoint *pt, const float mval[2]) { float mvec[2]; float sen = brush->gpencil_settings->draw_angle_factor; /* sensitivity */ @@ -561,7 +563,7 @@ static void gp_brush_angle(bGPdata *gpd, Brush *brush, tGPspoint *pt, const floa * \param inf: Influence factor * \param idx: Index of the last point (need minimum 3 points in the array) */ -static void gp_smooth_buffer(tGPsdata *p, float inf, int idx) +static void gpencil_smooth_buffer(tGPsdata *p, float inf, int idx) { bGPdata *gpd = p->gpd; GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide; @@ -625,7 +627,7 @@ static void gp_smooth_buffer(tGPsdata *p, float inf, int idx) } /* Helper: Apply smooth to segment from Index to Index */ -static void gp_smooth_segment(bGPdata *gpd, const float inf, int from_idx, int to_idx) +static void gpencil_smooth_segment(bGPdata *gpd, const float inf, int from_idx, int to_idx) { const short num_points = to_idx - from_idx; /* Do nothing if not enough points to smooth out */ @@ -692,12 +694,12 @@ static void gp_smooth_segment(bGPdata *gpd, const float inf, int from_idx, int t } } -static void gp_apply_randomness(tGPsdata *p, - BrushGpencilSettings *brush_settings, - tGPspoint *pt, - const bool press, - const bool strength, - const bool uv) +static void gpencil_apply_randomness(tGPsdata *p, + BrushGpencilSettings *brush_settings, + tGPspoint *pt, + const bool press, + const bool strength, + const bool uv) { bGPdata *gpd = p->gpd; GpRandomSettings random_settings = p->random_settings; @@ -765,7 +767,10 @@ static void gp_apply_randomness(tGPsdata *p, } /* add current stroke-point to buffer (returns whether point was successfully added) */ -static short gp_stroke_addpoint(tGPsdata *p, const float mval[2], float pressure, double curtime) +static short gpencil_stroke_addpoint(tGPsdata *p, + const float mval[2], + float pressure, + double curtime) { bGPdata *gpd = p->gpd; Brush *brush = p->brush; @@ -861,16 +866,16 @@ static short gp_stroke_addpoint(tGPsdata *p, const float mval[2], float pressure /* FIXME the +2 means minimum jitter is 4 which is a bit strange for UX. */ const float exp_factor = brush_settings->draw_jitter + 2.0f; const float fac = rand * square_f(exp_factor) * jitpress; - gp_brush_jitter(gpd, pt, fac); + gpencil_brush_jitter(gpd, pt, fac); } /* Apply other randomness. */ - gp_apply_randomness(p, brush_settings, pt, true, true, true); + gpencil_apply_randomness(p, brush_settings, pt, true, true, true); } /* apply angle of stroke to brush size */ if (brush_settings->draw_angle_factor != 0.0f) { - gp_brush_angle(gpd, brush, pt, mval); + gpencil_brush_angle(gpd, brush, pt, mval); } /* point time */ @@ -883,7 +888,7 @@ static short gp_stroke_addpoint(tGPsdata *p, const float mval[2], float pressure /* get origin to reproject point */ float origin[3]; - gp_get_3d_reference(p, origin); + gpencil_get_3d_reference(p, origin); /* reproject current */ ED_gpencil_tpoint_to_point(p->region, origin, pt, &spt); ED_gp_project_point_to_plane(p->scene, obact, rv3d, origin, p->lock_axis - 1, &spt); @@ -905,9 +910,9 @@ static short gp_stroke_addpoint(tGPsdata *p, const float mval[2], float pressure /* Smooth while drawing previous points with a reduction factor for previous. */ if (brush->gpencil_settings->active_smooth > 0.0f) { for (int s = 0; s < 3; s++) { - gp_smooth_buffer(p, - brush->gpencil_settings->active_smooth * ((3.0f - s) / 3.0f), - gpd->runtime.sbuffer_used - s); + gpencil_smooth_buffer(p, + brush->gpencil_settings->active_smooth * ((3.0f - s) / 3.0f), + gpd->runtime.sbuffer_used - s); } } @@ -921,7 +926,7 @@ static short gp_stroke_addpoint(tGPsdata *p, const float mval[2], float pressure } /* make a new stroke from the buffer data */ -static void gp_stroke_newfrombuffer(tGPsdata *p) +static void gpencil_stroke_newfrombuffer(tGPsdata *p) { bGPdata *gpd = p->gpd; bGPDlayer *gpl = p->gpl; @@ -1001,7 +1006,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) gps->dvert = NULL; /* drawing batch cache is dirty now */ - gp_update_cache(p->gpd); + gpencil_update_cache(p->gpd); /* set pointer to first non-initialized point */ pt = gps->points + (gps->totpoints - totelem); if (gps->dvert != NULL) { @@ -1019,7 +1024,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) ptc = gpd->runtime.sbuffer; /* convert screen-coordinates to appropriate coordinates (and store them) */ - gp_stroke_convertcoords(p, &ptc->x, &pt->x, NULL); + gpencil_stroke_convertcoords(p, &ptc->x, &pt->x, NULL); /* copy pressure and time */ pt->pressure = ptc->pressure; pt->strength = ptc->strength; @@ -1053,7 +1058,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) ptc = ((tGPspoint *)gpd->runtime.sbuffer) + (gpd->runtime.sbuffer_used - 1); /* convert screen-coordinates to appropriate coordinates (and store them) */ - gp_stroke_convertcoords(p, &ptc->x, &pt->x, NULL); + gpencil_stroke_convertcoords(p, &ptc->x, &pt->x, NULL); /* copy pressure and time */ pt->pressure = ptc->pressure; pt->strength = ptc->strength; @@ -1078,7 +1083,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) } /* reproject to plane (only in 3d space) */ - gp_reproject_toplane(p, gps); + gpencil_reproject_toplane(p, gps); pt = gps->points; for (i = 0; i < gps->totpoints; i++, pt++) { /* if parented change position relative to parent object */ @@ -1173,7 +1178,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) for (i = 0, ptc = gpd->runtime.sbuffer; i < gpd->runtime.sbuffer_used && ptc; i++, ptc++, pt++) { /* convert screen-coordinates to appropriate coordinates (and store them) */ - gp_stroke_convertcoords(p, &ptc->x, &pt->x, depth_arr ? depth_arr + i : NULL); + gpencil_stroke_convertcoords(p, &ptc->x, &pt->x, depth_arr ? depth_arr + i : NULL); /* copy pressure and time */ pt->pressure = ptc->pressure; @@ -1230,7 +1235,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) } /* reproject to plane (only in 3d space) */ - gp_reproject_toplane(p, gps); + gpencil_reproject_toplane(p, gps); /* change position relative to parent object */ gpencil_apply_parent(depsgraph, obact, gpl, gps); /* if camera view, reproject flat to view to avoid perspective effect */ @@ -1285,7 +1290,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) /* Calc geometry data. */ BKE_gpencil_stroke_geometry_update(gps); - gp_stroke_added_enable(p); + gpencil_stroke_added_enable(p); } /* --- 'Eraser' for 'Paint' Tool ------ */ @@ -1302,10 +1307,10 @@ static float view3d_point_depth(const RegionView3D *rv3d, const float co[3]) } /* only erase stroke points that are visible */ -static bool gp_stroke_eraser_is_occluded(tGPsdata *p, - const bGPDspoint *pt, - const int x, - const int y) +static bool gpencil_stroke_eraser_is_occluded(tGPsdata *p, + const bGPDspoint *pt, + const int x, + const int y) { Object *obact = (Object *)p->ownerPtr.data; Brush *brush = p->brush; @@ -1347,10 +1352,10 @@ static bool gp_stroke_eraser_is_occluded(tGPsdata *p, } /* apply a falloff effect to brush strength, based on distance */ -static float gp_stroke_eraser_calc_influence(tGPsdata *p, - const float mval[2], - const int radius, - const int co[2]) +static float gpencil_stroke_eraser_calc_influence(tGPsdata *p, + const float mval[2], + const int radius, + const int co[2]) { Brush *brush = p->brush; /* Linear Falloff... */ @@ -1374,7 +1379,7 @@ static float gp_stroke_eraser_calc_influence(tGPsdata *p, } /* helper to free a stroke */ -static void gp_free_stroke(bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps) +static void gpencil_free_stroke(bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps) { if (gps->points) { MEM_freeN(gps->points); @@ -1389,7 +1394,7 @@ static void gp_free_stroke(bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps) MEM_freeN(gps->triangles); } BLI_freelinkN(&gpf->strokes, gps); - gp_update_cache(gpd); + gpencil_update_cache(gpd); } /** @@ -1397,7 +1402,7 @@ static void gp_free_stroke(bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps) * to avoid that segments gets the end points rounded. * The round caps breaks the artistic effect. */ -static void gp_stroke_soft_refine(bGPDstroke *gps) +static void gpencil_stroke_soft_refine(bGPDstroke *gps) { bGPDspoint *pt = NULL; bGPDspoint *pt2 = NULL; @@ -1432,12 +1437,12 @@ static void gp_stroke_soft_refine(bGPDstroke *gps) } /* eraser tool - evaluation per stroke */ -static void gp_stroke_eraser_dostroke(tGPsdata *p, - bGPDframe *gpf, - bGPDstroke *gps, - const float mval[2], - const int radius, - const rcti *rect) +static void gpencil_stroke_eraser_dostroke(tGPsdata *p, + bGPDframe *gpf, + bGPDstroke *gps, + const float mval[2], + const int radius, + const rcti *rect) { Brush *eraser = p->eraser; bGPDspoint *pt0, *pt1, *pt2; @@ -1450,7 +1455,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, if (gps->totpoints == 0) { /* just free stroke */ - gp_free_stroke(p->gpd, gpf, gps); + gpencil_free_stroke(p->gpd, gpf, gps); } else if (gps->totpoints == 1) { /* only process if it hasn't been masked out... */ @@ -1463,7 +1468,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, /* only check if point is inside */ if (len_v2v2_int(mval_i, pc1) <= radius) { /* free stroke */ - gp_free_stroke(p->gpd, gpf, gps); + gpencil_free_stroke(p->gpd, gpf, gps); } } } @@ -1488,7 +1493,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, /* only check if point is inside */ if (len_v2v2_int(mval_i, pc1) <= radius) { /* free stroke */ - gp_free_stroke(p->gpd, gpf, gps); + gpencil_free_stroke(p->gpd, gpf, gps); return; } } @@ -1555,9 +1560,9 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, * - this assumes that linewidth is irrelevant */ if (gpencil_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)) { + if ((gpencil_stroke_eraser_is_occluded(p, pt0, pc0[0], pc0[1]) == false) || + (gpencil_stroke_eraser_is_occluded(p, pt1, pc1[0], pc1[1]) == false) || + (gpencil_stroke_eraser_is_occluded(p, pt2, pc2[0], pc2[1]) == false)) { /* Point is affected: */ /* Adjust thickness * - Influence of eraser falls off with distance from the middle of the eraser @@ -1571,18 +1576,18 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, float influence = 0.0f; if (pt0) { - influence = gp_stroke_eraser_calc_influence(p, mval, radius, pc0); + influence = gpencil_stroke_eraser_calc_influence(p, mval, radius, pc0); pt0->strength -= influence * strength * f_strength * 0.5f; CLAMP_MIN(pt0->strength, 0.0f); pt0->pressure -= influence * strength * f_thickness * 0.5f; } - influence = gp_stroke_eraser_calc_influence(p, mval, radius, pc1); + influence = gpencil_stroke_eraser_calc_influence(p, mval, radius, pc1); pt1->strength -= influence * strength * f_strength; CLAMP_MIN(pt1->strength, 0.0f); pt1->pressure -= influence * strength * f_thickness; - influence = gp_stroke_eraser_calc_influence(p, mval, radius, pc2); + influence = gpencil_stroke_eraser_calc_influence(p, mval, radius, pc2); pt2->strength -= influence * strength * f_strength * 0.5f; CLAMP_MIN(pt2->strength, 0.0f); pt2->pressure -= influence * strength * f_thickness * 0.5f; @@ -1605,9 +1610,10 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, } } else { - pt1->pressure -= gp_stroke_eraser_calc_influence(p, mval, radius, pc1) * strength; - pt2->pressure -= gp_stroke_eraser_calc_influence(p, mval, radius, pc2) * strength * - 0.5f; + pt1->pressure -= gpencil_stroke_eraser_calc_influence(p, mval, radius, pc1) * + strength; + pt2->pressure -= gpencil_stroke_eraser_calc_influence(p, mval, radius, pc2) * + strength * 0.5f; } /* 2) Tag any point with overly low influence for removal in the next pass */ @@ -1631,17 +1637,17 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, /* if soft eraser, must analyze points to be sure the stroke ends * don't get rounded */ if (eraser->gpencil_settings->eraser_mode == GP_BRUSH_ERASER_SOFT) { - gp_stroke_soft_refine(gps); + gpencil_stroke_soft_refine(gps); } gpencil_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_TAG, false, 0); } - gp_update_cache(p->gpd); + gpencil_update_cache(p->gpd); } } /* erase strokes which fall under the eraser strokes */ -static void gp_stroke_doeraser(tGPsdata *p) +static void gpencil_stroke_doeraser(tGPsdata *p) { rcti rect; Brush *brush = p->brush; @@ -1711,7 +1717,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->area, gps)) { - gp_stroke_eraser_dostroke(p, gpf, gps, p->mval, calc_radius, &rect); + gpencil_stroke_eraser_dostroke(p, gpf, gps, p->mval, calc_radius, &rect); } } } @@ -1721,7 +1727,7 @@ static void gp_stroke_doeraser(tGPsdata *p) /* Sketching Operator */ /* clear the session buffers (call this before AND after a paint operation) */ -static void gp_session_validatebuffer(tGPsdata *p) +static void gpencil_session_validatebuffer(tGPsdata *p) { bGPdata *gpd = p->gpd; Brush *brush = p->brush; @@ -1743,7 +1749,7 @@ static void gp_session_validatebuffer(tGPsdata *p) } /* helper to get default eraser and create one if no eraser brush */ -static Brush *gp_get_default_eraser(Main *bmain, ToolSettings *ts) +static Brush *gpencil_get_default_eraser(Main *bmain, ToolSettings *ts) { Brush *brush_dft = NULL; Paint *paint = &ts->gp_paint->paint; @@ -1785,7 +1791,7 @@ static Brush *gp_get_default_eraser(Main *bmain, ToolSettings *ts) } /* helper to set default eraser and disable others */ -static void gp_set_default_eraser(Main *bmain, Brush *brush_dft) +static void gpencil_set_default_eraser(Main *bmain, Brush *brush_dft) { if (brush_dft == NULL) { return; @@ -1804,7 +1810,7 @@ static void gp_set_default_eraser(Main *bmain, Brush *brush_dft) } /* initialize a drawing brush */ -static void gp_init_drawing_brush(bContext *C, tGPsdata *p) +static void gpencil_init_drawing_brush(bContext *C, tGPsdata *p) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); @@ -1832,13 +1838,13 @@ static void gp_init_drawing_brush(bContext *C, tGPsdata *p) /* assign to temp tGPsdata */ p->brush = paint->brush; if (paint->brush->gpencil_tool != GPAINT_TOOL_ERASE) { - p->eraser = gp_get_default_eraser(p->bmain, ts); + p->eraser = gpencil_get_default_eraser(p->bmain, ts); } else { p->eraser = paint->brush; } /* set new eraser as default */ - gp_set_default_eraser(p->bmain, p->eraser); + gpencil_set_default_eraser(p->bmain, p->eraser); /* use radius of eraser */ p->radius = (short)p->eraser->size; @@ -1850,7 +1856,7 @@ static void gp_init_drawing_brush(bContext *C, tGPsdata *p) } /* initialize a paint brush and a default color if not exist */ -static void gp_init_colors(tGPsdata *p) +static void gpencil_init_colors(tGPsdata *p) { bGPdata *gpd = p->gpd; Brush *brush = p->brush; @@ -1863,7 +1869,7 @@ static void gp_init_colors(tGPsdata *p) } /* (re)init new painting data */ -static bool gp_session_initdata(bContext *C, wmOperator *op, tGPsdata *p) +static bool gpencil_session_initdata(bContext *C, wmOperator *op, tGPsdata *p) { Main *bmain = CTX_data_main(C); bGPdata **gpd_ptr = NULL; @@ -1960,15 +1966,15 @@ static bool gp_session_initdata(bContext *C, wmOperator *op, tGPsdata *p) } /* clear out buffer (stored in gp-data), in case something contaminated it */ - gp_session_validatebuffer(p); + gpencil_session_validatebuffer(p); /* set brush and create a new one if null */ - gp_init_drawing_brush(C, p); + gpencil_init_drawing_brush(C, p); /* setup active color */ /* region where paint was originated */ int totcol = p->ob->totcol; - gp_init_colors(p); + gpencil_init_colors(p); /* check whether the material was newly added */ if (totcol != p->ob->totcol) { @@ -1988,7 +1994,7 @@ static bool gp_session_initdata(bContext *C, wmOperator *op, tGPsdata *p) } /* init new painting session */ -static tGPsdata *gp_session_initpaint(bContext *C, wmOperator *op) +static tGPsdata *gpencil_session_initpaint(bContext *C, wmOperator *op) { tGPsdata *p = NULL; @@ -1998,7 +2004,7 @@ static tGPsdata *gp_session_initpaint(bContext *C, wmOperator *op) /* Try to initialize context data * WARNING: This may not always succeed (e.g. using GP in an annotation-only context) */ - if (gp_session_initdata(C, op, p) == 0) { + if (gpencil_session_initdata(C, op, p) == 0) { /* Invalid state - Exit * NOTE: It should be safe to just free the data, since failing context checks should * only happen when no data has been allocated. @@ -2017,7 +2023,7 @@ static tGPsdata *gp_session_initpaint(bContext *C, wmOperator *op) } /* cleanup after a painting session */ -static void gp_session_cleanup(tGPsdata *p) +static void gpencil_session_cleanup(tGPsdata *p) { bGPdata *gpd = (p) ? p->gpd : NULL; @@ -2039,7 +2045,7 @@ static void gp_session_cleanup(tGPsdata *p) p->inittime = 0.0; } -static void gp_session_free(tGPsdata *p) +static void gpencil_session_free(tGPsdata *p) { if (p->rng != NULL) { BLI_rng_free(p->rng); @@ -2049,7 +2055,9 @@ static void gp_session_free(tGPsdata *p) } /* init new stroke */ -static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Depsgraph *depsgraph) +static void gpencil_paint_initstroke(tGPsdata *p, + eGPencil_PaintModes paintmode, + Depsgraph *depsgraph) { Scene *scene = p->scene; ToolSettings *ts = scene->toolsettings; @@ -2210,12 +2218,12 @@ static void gp_paint_initstroke(tGPsdata *p, eGPencil_PaintModes paintmode, Deps gpd_eval->runtime.sbuffer_brush = p->gpd->runtime.sbuffer_brush; } else { - gp_update_cache(p->gpd); + gpencil_update_cache(p->gpd); } } /* finish off a stroke (clears buffer, but doesn't finish the paint operation) */ -static void gp_paint_strokeend(tGPsdata *p) +static void gpencil_paint_strokeend(tGPsdata *p) { ToolSettings *ts = p->scene->toolsettings; /* for surface sketching, need to set the right OpenGL context stuff so that @@ -2233,22 +2241,22 @@ static void gp_paint_strokeend(tGPsdata *p) /* check if doing eraser or not */ if ((p->gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) { /* transfer stroke to frame */ - gp_stroke_newfrombuffer(p); + gpencil_stroke_newfrombuffer(p); } /* clean up buffer now */ - gp_session_validatebuffer(p); + gpencil_session_validatebuffer(p); } /* finish off stroke painting operation */ -static void gp_paint_cleanup(tGPsdata *p) +static void gpencil_paint_cleanup(tGPsdata *p) { /* p->gpd==NULL happens when stroke failed to initialize, * for example when GP is hidden in current space (sergey) */ if (p->gpd) { /* finish off a stroke */ - gp_paint_strokeend(p); + gpencil_paint_strokeend(p); } /* "unlock" frame */ @@ -2358,19 +2366,19 @@ static void gpencil_draw_exit(bContext *C, wmOperator *op) else { /* drawing batch cache is dirty now */ bGPdata *gpd = CTX_data_gpencil_data(C); - gp_update_cache(gpd); + gpencil_update_cache(gpd); } /* clear undo stack */ gpencil_undo_finish(); /* cleanup */ - gp_paint_cleanup(p); - gp_session_cleanup(p); + gpencil_paint_cleanup(p); + gpencil_session_cleanup(p); ED_gpencil_toggle_brush_cursor(C, true, NULL); /* finally, free the temp data */ - gp_session_free(p); + gpencil_session_free(p); p = NULL; } @@ -2400,7 +2408,7 @@ static int gpencil_draw_init(bContext *C, wmOperator *op, const wmEvent *event) } /* check context */ - p = op->customdata = gp_session_initpaint(C, op); + p = op->customdata = gpencil_session_initpaint(C, op); if ((p == NULL) || (p->status == GP_STATUS_ERROR)) { /* something wasn't set correctly in context */ gpencil_draw_exit(C, op); @@ -2408,7 +2416,7 @@ static int gpencil_draw_init(bContext *C, wmOperator *op, const wmEvent *event) } /* init painting data */ - gp_paint_initstroke(p, paintmode, CTX_data_ensure_evaluated_depsgraph(C)); + gpencil_paint_initstroke(p, paintmode, CTX_data_ensure_evaluated_depsgraph(C)); if (p->status == GP_STATUS_ERROR) { gpencil_draw_exit(C, op); return 0; @@ -2494,10 +2502,10 @@ static void gpencil_draw_status_indicators(bContext *C, tGPsdata *p) /* ------------------------------- */ /* Helper to rotate point around origin */ -static void gp_rotate_v2_v2v2fl(float v[2], - const float p[2], - const float origin[2], - const float angle) +static void gpencil_rotate_v2_v2v2fl(float v[2], + const float p[2], + const float origin[2], + const float angle) { float pt[2]; float r[2]; @@ -2507,7 +2515,7 @@ static void gp_rotate_v2_v2v2fl(float v[2], } /* Helper to snap value to grid */ -static float gp_snap_to_grid_fl(float v, const float offset, const float spacing) +static float gpencil_snap_to_grid_fl(float v, const float offset, const float spacing) { if (spacing > 0.0f) { v -= spacing * 0.5f; @@ -2522,25 +2530,25 @@ static float gp_snap_to_grid_fl(float v, const float offset, const float spacing } /* Helper to snap value to grid */ -static void gp_snap_to_rotated_grid_fl(float v[2], - const float origin[2], - const float spacing, - const float angle) +static void gpencil_snap_to_rotated_grid_fl(float v[2], + const float origin[2], + const float spacing, + const float angle) { - gp_rotate_v2_v2v2fl(v, v, origin, -angle); - v[1] = gp_snap_to_grid_fl(v[1], origin[1], spacing); - gp_rotate_v2_v2v2fl(v, v, origin, angle); + gpencil_rotate_v2_v2v2fl(v, v, origin, -angle); + v[1] = gpencil_snap_to_grid_fl(v[1], origin[1], spacing); + gpencil_rotate_v2_v2v2fl(v, v, origin, angle); } /* get reference point - screen coords to buffer coords */ -static void gp_origin_set(wmOperator *op, const int mval[2]) +static void gpencil_origin_set(wmOperator *op, const int mval[2]) { tGPsdata *p = op->customdata; GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide; float origin[2]; float point[3]; copy_v2fl_v2i(origin, mval); - gp_stroke_convertcoords(p, origin, point, NULL); + gpencil_stroke_convertcoords(p, origin, point, NULL); if (guide->reference_point == GP_GUIDE_REF_CUSTOM) { copy_v3_v3(guide->location, point); } @@ -2550,7 +2558,7 @@ static void gp_origin_set(wmOperator *op, const int mval[2]) } /* get reference point - buffer coords to screen coords */ -static void gp_origin_get(tGPsdata *p, float origin[2]) +static void gpencil_origin_get(tGPsdata *p, float origin[2]) { GP_Sculpt_Guide *guide = &p->scene->toolsettings->gp_sculpt.guide; float location[3]; @@ -2575,7 +2583,7 @@ static void gpencil_speed_guide_init(tGPsdata *p, GP_Sculpt_Guide *guide) float scale = 1.0f; if (rv3d->is_persp) { float vec[3]; - gp_get_3d_reference(p, vec); + gpencil_get_3d_reference(p, vec); mul_m4_v3(rv3d->persmat, vec); scale = vec[2] * rv3d->pixsize; } @@ -2584,7 +2592,7 @@ static void gpencil_speed_guide_init(tGPsdata *p, GP_Sculpt_Guide *guide) } p->guide.spacing = guide->spacing / scale; p->guide.half_spacing = p->guide.spacing * 0.5f; - gp_origin_get(p, p->guide.origin); + gpencil_origin_get(p, p->guide.origin); /* reference for angled snap */ copy_v2_v2(p->guide.unit, p->mvali); @@ -2596,7 +2604,7 @@ static void gpencil_speed_guide_init(tGPsdata *p, GP_Sculpt_Guide *guide) p->guide.origin_distance = len_v2v2(p->mvali, p->guide.origin); if (guide->use_snapping && (guide->spacing > 0.0f)) { - p->guide.origin_distance = gp_snap_to_grid_fl( + p->guide.origin_distance = gpencil_snap_to_grid_fl( p->guide.origin_distance, 0.0f, p->guide.spacing); } @@ -2606,10 +2614,10 @@ static void gpencil_speed_guide_init(tGPsdata *p, GP_Sculpt_Guide *guide) angle = p->guide.origin_angle + guide->angle; angle = fmodf(angle + half_angle, guide->angle_snap); angle -= half_angle; - gp_rotate_v2_v2v2fl(p->guide.rot_point, p->mvali, p->guide.origin, -angle); + gpencil_rotate_v2_v2v2fl(p->guide.rot_point, p->mvali, p->guide.origin, -angle); } else { - gp_rotate_v2_v2v2fl(p->guide.rot_point, p->guide.unit, p->mvali, guide->angle); + gpencil_rotate_v2_v2v2fl(p->guide.rot_point, p->guide.unit, p->mvali, guide->angle); } } @@ -2634,14 +2642,15 @@ static void gpencil_snap_to_guide(const tGPsdata *p, const GP_Sculpt_Guide *guid case GP_GUIDE_PARALLEL: { closest_to_line_v2(point, point, p->mvali, p->guide.rot_point); if (guide->use_snapping && (guide->spacing > 0.0f)) { - gp_snap_to_rotated_grid_fl(point, p->guide.origin, p->guide.spacing, guide->angle); + gpencil_snap_to_rotated_grid_fl(point, p->guide.origin, p->guide.spacing, guide->angle); } break; } case GP_GUIDE_ISO: { closest_to_line_v2(point, point, p->mvali, p->guide.rot_point); if (guide->use_snapping && (guide->spacing > 0.0f)) { - gp_snap_to_rotated_grid_fl(point, p->guide.origin, p->guide.spacing, p->guide.rot_angle); + gpencil_snap_to_rotated_grid_fl( + point, p->guide.origin, p->guide.spacing, p->guide.rot_angle); } break; } @@ -2649,10 +2658,10 @@ static void gpencil_snap_to_guide(const tGPsdata *p, const GP_Sculpt_Guide *guid if (guide->use_snapping && (guide->spacing > 0.0f)) { closest_to_line_v2(point, point, p->mvali, p->guide.rot_point); if (p->straight == STROKE_HORIZONTAL) { - point[1] = gp_snap_to_grid_fl(point[1], p->guide.origin[1], p->guide.spacing); + point[1] = gpencil_snap_to_grid_fl(point[1], p->guide.origin[1], p->guide.spacing); } else { - point[0] = gp_snap_to_grid_fl(point[0], p->guide.origin[0], p->guide.spacing); + point[0] = gpencil_snap_to_grid_fl(point[0], p->guide.origin[0], p->guide.spacing); } } else if (p->straight == STROKE_HORIZONTAL) { @@ -2675,7 +2684,7 @@ static void gpencil_draw_apply(bContext *C, wmOperator *op, tGPsdata *p, Depsgra /* handle drawing/erasing -> test for erasing first */ if (p->paintmode == GP_PAINTMODE_ERASER) { /* do 'live' erasing now */ - gp_stroke_doeraser(p); + gpencil_stroke_doeraser(p); /* store used values */ copy_v2_v2(p->mvalo, p->mval); @@ -2683,7 +2692,7 @@ static void gpencil_draw_apply(bContext *C, wmOperator *op, tGPsdata *p, Depsgra } /* Only add current point to buffer if mouse moved * (even though we got an event, it might be just noise). */ - else if (gp_stroke_filtermval(p, p->mval, p->mvalo)) { + else if (gpencil_stroke_filtermval(p, p->mval, p->mvalo)) { /* if lazy mouse, interpolate the last and current mouse positions */ if (GPENCIL_LAZY_MODE(p->brush, p->shift)) { @@ -2703,26 +2712,26 @@ static void gpencil_draw_apply(bContext *C, wmOperator *op, tGPsdata *p, Depsgra } /* try to add point */ - short ok = gp_stroke_addpoint(p, p->mval, p->pressure, p->curtime); + short ok = gpencil_stroke_addpoint(p, p->mval, p->pressure, p->curtime); /* handle errors while adding point */ if ((ok == GP_STROKEADD_FULL) || (ok == GP_STROKEADD_OVERFLOW)) { /* finish off old stroke */ - gp_paint_strokeend(p); + gpencil_paint_strokeend(p); /* And start a new one!!! Else, projection errors! */ - gp_paint_initstroke(p, p->paintmode, depsgraph); + gpencil_paint_initstroke(p, p->paintmode, depsgraph); /* start a new stroke, starting from previous point */ /* XXX Must manually reset inittime... */ /* XXX We only need to reuse previous point if overflow! */ if (ok == GP_STROKEADD_OVERFLOW) { p->inittime = p->ocurtime; - gp_stroke_addpoint(p, p->mvalo, p->opressure, p->ocurtime); + gpencil_stroke_addpoint(p, p->mvalo, p->opressure, p->ocurtime); } else { p->inittime = p->curtime; } - gp_stroke_addpoint(p, p->mval, p->pressure, p->curtime); + gpencil_stroke_addpoint(p, p->mval, p->pressure, p->curtime); } else if (ok == GP_STROKEADD_INVALID) { /* the painting operation cannot continue... */ @@ -2890,13 +2899,13 @@ static void gpencil_draw_apply_event(bContext *C, else { p->guide.rot_angle = DEG2RAD(90); } - gp_rotate_v2_v2v2fl(p->guide.rot_point, p->guide.unit, p->mvali, p->guide.rot_angle); + gpencil_rotate_v2_v2v2fl(p->guide.rot_point, p->guide.unit, p->mvali, p->guide.rot_angle); } else if (ELEM(guide->type, GP_GUIDE_GRID)) { - gp_rotate_v2_v2v2fl(p->guide.rot_point, - p->guide.unit, - p->mvali, - (p->straight == STROKE_VERTICAL) ? M_PI_2 : 0.0f); + gpencil_rotate_v2_v2v2fl(p->guide.rot_point, + p->guide.unit, + p->mvali, + (p->straight == STROKE_VERTICAL) ? M_PI_2 : 0.0f); } } @@ -2969,8 +2978,8 @@ static int gpencil_draw_exec(bContext *C, wmOperator *op) */ if ((p->flags & GP_PAINTFLAG_FIRSTRUN) == 0) { /* TODO: both of these ops can set error-status, but we probably don't need to worry */ - gp_paint_strokeend(p); - gp_paint_initstroke(p, p->paintmode, depsgraph); + gpencil_paint_strokeend(p); + gpencil_paint_initstroke(p, p->paintmode, depsgraph); } } @@ -3228,8 +3237,8 @@ static tGPsdata *gpencil_stroke_begin(bContext *C, wmOperator *op) } /* we may need to set up paint env again if we're resuming */ - if (gp_session_initdata(C, op, p)) { - gp_paint_initstroke(p, p->paintmode, CTX_data_depsgraph_pointer(C)); + if (gpencil_session_initdata(C, op, p)) { + gpencil_paint_initstroke(p, p->paintmode, CTX_data_depsgraph_pointer(C)); } if (p->status != GP_STATUS_ERROR) { @@ -3241,7 +3250,7 @@ static tGPsdata *gpencil_stroke_begin(bContext *C, wmOperator *op) } /* Apply pressure change depending of the angle of the stroke for a segment. */ -static void gp_brush_angle_segment(tGPsdata *p, tGPspoint *pt_prev, tGPspoint *pt) +static void gpencil_brush_angle_segment(tGPsdata *p, tGPspoint *pt_prev, tGPspoint *pt) { Brush *brush = p->brush; /* Sensitivity. */ @@ -3285,7 +3294,7 @@ static void gpencil_add_arc_points(tGPsdata *p, float mval[2], int segments) /* Apply other randomness to first points. */ for (int i = 0; i < gpd->runtime.sbuffer_used; i++) { tGPspoint *pt = &points[i]; - gp_apply_randomness(p, brush_settings, pt, false, false, true); + gpencil_apply_randomness(p, brush_settings, pt, false, false, true); } return; } @@ -3360,14 +3369,14 @@ static void gpencil_add_arc_points(tGPsdata *p, float mval[2], int segments) /* Apply angle of stroke to brush size to interpolated points but slightly attenuated.. */ if (brush_settings->draw_angle_factor != 0.0f) { - gp_brush_angle_segment(p, pt_step, pt); + gpencil_brush_angle_segment(p, pt_step, pt); CLAMP(pt->pressure, pt_prev->pressure * 0.5f, 1.0f); /* Use the previous interpolated point for next segment. */ pt_step = pt; } /* Apply other randomness. */ - gp_apply_randomness(p, brush_settings, pt, false, false, true); + gpencil_apply_randomness(p, brush_settings, pt, false, false, true); a += step; } @@ -3412,7 +3421,7 @@ static void gpencil_add_guide_points(const tGPsdata *p, for (int i = 0; i < segments; i++) { pt = &points[idx_prev + i - 1]; - gp_rotate_v2_v2v2fl(&pt->x, start, p->guide.origin, -a); + gpencil_rotate_v2_v2v2fl(&pt->x, start, p->guide.origin, -a); gpencil_snap_to_guide(p, guide, &pt->x); a += step; @@ -3548,7 +3557,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) /* set */ case LEFTMOUSE: { if (ELEM(event->val, KM_RELEASE)) { - gp_origin_set(op, event->mval); + gpencil_origin_set(op, event->mval); drawmode = true; } break; @@ -3751,7 +3760,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) * the 0.15 value gets a good result in Windows and Linux. */ if (!is_speed_guide && (size_after - size_before > 1)) { for (int r = 0; r < 5; r++) { - gp_smooth_segment(p->gpd, 0.15f, size_before - 1, size_after - 1); + gpencil_smooth_segment(p->gpd, 0.15f, size_before - 1, size_after - 1); } } diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c index 82746058096..163ae817d73 100644 --- a/source/blender/editors/gpencil/gpencil_primitive.c +++ b/source/blender/editors/gpencil/gpencil_primitive.c @@ -111,7 +111,7 @@ /* Core/Shared Utilities */ /* clear the session buffers (call this before AND after a paint operation) */ -static void gp_session_validatebuffer(tGPDprimitive *p) +static void gpencil_session_validatebuffer(tGPDprimitive *p) { bGPdata *gpd = p->gpd; @@ -137,7 +137,7 @@ static void gp_session_validatebuffer(tGPDprimitive *p) } } -static void gp_init_colors(tGPDprimitive *p) +static void gpencil_init_colors(tGPDprimitive *p) { bGPdata *gpd = p->gpd; Brush *brush = p->brush; @@ -196,10 +196,10 @@ static void gpencil_primitive_constrain(tGPDprimitive *tgpi, bool line_mode) } /* Helper to rotate point around origin */ -static void gp_rotate_v2_v2v2fl(float v[2], - const float p[2], - const float origin[2], - const float angle) +static void gpencil_rotate_v2_v2v2fl(float v[2], + const float p[2], + const float origin[2], + const float angle) { float pt[2]; float r[2]; @@ -209,17 +209,17 @@ static void gp_rotate_v2_v2v2fl(float v[2], } /* Helper to rotate line around line center. */ -static void gp_primitive_rotate_line( +static void gpencil_primitive_rotate_line( float va[2], float vb[2], const float a[2], const float b[2], const float angle) { float midpoint[2]; mid_v2_v2v2(midpoint, a, b); - gp_rotate_v2_v2v2fl(va, a, midpoint, angle); - gp_rotate_v2_v2v2fl(vb, b, midpoint, angle); + gpencil_rotate_v2_v2v2fl(va, a, midpoint, angle); + gpencil_rotate_v2_v2v2fl(vb, b, midpoint, angle); } /* Helper to update cps */ -static void gp_primitive_update_cps(tGPDprimitive *tgpi) +static void gpencil_primitive_update_cps(tGPDprimitive *tgpi) { if (!tgpi->curve) { mid_v2_v2v2(tgpi->midpoint, tgpi->start, tgpi->end); @@ -233,10 +233,10 @@ static void gp_primitive_update_cps(tGPDprimitive *tgpi) } else if (tgpi->type == GP_STROKE_ARC) { if (tgpi->flip) { - gp_primitive_rotate_line(tgpi->cp1, tgpi->cp2, tgpi->start, tgpi->end, M_PI_2); + gpencil_primitive_rotate_line(tgpi->cp1, tgpi->cp2, tgpi->start, tgpi->end, M_PI_2); } else { - gp_primitive_rotate_line(tgpi->cp1, tgpi->cp2, tgpi->end, tgpi->start, M_PI_2); + gpencil_primitive_rotate_line(tgpi->cp1, tgpi->cp2, tgpi->end, tgpi->start, M_PI_2); } } } @@ -294,7 +294,7 @@ static void gpencil_primitive_allocate_memory(tGPDprimitive *tgpi) /* ****************** Primitive Interactive *********************** */ /* Helper: Create internal strokes primitives data */ -static void gp_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi) +static void gpencil_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi) { Scene *scene = CTX_data_scene(C); ToolSettings *ts = scene->toolsettings; @@ -378,7 +378,7 @@ static void gpencil_primitive_add_segment(tGPDprimitive *tgpi) } /* Helper: set control point */ -static void gp_primitive_set_cp(tGPDprimitive *tgpi, float p[2], float color[4], int size) +static void gpencil_primitive_set_cp(tGPDprimitive *tgpi, float p[2], float color[4], int size) { if (tgpi->flag == IN_PROGRESS) { return; @@ -500,7 +500,7 @@ static void gpencil_primitive_status_indicators(bContext *C, tGPDprimitive *tgpi } /* create a rectangle */ -static void gp_primitive_rectangle(tGPDprimitive *tgpi, tGPspoint *points2D) +static void gpencil_primitive_rectangle(tGPDprimitive *tgpi, tGPspoint *points2D) { float coords[5][2]; @@ -531,20 +531,20 @@ static void gp_primitive_rectangle(tGPDprimitive *tgpi, tGPspoint *points2D) mid_v2_v2v2(tgpi->midpoint, tgpi->start, tgpi->end); float color[4]; UI_GetThemeColor4fv(TH_GIZMO_PRIMARY, color); - gp_primitive_set_cp(tgpi, tgpi->end, color, BIG_SIZE_CTL); + gpencil_primitive_set_cp(tgpi, tgpi->end, color, BIG_SIZE_CTL); if (tgpi->tot_stored_edges) { UI_GetThemeColor4fv(TH_REDALERT, color); - gp_primitive_set_cp(tgpi, tgpi->start, color, SMALL_SIZE_CTL); + gpencil_primitive_set_cp(tgpi, tgpi->start, color, SMALL_SIZE_CTL); } else { - gp_primitive_set_cp(tgpi, tgpi->start, color, BIG_SIZE_CTL); + gpencil_primitive_set_cp(tgpi, tgpi->start, color, BIG_SIZE_CTL); } UI_GetThemeColor4fv(TH_REDALERT, color); - gp_primitive_set_cp(tgpi, tgpi->midpoint, color, SMALL_SIZE_CTL); + gpencil_primitive_set_cp(tgpi, tgpi->midpoint, color, SMALL_SIZE_CTL); } /* create a line */ -static void gp_primitive_line(tGPDprimitive *tgpi, tGPspoint *points2D, bool editable) +static void gpencil_primitive_line(tGPDprimitive *tgpi, tGPspoint *points2D, bool editable) { const int totpoints = (tgpi->tot_edges + tgpi->tot_stored_edges); const float step = 1.0f / (float)(tgpi->tot_edges - 1); @@ -559,24 +559,24 @@ static void gp_primitive_line(tGPDprimitive *tgpi, tGPspoint *points2D, bool edi if (editable) { float color[4]; UI_GetThemeColor4fv(TH_GIZMO_PRIMARY, color); - gp_primitive_set_cp(tgpi, tgpi->end, color, BIG_SIZE_CTL); + gpencil_primitive_set_cp(tgpi, tgpi->end, color, BIG_SIZE_CTL); if (tgpi->tot_stored_edges) { UI_GetThemeColor4fv(TH_REDALERT, color); - gp_primitive_set_cp(tgpi, tgpi->start, color, SMALL_SIZE_CTL); + gpencil_primitive_set_cp(tgpi, tgpi->start, color, SMALL_SIZE_CTL); } else { - gp_primitive_set_cp(tgpi, tgpi->start, color, BIG_SIZE_CTL); + gpencil_primitive_set_cp(tgpi, tgpi->start, color, BIG_SIZE_CTL); } } else { float color[4]; UI_GetThemeColor4fv(TH_REDALERT, color); - gp_primitive_set_cp(tgpi, tgpi->start, color, SMALL_SIZE_CTL); + gpencil_primitive_set_cp(tgpi, tgpi->start, color, SMALL_SIZE_CTL); } } /* create an arc */ -static void gp_primitive_arc(tGPDprimitive *tgpi, tGPspoint *points2D) +static void gpencil_primitive_arc(tGPDprimitive *tgpi, tGPspoint *points2D) { const int totpoints = (tgpi->tot_edges + tgpi->tot_stored_edges); const float step = M_PI_2 / (float)(tgpi->tot_edges - 1); @@ -604,20 +604,20 @@ static void gp_primitive_arc(tGPDprimitive *tgpi, tGPspoint *points2D) } float color[4]; UI_GetThemeColor4fv(TH_GIZMO_PRIMARY, color); - gp_primitive_set_cp(tgpi, tgpi->end, color, BIG_SIZE_CTL); + gpencil_primitive_set_cp(tgpi, tgpi->end, color, BIG_SIZE_CTL); if (tgpi->tot_stored_edges) { UI_GetThemeColor4fv(TH_REDALERT, color); - gp_primitive_set_cp(tgpi, tgpi->start, color, SMALL_SIZE_CTL); + gpencil_primitive_set_cp(tgpi, tgpi->start, color, SMALL_SIZE_CTL); } else { - gp_primitive_set_cp(tgpi, tgpi->start, color, BIG_SIZE_CTL); + gpencil_primitive_set_cp(tgpi, tgpi->start, color, BIG_SIZE_CTL); } UI_GetThemeColor4fv(TH_GIZMO_SECONDARY, color); - gp_primitive_set_cp(tgpi, tgpi->cp1, color, BIG_SIZE_CTL * 0.9f); + gpencil_primitive_set_cp(tgpi, tgpi->cp1, color, BIG_SIZE_CTL * 0.9f); } /* create a bezier */ -static void gp_primitive_bezier(tGPDprimitive *tgpi, tGPspoint *points2D) +static void gpencil_primitive_bezier(tGPDprimitive *tgpi, tGPspoint *points2D) { const int totpoints = (tgpi->tot_edges + tgpi->tot_stored_edges); const float step = 1.0f / (float)(tgpi->tot_edges - 1); @@ -639,21 +639,21 @@ static void gp_primitive_bezier(tGPDprimitive *tgpi, tGPspoint *points2D) } float color[4]; UI_GetThemeColor4fv(TH_GIZMO_PRIMARY, color); - gp_primitive_set_cp(tgpi, tgpi->end, color, BIG_SIZE_CTL); + gpencil_primitive_set_cp(tgpi, tgpi->end, color, BIG_SIZE_CTL); if (tgpi->tot_stored_edges) { UI_GetThemeColor4fv(TH_REDALERT, color); - gp_primitive_set_cp(tgpi, tgpi->start, color, SMALL_SIZE_CTL); + gpencil_primitive_set_cp(tgpi, tgpi->start, color, SMALL_SIZE_CTL); } else { - gp_primitive_set_cp(tgpi, tgpi->start, color, BIG_SIZE_CTL); + gpencil_primitive_set_cp(tgpi, tgpi->start, color, BIG_SIZE_CTL); } UI_GetThemeColor4fv(TH_GIZMO_SECONDARY, color); - gp_primitive_set_cp(tgpi, tgpi->cp1, color, BIG_SIZE_CTL * 0.9f); - gp_primitive_set_cp(tgpi, tgpi->cp2, color, BIG_SIZE_CTL * 0.9f); + gpencil_primitive_set_cp(tgpi, tgpi->cp1, color, BIG_SIZE_CTL * 0.9f); + gpencil_primitive_set_cp(tgpi, tgpi->cp2, color, BIG_SIZE_CTL * 0.9f); } /* create a circle */ -static void gp_primitive_circle(tGPDprimitive *tgpi, tGPspoint *points2D) +static void gpencil_primitive_circle(tGPDprimitive *tgpi, tGPspoint *points2D) { const int totpoints = (tgpi->tot_edges + tgpi->tot_stored_edges); const float step = (2.0f * M_PI) / (float)(tgpi->tot_edges); @@ -674,14 +674,14 @@ static void gp_primitive_circle(tGPDprimitive *tgpi, tGPspoint *points2D) } float color[4]; UI_GetThemeColor4fv(TH_GIZMO_PRIMARY, color); - gp_primitive_set_cp(tgpi, tgpi->end, color, BIG_SIZE_CTL); - gp_primitive_set_cp(tgpi, tgpi->start, color, BIG_SIZE_CTL); + gpencil_primitive_set_cp(tgpi, tgpi->end, color, BIG_SIZE_CTL); + gpencil_primitive_set_cp(tgpi, tgpi->start, color, BIG_SIZE_CTL); UI_GetThemeColor4fv(TH_REDALERT, color); - gp_primitive_set_cp(tgpi, center, color, SMALL_SIZE_CTL); + gpencil_primitive_set_cp(tgpi, center, color, SMALL_SIZE_CTL); } /* Helper: Update shape of the stroke */ -static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi) +static void gpencil_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi) { ToolSettings *ts = tgpi->scene->toolsettings; bGPdata *gpd = tgpi->gpd; @@ -715,30 +715,30 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi) if (tgpi->tot_edges > 1) { switch (tgpi->type) { case GP_STROKE_BOX: - gp_primitive_rectangle(tgpi, points2D); + gpencil_primitive_rectangle(tgpi, points2D); break; case GP_STROKE_LINE: - gp_primitive_line(tgpi, points2D, true); + gpencil_primitive_line(tgpi, points2D, true); break; case GP_STROKE_POLYLINE: - gp_primitive_line(tgpi, points2D, false); + gpencil_primitive_line(tgpi, points2D, false); break; case GP_STROKE_CIRCLE: - gp_primitive_circle(tgpi, points2D); + gpencil_primitive_circle(tgpi, points2D); break; case GP_STROKE_ARC: - gp_primitive_arc(tgpi, points2D); + gpencil_primitive_arc(tgpi, points2D); break; case GP_STROKE_CURVE: - gp_primitive_bezier(tgpi, points2D); + gpencil_primitive_bezier(tgpi, points2D); default: break; } } /* convert screen-coordinates to 3D coordinates */ - gp_session_validatebuffer(tgpi); - gp_init_colors(tgpi); + gpencil_session_validatebuffer(tgpi); + gpencil_init_colors(tgpi); if (gset->flag & GP_SCULPT_SETT_FLAG_PRIMITIVE_CURVE) { BKE_curvemapping_initialize(ts->gp_sculpt.cur_primitive); } @@ -1082,7 +1082,7 @@ static void gpencil_primitive_update(bContext *C, wmOperator *op, tGPDprimitive tgpi->type = RNA_enum_get(op->ptr, "type"); tgpi->tot_edges = RNA_int_get(op->ptr, "edges"); /* update points position */ - gp_primitive_update_strokes(C, tgpi); + gpencil_primitive_update_strokes(C, tgpi); } /* Initialise mouse points */ @@ -1237,7 +1237,7 @@ static void gpencil_primitive_init(bContext *C, wmOperator *op) tgpi->lock_axis = ts->gp_sculpt.lock_axis; /* set temp layer, frame and stroke */ - gp_primitive_set_initdata(C, tgpi); + gpencil_primitive_set_initdata(C, tgpi); } /* Invoke handler: Initialize the operator */ @@ -1396,14 +1396,14 @@ static void gpencil_primitive_edit_event_handling( gpencil_primitive_add_segment(tgpi); copy_v2_v2(tgpi->start, tgpi->end); copy_v2_v2(tgpi->origin, tgpi->start); - gp_primitive_update_cps(tgpi); + gpencil_primitive_update_cps(tgpi); tgpi->flag = IN_POLYLINE; WM_cursor_modal_set(win, WM_CURSOR_CROSS); } else { tgpi->flag = IN_CURVE_EDIT; - gp_primitive_update_cps(tgpi); + gpencil_primitive_update_cps(tgpi); gpencil_primitive_update(C, op, tgpi); } } @@ -1460,7 +1460,7 @@ static void gpencil_primitive_edit_event_handling( case EVT_MKEY: { if ((event->val == KM_PRESS) && (tgpi->curve) && (ELEM(tgpi->orign_type, GP_STROKE_ARC))) { tgpi->flip ^= 1; - gp_primitive_update_cps(tgpi); + gpencil_primitive_update_cps(tgpi); gpencil_primitive_update(C, op, tgpi); } break; @@ -1472,7 +1472,7 @@ static void gpencil_primitive_edit_event_handling( gpencil_primitive_add_segment(tgpi); copy_v2_v2(tgpi->start, tgpi->end); copy_v2_v2(tgpi->origin, tgpi->start); - gp_primitive_update_cps(tgpi); + gpencil_primitive_update_cps(tgpi); } break; } @@ -1625,7 +1625,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e if (event->val == KM_PRESS) { tgpi->flag = IDLE; tgpi->tot_edges = tgpi->tot_stored_edges ? 1 : 0; - gp_primitive_update_strokes(C, tgpi); + gpencil_primitive_update_strokes(C, tgpi); gpencil_primitive_interaction_end(C, op, win, tgpi); return OPERATOR_FINISHED; } @@ -1749,7 +1749,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e (!ELEM(tgpi->type, GP_STROKE_POLYLINE))) { /* set control points and enter edit mode */ tgpi->flag = IN_CURVE_EDIT; - gp_primitive_update_cps(tgpi); + gpencil_primitive_update_cps(tgpi); gpencil_primitive_update(C, op, tgpi); } else if ((event->val == KM_RELEASE) && (tgpi->flag == IN_PROGRESS) && @@ -1792,7 +1792,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e if (tgpi->tot_stored_edges > 0) { tgpi->flag = IDLE; tgpi->tot_edges = tgpi->tot_stored_edges ? 1 : 0; - gp_primitive_update_strokes(C, tgpi); + gpencil_primitive_update_strokes(C, tgpi); gpencil_primitive_interaction_end(C, op, win, tgpi); /* done! */ return OPERATOR_FINISHED; @@ -1871,7 +1871,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e } RNA_enum_set(op->ptr, "type", tgpi->type); - gp_primitive_update_cps(tgpi); + gpencil_primitive_update_cps(tgpi); gpencil_primitive_update(C, op, tgpi); } break; @@ -1880,7 +1880,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e if (tgpi->flag == IN_CURVE_EDIT) { tgpi->flag = IN_PROGRESS; WM_cursor_modal_set(win, WM_CURSOR_NSEW_SCROLL); - gp_primitive_update_cps(tgpi); + gpencil_primitive_update_cps(tgpi); gpencil_primitive_update(C, op, tgpi); } break; @@ -1908,7 +1908,7 @@ static int gpencil_primitive_modal(bContext *C, wmOperator *op, const wmEvent *e tgpi->start[0] = tgpi->origin[0] - (tgpi->end[0] - tgpi->origin[0]); tgpi->start[1] = tgpi->origin[1] - (tgpi->end[1] - tgpi->origin[1]); } - gp_primitive_update_cps(tgpi); + gpencil_primitive_update_cps(tgpi); /* update screen */ gpencil_primitive_update(C, op, tgpi); } |