diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-06-29 13:49:30 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-06-29 16:47:38 +0300 |
commit | 399dbb1aa391f04357f91ab875241db3c6041aa5 (patch) | |
tree | bcd39c2b1f90764b3064d3b25fc7c1e496cc9bdb /source/blender/editors | |
parent | 1cda37490690c259c716160dcb77ea43dccd5a03 (diff) |
GPencil: Cleanup - Rename some functions from gp_ to gpencil_
Diffstat (limited to 'source/blender/editors')
21 files changed, 375 insertions, 356 deletions
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index 9fc3e864f54..f0954a198a3 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -456,10 +456,10 @@ static void annotation_stroke_arrow_calc_points_segment(float stroke_points[8], } static void annotation_stroke_arrow_calc_points(tGPspoint *point, - const float stroke_dir[2], - float corner[2], - float stroke_points[8], - const int arrow_style) + const float stroke_dir[2], + float corner[2], + float stroke_points[8], + const int arrow_style) { const int arrow_lenght = 8; float norm_dir[2]; @@ -1131,7 +1131,7 @@ static void annotation_stroke_eraser_dostroke(tGPsdata *p, else if (gps->totpoints == 1) { /* only process if it hasn't been masked out... */ if (!(p->flags & GP_PAINTFLAG_SELECTMASK) || (gps->points->flag & GP_SPOINT_SELECT)) { - gp_point_to_xy(&p->gsc, gps, gps->points, &pc1[0], &pc1[1]); + gpencil_point_to_xy(&p->gsc, gps, gps->points, &pc1[0], &pc1[1]); /* do boundbox check first */ if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) { @@ -1172,8 +1172,8 @@ static void annotation_stroke_eraser_dostroke(tGPsdata *p, continue; } - gp_point_to_xy(&p->gsc, gps, pt1, &pc1[0], &pc1[1]); - gp_point_to_xy(&p->gsc, gps, pt2, &pc2[0], &pc2[1]); + gpencil_point_to_xy(&p->gsc, gps, pt1, &pc1[0], &pc1[1]); + gpencil_point_to_xy(&p->gsc, gps, pt2, &pc2[0], &pc2[1]); /* Check that point segment of the boundbox of the eraser stroke */ if (((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) || @@ -1182,7 +1182,7 @@ static void annotation_stroke_eraser_dostroke(tGPsdata *p, * eraser region (either within stroke painted, or on its lines) * - this assumes that linewidth is irrelevant */ - if (gp_stroke_inside_circle(mval, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { + if (gpencil_stroke_inside_circle(mval, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { if ((annotation_stroke_eraser_is_occluded(p, pt1, pc1[0], pc1[1]) == false) || (annotation_stroke_eraser_is_occluded(p, pt2, pc2[0], pc2[1]) == false)) { /* Edge is affected - Check individual points now */ @@ -1200,7 +1200,7 @@ static void annotation_stroke_eraser_dostroke(tGPsdata *p, /* Second Pass: Remove any points that are tagged */ if (do_cull) { - gp_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_TAG, false, 0); + gpencil_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_TAG, false, 0); } } } diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 3aff943a093..60fd52db707 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -114,10 +114,10 @@ typedef enum eDrawStrokeFlags { /* ----- Tool Buffer Drawing ------ */ /* helper functions to set color of buffer point */ -static void gp_set_point_varying_color(const bGPDspoint *pt, - const float ink[4], - uint attr_id, - bool fix_strength) +static void gpencil_set_point_varying_color(const bGPDspoint *pt, + const float ink[4], + uint attr_id, + bool fix_strength) { float alpha = ink[3] * pt->strength; if ((fix_strength) && (alpha >= 0.1f)) { @@ -130,10 +130,10 @@ static void gp_set_point_varying_color(const bGPDspoint *pt, /* ----------- Volumetric Strokes --------------- */ /* draw a 3D stroke in "volumetric" style */ -static void gp_draw_stroke_volumetric_3d(const bGPDspoint *points, - int totpoints, - short thickness, - const float ink[4]) +static void gpencil_draw_stroke_volumetric_3d(const bGPDspoint *points, + int totpoints, + short thickness, + const float ink[4]) { GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); @@ -147,7 +147,7 @@ static void gp_draw_stroke_volumetric_3d(const bGPDspoint *points, const bGPDspoint *pt = points; for (int i = 0; i < totpoints && pt; i++, pt++) { - gp_set_point_varying_color(pt, ink, color, false); + gpencil_set_point_varying_color(pt, ink, color, false); /* TODO: scale based on view transform */ immAttr1f(size, pt->pressure * thickness); /* we can adjust size in vertex shader based on view/projection! */ @@ -162,7 +162,10 @@ static void gp_draw_stroke_volumetric_3d(const bGPDspoint *points, /* ----- Existing Strokes Drawing (3D and Point) ------ */ /* draw a given stroke in 3d (i.e. in 3d-space) */ -static void gp_draw_stroke_3d(tGPDdraw *tgpw, short thickness, const float ink[4], bool cyclic) +static void gpencil_draw_stroke_3d(tGPDdraw *tgpw, + short thickness, + const float ink[4], + bool cyclic) { bGPDspoint *points = tgpw->gps->points; int totpoints = tgpw->gps->totpoints; @@ -209,7 +212,7 @@ static void gp_draw_stroke_3d(tGPDdraw *tgpw, short thickness, const float ink[4 for (int i = 0; i < totpoints; i++, pt++) { /* first point for adjacency (not drawn) */ if (i == 0) { - gp_set_point_varying_color(points, ink, attr_id.color, (bool)tgpw->is_fill_stroke); + gpencil_set_point_varying_color(points, ink, attr_id.color, (bool)tgpw->is_fill_stroke); if ((cyclic) && (totpoints > 2)) { immAttr1f(attr_id.thickness, max_ff((points + totpoints - 1)->pressure * thickness, 1.0f)); @@ -222,7 +225,7 @@ static void gp_draw_stroke_3d(tGPDdraw *tgpw, short thickness, const float ink[4 immVertex3fv(attr_id.pos, fpt); } /* set point */ - gp_set_point_varying_color(pt, ink, attr_id.color, (bool)tgpw->is_fill_stroke); + gpencil_set_point_varying_color(pt, ink, attr_id.color, (bool)tgpw->is_fill_stroke); immAttr1f(attr_id.thickness, max_ff(pt->pressure * thickness, 1.0f)); mul_v3_m4v3(fpt, tgpw->diff_mat, &pt->x); immVertex3fv(attr_id.pos, fpt); @@ -241,7 +244,7 @@ static void gp_draw_stroke_3d(tGPDdraw *tgpw, short thickness, const float ink[4 } /* last adjacency point (not drawn) */ else { - gp_set_point_varying_color( + gpencil_set_point_varying_color( points + totpoints - 2, ink, attr_id.color, (bool)tgpw->is_fill_stroke); immAttr1f(attr_id.thickness, max_ff((points + totpoints - 2)->pressure * thickness, 1.0f)); @@ -256,7 +259,7 @@ static void gp_draw_stroke_3d(tGPDdraw *tgpw, short thickness, const float ink[4 /* ----- Strokes Drawing ------ */ /* Helper for doing all the checks on whether a stroke can be drawn */ -static bool gp_can_draw_stroke(const bGPDstroke *gps, const int dflag) +static bool gpencil_can_draw_stroke(const bGPDstroke *gps, const int dflag) { /* skip stroke if it isn't in the right display space for this drawing context */ /* 1) 3D Strokes */ @@ -293,7 +296,7 @@ static bool gp_can_draw_stroke(const bGPDstroke *gps, const int dflag) } /* draw a set of strokes */ -static void gp_draw_strokes(tGPDdraw *tgpw) +static void gpencil_draw_strokes(tGPDdraw *tgpw) { float tcolor[4]; short sthickness; @@ -307,7 +310,7 @@ static void gp_draw_strokes(tGPDdraw *tgpw) for (bGPDstroke *gps = gps_init; gps; gps = gps->next) { /* check if stroke can be drawn */ - if (gp_can_draw_stroke(gps, tgpw->dflag) == false) { + if (gpencil_can_draw_stroke(gps, tgpw->dflag) == false) { continue; } /* check if the color is visible */ @@ -379,14 +382,14 @@ static void gp_draw_strokes(tGPDdraw *tgpw) if (gp_style->mode == GP_MATERIAL_MODE_DOT) { /* volumetric stroke drawing */ if (tgpw->disable_fill != 1) { - gp_draw_stroke_volumetric_3d(gps->points, gps->totpoints, sthickness, ink); + gpencil_draw_stroke_volumetric_3d(gps->points, gps->totpoints, sthickness, ink); } } else { /* 3D Lines - OpenGL primitives-based */ if (gps->totpoints > 1) { tgpw->gps = gps; - gp_draw_stroke_3d(tgpw, sthickness, ink, gps->flag & GP_STROKE_CYCLIC); + gpencil_draw_stroke_3d(tgpw, sthickness, ink, gps->flag & GP_STROKE_CYCLIC); } } if (no_xray) { @@ -408,7 +411,7 @@ static void gp_draw_strokes(tGPDdraw *tgpw) /* ----- General Drawing ------ */ /* wrapper to draw strokes for filling operator */ -void ED_gp_draw_fill(tGPDdraw *tgpw) +void ED_gpencil_draw_fill(tGPDdraw *tgpw) { - gp_draw_strokes(tgpw); + gpencil_draw_strokes(tgpw); } diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index 5db2e904dee..752b8a74f4f 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -56,7 +56,9 @@ /* Generics - Loopers */ /* Loops over the gp-frames for a gp-layer, and applies the given callback */ -bool ED_gplayer_frames_looper(bGPDlayer *gpl, Scene *scene, short (*gpf_cb)(bGPDframe *, Scene *)) +bool ED_gpencil_layer_frames_looper(bGPDlayer *gpl, + Scene *scene, + short (*gpf_cb)(bGPDframe *, Scene *)) { /* error checker */ if (gpl == NULL) { @@ -79,7 +81,7 @@ bool ED_gplayer_frames_looper(bGPDlayer *gpl, Scene *scene, short (*gpf_cb)(bGPD /* Data Conversion Tools */ /* make a listing all the gp-frames in a layer as cfraelems */ -void ED_gplayer_make_cfra_list(bGPDlayer *gpl, ListBase *elems, bool onlysel) +void ED_gpencil_layer_make_cfra_list(bGPDlayer *gpl, ListBase *elems, bool onlysel) { CfraElem *ce; @@ -105,7 +107,7 @@ void ED_gplayer_make_cfra_list(bGPDlayer *gpl, ListBase *elems, bool onlysel) /* Selection Tools */ /* check if one of the frames in this layer is selected */ -bool ED_gplayer_frame_select_check(bGPDlayer *gpl) +bool ED_gpencil_layer_frame_select_check(bGPDlayer *gpl) { /* error checking */ if (gpl == NULL) { @@ -124,7 +126,7 @@ bool ED_gplayer_frame_select_check(bGPDlayer *gpl) } /* helper function - select gp-frame based on SELECT_* mode */ -static void gpframe_select(bGPDframe *gpf, short select_mode) +static void gpencil_frame_select(bGPDframe *gpf, short select_mode) { if (gpf == NULL) { return; @@ -153,12 +155,12 @@ void ED_gpencil_select_frames(bGPDlayer *gpl, short select_mode) /* handle according to mode */ LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) { - gpframe_select(gpf, select_mode); + gpencil_frame_select(gpf, select_mode); } } /* set all/none/invert select */ -void ED_gplayer_frame_select_set(bGPDlayer *gpl, short mode) +void ED_gpencil_layer_frame_select_set(bGPDlayer *gpl, short mode) { /* error checking */ if (gpl == NULL) { @@ -181,12 +183,12 @@ void ED_gpencil_select_frame(bGPDlayer *gpl, int selx, short select_mode) gpf = BKE_gpencil_layer_frame_find(gpl, selx); if (gpf) { - gpframe_select(gpf, select_mode); + gpencil_frame_select(gpf, select_mode); } } /* select the frames in this layer that occur within the bounds specified */ -void ED_gplayer_frames_select_box(bGPDlayer *gpl, float min, float max, short select_mode) +void ED_gpencil_layer_frames_select_box(bGPDlayer *gpl, float min, float max, short select_mode) { if (gpl == NULL) { return; @@ -195,16 +197,16 @@ void ED_gplayer_frames_select_box(bGPDlayer *gpl, float min, float max, short se /* only select those frames which are in bounds */ LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) { if (IN_RANGE(gpf->framenum, min, max)) { - gpframe_select(gpf, select_mode); + gpencil_frame_select(gpf, select_mode); } } } /* select the frames in this layer that occur within the lasso/circle region specified */ -void ED_gplayer_frames_select_region(KeyframeEditData *ked, - bGPDlayer *gpl, - short tool, - short select_mode) +void ED_gpencil_layer_frames_select_region(KeyframeEditData *ked, + bGPDlayer *gpl, + short tool, + short select_mode) { if (gpl == NULL) { return; @@ -222,13 +224,13 @@ void ED_gplayer_frames_select_region(KeyframeEditData *ked, if (tool == BEZT_OK_CHANNEL_LASSO) { /* Lasso */ if (keyframe_region_lasso_test(ked->data, pt)) { - gpframe_select(gpf, select_mode); + gpencil_frame_select(gpf, select_mode); } } else if (tool == BEZT_OK_CHANNEL_CIRCLE) { /* Circle */ if (keyframe_region_circle_test(ked->data, pt)) { - gpframe_select(gpf, select_mode); + gpencil_frame_select(gpf, select_mode); } } } @@ -238,7 +240,7 @@ void ED_gplayer_frames_select_region(KeyframeEditData *ked, /* Frame Editing Tools */ /* Delete selected frames */ -bool ED_gplayer_frames_delete(bGPDlayer *gpl) +bool ED_gpencil_layer_frames_delete(bGPDlayer *gpl) { bool changed = false; @@ -259,7 +261,7 @@ bool ED_gplayer_frames_delete(bGPDlayer *gpl) } /* Duplicate selected frames from given gp-layer */ -void ED_gplayer_frames_duplicate(bGPDlayer *gpl) +void ED_gpencil_layer_frames_duplicate(bGPDlayer *gpl) { /* error checking */ if (gpl == NULL) { @@ -287,7 +289,7 @@ void ED_gplayer_frames_duplicate(bGPDlayer *gpl) * * \param type: The type of keyframe (#eBezTriple_KeyframeType) to set selected frames to. */ -void ED_gplayer_frames_keytype_set(bGPDlayer *gpl, short type) +void ED_gpencil_layer_frames_keytype_set(bGPDlayer *gpl, short type) { if (gpl == NULL) { return; @@ -313,20 +315,20 @@ void ED_gplayer_frames_keytype_set(bGPDlayer *gpl, short type) */ /* globals for copy/paste data (like for other copy/paste buffers) */ -static ListBase gp_anim_copybuf = {NULL, NULL}; -static int gp_anim_copy_firstframe = 999999999; -static int gp_anim_copy_lastframe = -999999999; -static int gp_anim_copy_cfra = 0; +static ListBase gpencil_anim_copybuf = {NULL, NULL}; +static int gpencil_anim_copy_firstframe = 999999999; +static int gpencil_anim_copy_lastframe = -999999999; +static int gpencil_anim_copy_cfra = 0; /* This function frees any MEM_calloc'ed copy/paste buffer data */ void ED_gpencil_anim_copybuf_free(void) { - BKE_gpencil_free_layers(&gp_anim_copybuf); - BLI_listbase_clear(&gp_anim_copybuf); + BKE_gpencil_free_layers(&gpencil_anim_copybuf); + BLI_listbase_clear(&gpencil_anim_copybuf); - gp_anim_copy_firstframe = 999999999; - gp_anim_copy_lastframe = -999999999; - gp_anim_copy_cfra = 0; + gpencil_anim_copy_firstframe = 999999999; + gpencil_anim_copy_lastframe = -999999999; + gpencil_anim_copy_cfra = 0; } /* This function adds data to the copy/paste buffer, freeing existing data first @@ -363,11 +365,11 @@ bool ED_gpencil_anim_copybuf_copy(bAnimContext *ac) BLI_addtail(&copied_frames, new_frame); /* extend extents for keyframes encountered */ - if (gpf->framenum < gp_anim_copy_firstframe) { - gp_anim_copy_firstframe = gpf->framenum; + if (gpf->framenum < gpencil_anim_copy_firstframe) { + gpencil_anim_copy_firstframe = gpf->framenum; } - if (gpf->framenum > gp_anim_copy_lastframe) { - gp_anim_copy_lastframe = gpf->framenum; + if (gpf->framenum > gpencil_anim_copy_lastframe) { + gpencil_anim_copy_lastframe = gpf->framenum; } } } @@ -375,7 +377,7 @@ bool ED_gpencil_anim_copybuf_copy(bAnimContext *ac) /* create a new layer in buffer if there were keyframes here */ if (BLI_listbase_is_empty(&copied_frames) == false) { bGPDlayer *new_layer = MEM_callocN(sizeof(bGPDlayer), "GPCopyPasteLayer"); - BLI_addtail(&gp_anim_copybuf, new_layer); + BLI_addtail(&gpencil_anim_copybuf, new_layer); /* move over copied frames */ BLI_movelisttolist(&new_layer->frames, &copied_frames); @@ -387,13 +389,13 @@ bool ED_gpencil_anim_copybuf_copy(bAnimContext *ac) } /* in case 'relative' paste method is used */ - gp_anim_copy_cfra = CFRA; + gpencil_anim_copy_cfra = CFRA; /* clean up */ ANIM_animdata_freelist(&anim_data); /* check if anything ended up in the buffer */ - if (ELEM(NULL, gp_anim_copybuf.first, gp_anim_copybuf.last)) { + if (ELEM(NULL, gpencil_anim_copybuf.first, gpencil_anim_copybuf.last)) { BKE_report(ac->reports, RPT_ERROR, "No keyframes copied to keyframes copy/paste buffer"); return false; } @@ -414,26 +416,26 @@ bool ED_gpencil_anim_copybuf_paste(bAnimContext *ac, const short offset_mode) int offset = 0; /* check if buffer is empty */ - if (BLI_listbase_is_empty(&gp_anim_copybuf)) { + if (BLI_listbase_is_empty(&gpencil_anim_copybuf)) { BKE_report(ac->reports, RPT_ERROR, "No data in buffer to paste"); return false; } /* check if single channel in buffer (disregard names if so) */ - if (gp_anim_copybuf.first == gp_anim_copybuf.last) { + if (gpencil_anim_copybuf.first == gpencil_anim_copybuf.last) { no_name = true; } /* methods of offset (eKeyPasteOffset) */ switch (offset_mode) { case KEYFRAME_PASTE_OFFSET_CFRA_START: - offset = (CFRA - gp_anim_copy_firstframe); + offset = (CFRA - gpencil_anim_copy_firstframe); break; case KEYFRAME_PASTE_OFFSET_CFRA_END: - offset = (CFRA - gp_anim_copy_lastframe); + offset = (CFRA - gpencil_anim_copy_lastframe); break; case KEYFRAME_PASTE_OFFSET_CFRA_RELATIVE: - offset = (CFRA - gp_anim_copy_cfra); + offset = (CFRA - gpencil_anim_copy_cfra); break; case KEYFRAME_PASTE_OFFSET_NONE: offset = 0; @@ -453,7 +455,7 @@ bool ED_gpencil_anim_copybuf_paste(bAnimContext *ac, const short offset_mode) bGPDframe *gpfs, *gpf; /* find suitable layer from buffer to use to paste from */ - for (gpls = gp_anim_copybuf.first; gpls; gpls = gpls->next) { + for (gpls = gpencil_anim_copybuf.first; gpls; gpls = gpls->next) { /* check if layer name matches */ if ((no_name) || STREQ(gpls->info, gpld->info)) { break; @@ -509,7 +511,7 @@ bool ED_gpencil_anim_copybuf_paste(bAnimContext *ac, const short offset_mode) /* -------------------------------------- */ /* Snap Tools */ -static short snap_gpf_nearest(bGPDframe *UNUSED(gpf), Scene *UNUSED(scene)) +static short gpencil_frame_snap_nearest(bGPDframe *UNUSED(gpf), Scene *UNUSED(scene)) { #if 0 /* note: gpf->framenum is already an int! */ if (gpf->flag & GP_FRAME_SELECT) { @@ -519,7 +521,7 @@ static short snap_gpf_nearest(bGPDframe *UNUSED(gpf), Scene *UNUSED(scene)) return 0; } -static short snap_gpf_nearestsec(bGPDframe *gpf, Scene *scene) +static short gpencil_frame_snap_nearestsec(bGPDframe *gpf, Scene *scene) { float secf = (float)FPS; if (gpf->flag & GP_FRAME_SELECT) { @@ -528,7 +530,7 @@ static short snap_gpf_nearestsec(bGPDframe *gpf, Scene *scene) return 0; } -static short snap_gpf_cframe(bGPDframe *gpf, Scene *scene) +static short gpencil_frame_snap_cframe(bGPDframe *gpf, Scene *scene) { if (gpf->flag & GP_FRAME_SELECT) { gpf->framenum = (int)CFRA; @@ -536,7 +538,7 @@ static short snap_gpf_cframe(bGPDframe *gpf, Scene *scene) return 0; } -static short snap_gpf_nearmarker(bGPDframe *gpf, Scene *scene) +static short gpencil_frame_snap_nearmarker(bGPDframe *gpf, Scene *scene) { if (gpf->flag & GP_FRAME_SELECT) { gpf->framenum = (int)ED_markers_find_nearest_marker_time(&scene->markers, @@ -546,20 +548,20 @@ static short snap_gpf_nearmarker(bGPDframe *gpf, Scene *scene) } /* snap selected frames to ... */ -void ED_gplayer_snap_frames(bGPDlayer *gpl, Scene *scene, short mode) +void ED_gpencil_layer_snap_frames(bGPDlayer *gpl, Scene *scene, short mode) { switch (mode) { case SNAP_KEYS_NEARFRAME: /* snap to nearest frame */ - ED_gplayer_frames_looper(gpl, scene, snap_gpf_nearest); + ED_gpencil_layer_frames_looper(gpl, scene, gpencil_frame_snap_nearest); break; case SNAP_KEYS_CURFRAME: /* snap to current frame */ - ED_gplayer_frames_looper(gpl, scene, snap_gpf_cframe); + ED_gpencil_layer_frames_looper(gpl, scene, gpencil_frame_snap_cframe); break; case SNAP_KEYS_NEARMARKER: /* snap to nearest marker */ - ED_gplayer_frames_looper(gpl, scene, snap_gpf_nearmarker); + ED_gpencil_layer_frames_looper(gpl, scene, gpencil_frame_snap_nearmarker); break; case SNAP_KEYS_NEARSEC: /* snap to nearest second */ - ED_gplayer_frames_looper(gpl, scene, snap_gpf_nearestsec); + ED_gpencil_layer_frames_looper(gpl, scene, gpencil_frame_snap_nearestsec); break; default: /* just in case */ break; @@ -569,7 +571,7 @@ void ED_gplayer_snap_frames(bGPDlayer *gpl, Scene *scene, short mode) /* -------------------------------------- */ /* Mirror Tools */ -static short mirror_gpf_cframe(bGPDframe *gpf, Scene *scene) +static short gpencil_frame_mirror_cframe(bGPDframe *gpf, Scene *scene) { int diff; @@ -581,7 +583,7 @@ static short mirror_gpf_cframe(bGPDframe *gpf, Scene *scene) return 0; } -static short mirror_gpf_yaxis(bGPDframe *gpf, Scene *UNUSED(scene)) +static short gpencil_frame_mirror_yaxis(bGPDframe *gpf, Scene *UNUSED(scene)) { int diff; @@ -593,7 +595,7 @@ static short mirror_gpf_yaxis(bGPDframe *gpf, Scene *UNUSED(scene)) return 0; } -static short mirror_gpf_xaxis(bGPDframe *gpf, Scene *UNUSED(scene)) +static short gpencil_frame_mirror_xaxis(bGPDframe *gpf, Scene *UNUSED(scene)) { int diff; @@ -606,7 +608,7 @@ static short mirror_gpf_xaxis(bGPDframe *gpf, Scene *UNUSED(scene)) return 0; } -static short mirror_gpf_marker(bGPDframe *gpf, Scene *scene) +static short gpencil_frame_mirror_marker(bGPDframe *gpf, Scene *scene) { static TimeMarker *marker; static short initialized = 0; @@ -648,25 +650,25 @@ static short mirror_gpf_marker(bGPDframe *gpf, Scene *scene) /* mirror selected gp-frames on... */ // TODO: mirror over a specific time -void ED_gplayer_mirror_frames(bGPDlayer *gpl, Scene *scene, short mode) +void ED_gpencil_layer_mirror_frames(bGPDlayer *gpl, Scene *scene, short mode) { switch (mode) { case MIRROR_KEYS_CURFRAME: /* mirror over current frame */ - ED_gplayer_frames_looper(gpl, scene, mirror_gpf_cframe); + ED_gpencil_layer_frames_looper(gpl, scene, gpencil_frame_mirror_cframe); break; case MIRROR_KEYS_YAXIS: /* mirror over frame 0 */ - ED_gplayer_frames_looper(gpl, scene, mirror_gpf_yaxis); + ED_gpencil_layer_frames_looper(gpl, scene, gpencil_frame_mirror_yaxis); break; case MIRROR_KEYS_XAXIS: /* mirror over value 0 */ - ED_gplayer_frames_looper(gpl, scene, mirror_gpf_xaxis); + ED_gpencil_layer_frames_looper(gpl, scene, gpencil_frame_mirror_xaxis); break; case MIRROR_KEYS_MARKER: /* mirror over marker */ - mirror_gpf_marker(NULL, scene); - ED_gplayer_frames_looper(gpl, scene, mirror_gpf_marker); - mirror_gpf_marker(NULL, scene); + gpencil_frame_mirror_marker(NULL, scene); + ED_gpencil_layer_frames_looper(gpl, scene, gpencil_frame_mirror_marker); + gpencil_frame_mirror_marker(NULL, scene); break; default: /* just in case */ - ED_gplayer_frames_looper(gpl, scene, mirror_gpf_yaxis); + ED_gpencil_layer_frames_looper(gpl, scene, gpencil_frame_mirror_yaxis); break; } } diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c index 75249fbdd06..49b97b1df66 100644 --- a/source/blender/editors/gpencil/gpencil_convert.c +++ b/source/blender/editors/gpencil/gpencil_convert.c @@ -1817,7 +1817,7 @@ static int image_to_gpencil_exec(bContext *C, wmOperator *op) if (done) { /* Delete any selected point. */ LISTBASE_FOREACH_MUTABLE (bGPDstroke *, gps, &gpf->strokes) { - gp_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_SELECT, false, 0); + gpencil_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_SELECT, false, 0); } BKE_reportf(op->reports, RPT_INFO, "Object created"); diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index 8c80334bf8a..9e929a8997b 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -269,7 +269,7 @@ void GPENCIL_OT_layer_add(wmOperatorType *ot) /* callbacks */ ot->exec = gp_layer_add_exec; - ot->poll = gp_add_poll; + ot->poll = gpencil_add_poll; } static bool gp_add_annotation_poll(bContext *C) @@ -346,7 +346,7 @@ void GPENCIL_OT_layer_remove(wmOperatorType *ot) /* callbacks */ ot->exec = gp_layer_remove_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; } static bool gp_active_layer_annotation_poll(bContext *C) @@ -419,7 +419,7 @@ void GPENCIL_OT_layer_move(wmOperatorType *ot) /* api callbacks */ ot->exec = gp_layer_move_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -492,7 +492,7 @@ void GPENCIL_OT_layer_duplicate(wmOperatorType *ot) /* callbacks */ ot->exec = gp_layer_copy_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -686,7 +686,7 @@ void GPENCIL_OT_frame_duplicate(wmOperatorType *ot) /* callbacks */ ot->exec = gp_frame_duplicate_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -771,7 +771,7 @@ void GPENCIL_OT_frame_clean_fill(wmOperatorType *ot) /* callbacks */ ot->exec = gp_frame_clean_fill_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -847,7 +847,7 @@ void GPENCIL_OT_frame_clean_loose(wmOperatorType *ot) /* callbacks */ ot->exec = gp_frame_clean_loose_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -909,7 +909,7 @@ void GPENCIL_OT_hide(wmOperatorType *ot) /* callbacks */ ot->exec = gp_hide_exec; - ot->poll = gp_active_layer_poll; /* NOTE: we need an active layer to play with */ + ot->poll = gpencil_active_layer_poll; /* NOTE: we need an active layer to play with */ /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1154,7 +1154,7 @@ void GPENCIL_OT_layer_isolate(wmOperatorType *ot) /* callbacks */ ot->exec = gp_isolate_layer_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1243,7 +1243,7 @@ void GPENCIL_OT_layer_merge(wmOperatorType *ot) /* callbacks */ ot->exec = gp_merge_layer_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1308,7 +1308,7 @@ void GPENCIL_OT_layer_change(wmOperatorType *ot) /* callbacks */ ot->invoke = gp_layer_change_invoke; ot->exec = gp_layer_change_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1353,7 +1353,7 @@ void GPENCIL_OT_layer_active(wmOperatorType *ot) /* callbacks */ ot->exec = gp_layer_active_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1504,7 +1504,7 @@ void GPENCIL_OT_stroke_arrange(wmOperatorType *ot) /* callbacks */ ot->exec = gp_stroke_arrange_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1600,7 +1600,7 @@ void GPENCIL_OT_stroke_change_color(wmOperatorType *ot) /* callbacks */ ot->exec = gp_stroke_change_color_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -1675,7 +1675,7 @@ void GPENCIL_OT_material_lock_unused(wmOperatorType *ot) /* api callbacks */ ot->exec = gp_material_lock_unsused_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -2856,7 +2856,7 @@ void GPENCIL_OT_lock_layer(wmOperatorType *ot) /* api callbacks */ ot->exec = gpencil_lock_layer_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; } /* ********************** Isolate gpencil_ color **************************** */ @@ -3477,7 +3477,7 @@ void GPENCIL_OT_layer_mask_add(wmOperatorType *ot) /* callbacks */ ot->exec = gp_layer_mask_add_exec; - ot->poll = gp_add_poll; + ot->poll = gpencil_add_poll; /* properties */ RNA_def_string(ot->srna, "name", NULL, 128, "Layer", "Name of the layer"); @@ -3526,5 +3526,5 @@ void GPENCIL_OT_layer_mask_remove(wmOperatorType *ot) /* callbacks */ ot->exec = gp_layer_mask_remove_exec; - ot->poll = gp_active_layer_poll; + 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 54782ba683d..8c738917722 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -1216,7 +1216,7 @@ void GPENCIL_OT_extrude(wmOperatorType *ot) /* list of bGPDstroke instances */ /* NOTE: is exposed within the editors/gpencil module so that other tools can use it too */ -ListBase gp_strokes_copypastebuf = {NULL, NULL}; +ListBase gpencil_strokes_copypastebuf = {NULL, NULL}; /* Hash for hanging on to all the colors used by strokes in the buffer * @@ -1273,7 +1273,7 @@ void ED_gpencil_strokes_copybuf_free(void) } /* Free the stroke buffer */ - for (gps = gp_strokes_copypastebuf.first; gps; gps = gpsn) { + for (gps = gpencil_strokes_copypastebuf.first; gps; gps = gpsn) { gpsn = gps->next; if (gps->points) { @@ -1286,17 +1286,17 @@ void ED_gpencil_strokes_copybuf_free(void) MEM_SAFE_FREE(gps->triangles); - BLI_freelinkN(&gp_strokes_copypastebuf, gps); + BLI_freelinkN(&gpencil_strokes_copypastebuf, gps); } - gp_strokes_copypastebuf.first = gp_strokes_copypastebuf.last = NULL; + gpencil_strokes_copypastebuf.first = gpencil_strokes_copypastebuf.last = NULL; } /** * Ensure that destination datablock has all the colors the pasted strokes need. * Helper function for copy-pasting strokes */ -GHash *gp_copybuf_validate_colormap(bContext *C) +GHash *gpencil_copybuf_validate_colormap(bContext *C) { Main *bmain = CTX_data_main(C); Object *ob = CTX_data_active_object(C); @@ -1389,11 +1389,11 @@ static int gp_strokes_copy_exec(bContext *C, wmOperator *op) /* add to temp buffer */ gpsd->next = gpsd->prev = NULL; - BLI_addtail(&gp_strokes_copypastebuf, gpsd); + BLI_addtail(&gpencil_strokes_copypastebuf, gpsd); } else { /* delegate to a helper, as there's too much to fit in here (for copying subsets)... */ - gp_duplicate_points(gps, &gp_strokes_copypastebuf, gpl->info); + gp_duplicate_points(gps, &gpencil_strokes_copypastebuf, gpl->info); } } } @@ -1401,10 +1401,10 @@ static int gp_strokes_copy_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* Build up hash of material colors used in these strokes */ - if (gp_strokes_copypastebuf.first) { + 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); - LISTBASE_FOREACH (bGPDstroke *, gps, &gp_strokes_copypastebuf) { + 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); /* Avoid default material. */ @@ -1464,7 +1464,7 @@ static bool gp_strokes_paste_poll(bContext *C) * 2) Copy buffer must at least have something (though it may be the wrong sort...). */ return (ED_gpencil_data_get_active(C) != NULL) && - (!BLI_listbase_is_empty(&gp_strokes_copypastebuf)); + (!BLI_listbase_is_empty(&gpencil_strokes_copypastebuf)); } typedef enum eGP_PasteMode { @@ -1489,7 +1489,7 @@ static int gp_strokes_paste_exec(bContext *C, wmOperator *op) BKE_report(op->reports, RPT_ERROR, "Operator not supported in multiframe edition"); return OPERATOR_CANCELLED; } - else if (BLI_listbase_is_empty(&gp_strokes_copypastebuf)) { + else if (BLI_listbase_is_empty(&gpencil_strokes_copypastebuf)) { BKE_report(op->reports, RPT_ERROR, "No strokes to paste, select and copy some points before trying again"); @@ -1509,7 +1509,7 @@ static int gp_strokes_paste_exec(bContext *C, wmOperator *op) bGPDstroke *gps; bool ok = false; - for (gps = gp_strokes_copypastebuf.first; gps; gps = gps->next) { + for (gps = gpencil_strokes_copypastebuf.first; gps; gps = gps->next) { if (ED_gpencil_stroke_can_use(C, gps)) { ok = true; break; @@ -1535,10 +1535,11 @@ static int gp_strokes_paste_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* Ensure that all the necessary colors exist */ - new_colors = gp_copybuf_validate_colormap(C); + new_colors = gpencil_copybuf_validate_colormap(C); /* Copy over the strokes from the buffer (and adjust the colors) */ - bGPDstroke *gps_init = (!on_back) ? gp_strokes_copypastebuf.first : gp_strokes_copypastebuf.last; + bGPDstroke *gps_init = (!on_back) ? gpencil_strokes_copypastebuf.first : + gpencil_strokes_copypastebuf.last; for (bGPDstroke *gps = gps_init; gps; gps = (!on_back) ? gps->next : gps->prev) { if (ED_gpencil_stroke_can_use(C, gps)) { /* Need to verify if layer exists */ @@ -1809,7 +1810,7 @@ void GPENCIL_OT_blank_frame_add(wmOperatorType *ot) /* callbacks */ ot->exec = gp_blank_frame_add_exec; - ot->poll = gp_add_poll; + ot->poll = gpencil_add_poll; ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -2382,12 +2383,12 @@ static void gp_stroke_join_islands(bGPDframe *gpf, bGPDstroke *gps_first, bGPDst * 2) Each island gets converted to a new stroke * If the number of points is <= limit, the stroke is deleted */ -void gp_stroke_delete_tagged_points(bGPDframe *gpf, - bGPDstroke *gps, - bGPDstroke *next_stroke, - int tag_flags, - bool select, - int limit) +void gpencil_stroke_delete_tagged_points(bGPDframe *gpf, + bGPDstroke *gps, + bGPDstroke *next_stroke, + int tag_flags, + bool select, + int limit) { tGPDeleteIsland *islands = MEM_callocN(sizeof(tGPDeleteIsland) * (gps->totpoints + 1) / 2, "gp_point_islands"); @@ -2564,7 +2565,7 @@ static int gp_delete_selected_points(bContext *C) gps->flag &= ~GP_STROKE_SELECT; /* delete unwanted points by splitting stroke into several smaller ones */ - gp_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_SELECT, false, 0); + gpencil_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_SELECT, false, 0); changed = true; } @@ -2585,7 +2586,7 @@ static int gp_delete_selected_points(bContext *C) } /* simple wrapper to external call */ -int gp_delete_selected_point_wrap(bContext *C) +int gpencil_delete_selected_point_wrap(bContext *C) { return gp_delete_selected_points(C); } @@ -2766,7 +2767,7 @@ static int gp_snap_to_grid(bContext *C, wmOperator *UNUSED(op)) /* return data */ copy_v3_v3(&pt->x, fpt); - gp_apply_parent_point(depsgraph, obact, gpl, pt); + gpencil_apply_parent_point(depsgraph, obact, gpl, pt); } } } @@ -2854,7 +2855,7 @@ static int gp_snap_to_cursor(bContext *C, wmOperator *op) for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { if (pt->flag & GP_SPOINT_SELECT) { copy_v3_v3(&pt->x, cursor_global); - gp_apply_parent_point(depsgraph, obact, gpl, pt); + gpencil_apply_parent_point(depsgraph, obact, gpl, pt); } } } @@ -3036,7 +3037,7 @@ void GPENCIL_OT_stroke_apply_thickness(wmOperatorType *ot) /* api callbacks */ ot->exec = gp_stroke_apply_thickness_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; } /** \} */ @@ -3151,7 +3152,7 @@ void GPENCIL_OT_stroke_cyclical_set(wmOperatorType *ot) /* api callbacks */ ot->exec = gp_stroke_cyclical_set_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -3254,7 +3255,7 @@ void GPENCIL_OT_stroke_caps_set(wmOperatorType *ot) /* api callbacks */ ot->exec = gp_stroke_caps_set_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -3553,7 +3554,7 @@ void GPENCIL_OT_stroke_join(wmOperatorType *ot) /* api callbacks */ ot->exec = gp_stroke_join_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -3624,7 +3625,7 @@ void GPENCIL_OT_stroke_flip(wmOperatorType *ot) /* api callbacks */ ot->exec = gp_stroke_flip_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -3650,7 +3651,7 @@ static int gp_strokes_reproject_exec(bContext *C, wmOperator *op) /* Init space conversion stuff. */ GP_SpaceConversion gsc = {NULL}; SnapObjectContext *sctx = NULL; - gp_point_conversion_init(C, &gsc); + gpencil_point_conversion_init(C, &gsc); /* Init snap context for geometry projection. */ sctx = ED_transform_snap_object_context_create_view3d(scene, 0, region, CTX_wm_view3d(C)); @@ -3769,7 +3770,7 @@ void GPENCIL_OT_recalc_geometry(wmOperatorType *ot) /* callbacks */ ot->exec = gp_recalc_geometry_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -3988,7 +3989,7 @@ void GPENCIL_OT_stroke_subdivide(wmOperatorType *ot) /* api callbacks */ ot->exec = gp_stroke_subdivide_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -4051,7 +4052,7 @@ void GPENCIL_OT_stroke_simplify(wmOperatorType *ot) /* api callbacks */ ot->exec = gp_stroke_simplify_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -4101,7 +4102,7 @@ void GPENCIL_OT_stroke_simplify_fixed(wmOperatorType *ot) /* api callbacks */ ot->exec = gp_stroke_simplify_fixed_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -4150,7 +4151,7 @@ void GPENCIL_OT_stroke_sample(wmOperatorType *ot) /* api callbacks */ ot->exec = gp_stroke_sample_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -4225,7 +4226,7 @@ void GPENCIL_OT_stroke_trim(wmOperatorType *ot) /* api callbacks */ ot->exec = gp_stroke_trim_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -4350,10 +4351,12 @@ static int gp_stroke_separate_exec(bContext *C, wmOperator *op) } /* delete selected points from destination stroke */ - gp_stroke_delete_tagged_points(gpf_dst, gps_dst, NULL, GP_SPOINT_SELECT, false, 0); + gpencil_stroke_delete_tagged_points( + gpf_dst, gps_dst, NULL, GP_SPOINT_SELECT, false, 0); /* delete selected points from origin stroke */ - gp_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_SELECT, false, 0); + gpencil_stroke_delete_tagged_points( + gpf, gps, gps->next, GP_SPOINT_SELECT, false, 0); } /* selected strokes mode */ else if (mode == GP_SEPARATE_STROKE) { @@ -4508,10 +4511,10 @@ static int gp_stroke_split_exec(bContext *C, wmOperator *UNUSED(op)) } /* delete selected points from destination stroke */ - gp_stroke_delete_tagged_points(gpf, gps_dst, NULL, GP_SPOINT_SELECT, true, 0); + gpencil_stroke_delete_tagged_points(gpf, gps_dst, NULL, GP_SPOINT_SELECT, true, 0); /* delete selected points from origin stroke */ - gp_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_SELECT, false, 0); + gpencil_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_SELECT, false, 0); } } /* select again tagged points */ @@ -4591,7 +4594,7 @@ void GPENCIL_OT_stroke_smooth(wmOperatorType *ot) /* api callbacks */ ot->exec = gp_stroke_smooth_exec; - ot->poll = gp_active_layer_poll; + ot->poll = gpencil_active_layer_poll; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; @@ -4634,8 +4637,8 @@ static bool gpencil_test_lasso(bGPDstroke *gps, const struct GP_SelectLassoUserData *data = user_data; bGPDspoint pt2; int x0, y0; - gp_point_to_parent_space(pt, diff_mat, &pt2); - gp_point_to_xy(gsc, gps, &pt2, &x0, &y0); + gpencil_point_to_parent_space(pt, diff_mat, &pt2); + gpencil_point_to_xy(gsc, gps, &pt2, &x0, &y0); /* test if in lasso */ return ((!ELEM(V2D_IS_CLIPPED, x0, y0)) && BLI_rcti_isect_pt(&data->rect, x0, y0) && BLI_lasso_is_point_inside(data->mcoords, data->mcoords_len, x0, y0, INT_MAX)); @@ -4691,7 +4694,8 @@ static void gpencil_cutter_dissolve(bGPDlayer *hit_layer, bGPDstroke *hit_stroke pt->flag &= ~GP_SPOINT_TAG; } } - gp_stroke_delete_tagged_points(hit_layer->actframe, hit_stroke, gpsn, GP_SPOINT_TAG, false, 1); + gpencil_stroke_delete_tagged_points( + hit_layer->actframe, hit_stroke, gpsn, GP_SPOINT_TAG, false, 1); } } @@ -4718,7 +4722,7 @@ static int gpencil_cutter_lasso_select(bContext *C, } /* init space conversion stuff */ - gp_point_conversion_init(C, &gsc); + gpencil_point_conversion_init(C, &gsc); /* deselect all strokes first */ CTX_DATA_BEGIN (C, bGPDstroke *, gps, editable_gpencil_strokes) { diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index ab52a484d2f..70c340c6750 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -298,7 +298,7 @@ static void gp_draw_datablock(tGPDfill *tgpf, const float ink[4]) /* normal strokes */ if ((tgpf->fill_draw_mode == GP_FILL_DMODE_STROKE) || (tgpf->fill_draw_mode == GP_FILL_DMODE_BOTH)) { - ED_gp_draw_fill(&tgpw); + ED_gpencil_draw_fill(&tgpw); } /* 3D Lines with basic shapes and invisible lines */ @@ -1139,12 +1139,12 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf) for (int i = 0; i < tgpf->sbuffer_used && point2D; i++, point2D++, pt++) { /* convert screen-coordinates to 3D coordinates */ - gp_stroke_convertcoords_tpoint(tgpf->scene, - tgpf->region, - tgpf->ob, - point2D, - tgpf->depth_arr ? tgpf->depth_arr + i : NULL, - &pt->x); + gpencil_stroke_convertcoords_tpoint(tgpf->scene, + tgpf->region, + tgpf->ob, + point2D, + tgpf->depth_arr ? tgpf->depth_arr + i : NULL, + &pt->x); pt->pressure = 1.0f; pt->strength = 1.0f; @@ -1192,7 +1192,7 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf) /* if parented change position relative to parent object */ for (int a = 0; a < tgpf->sbuffer_used; a++) { pt = &gps->points[a]; - gp_apply_parent_point(tgpf->depsgraph, tgpf->ob, tgpf->gpl, pt); + gpencil_apply_parent_point(tgpf->depsgraph, tgpf->ob, tgpf->gpl, pt); } /* if camera view, reproject flat to view to avoid perspective effect */ diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index bc46842bb3b..bd697dbc768 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -248,7 +248,7 @@ typedef struct tGPDprimitive { } tGPDprimitive; /* Modal Operator Drawing Callbacks ------------------------ */ -void ED_gp_draw_fill(struct tGPDdraw *tgpw); +void ED_gpencil_draw_fill(struct tGPDdraw *tgpw); /* ***************************************************** */ /* Internal API */ @@ -272,83 +272,85 @@ typedef struct GP_SpaceConversion { float mat[4][4]; /* transform matrix on the strokes (introduced in [b770964]) */ } GP_SpaceConversion; -bool gp_stroke_inside_circle(const float mval[2], int rad, int x0, int y0, int x1, int y1); +bool gpencil_stroke_inside_circle(const float mval[2], int rad, int x0, int y0, int x1, int y1); -void gp_point_conversion_init(struct bContext *C, GP_SpaceConversion *r_gsc); +void gpencil_point_conversion_init(struct bContext *C, GP_SpaceConversion *r_gsc); -void gp_point_to_xy(const GP_SpaceConversion *gsc, - const struct bGPDstroke *gps, - const struct bGPDspoint *pt, - int *r_x, - int *r_y); +void gpencil_point_to_xy(const GP_SpaceConversion *gsc, + const struct bGPDstroke *gps, + const struct bGPDspoint *pt, + int *r_x, + int *r_y); -void gp_point_to_xy_fl(const GP_SpaceConversion *gsc, - const bGPDstroke *gps, - const bGPDspoint *pt, - float *r_x, - float *r_y); +void gpencil_point_to_xy_fl(const GP_SpaceConversion *gsc, + const bGPDstroke *gps, + const bGPDspoint *pt, + float *r_x, + float *r_y); -void gp_point_to_parent_space(const bGPDspoint *pt, const float diff_mat[4][4], bGPDspoint *r_pt); +void gpencil_point_to_parent_space(const bGPDspoint *pt, + const float diff_mat[4][4], + bGPDspoint *r_pt); /** * Change points position relative to parent object */ -void gp_apply_parent(struct Depsgraph *depsgraph, - struct Object *obact, - bGPDlayer *gpl, - bGPDstroke *gps); +void gpencil_apply_parent(struct Depsgraph *depsgraph, + struct Object *obact, + bGPDlayer *gpl, + bGPDstroke *gps); /** * Change point position relative to parent object */ -void gp_apply_parent_point(struct Depsgraph *depsgraph, - struct Object *obact, - bGPDlayer *gpl, - bGPDspoint *pt); +void gpencil_apply_parent_point(struct Depsgraph *depsgraph, + struct Object *obact, + bGPDlayer *gpl, + bGPDspoint *pt); -void gp_point_3d_to_xy(const GP_SpaceConversion *gsc, - const short flag, - const float pt[3], - float xy[2]); +void gpencil_point_3d_to_xy(const GP_SpaceConversion *gsc, + const short flag, + const float pt[3], + float xy[2]); -bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc, - struct Scene *scene, - const float screen_co[2], - float r_out[3]); +bool gpencil_point_xy_to_3d(const GP_SpaceConversion *gsc, + struct Scene *scene, + const float screen_co[2], + float r_out[3]); /* helper to convert 2d to 3d */ -void gp_stroke_convertcoords_tpoint(struct Scene *scene, - struct ARegion *region, - struct Object *ob, - const struct tGPspoint *point2D, - float *depth, - float out[3]); +void gpencil_stroke_convertcoords_tpoint(struct Scene *scene, + struct ARegion *region, + struct Object *ob, + const struct tGPspoint *point2D, + float *depth, + float out[3]); /* Poll Callbacks ------------------------------------ */ /* gpencil_utils.c */ -bool gp_add_poll(struct bContext *C); -bool gp_active_layer_poll(struct bContext *C); -bool gp_active_brush_poll(struct bContext *C); -bool gp_brush_crt_presets_poll(bContext *C); +bool gpencil_add_poll(struct bContext *C); +bool gpencil_active_layer_poll(struct bContext *C); +bool gpencil_active_brush_poll(struct bContext *C); +bool gpencil_brush_create_presets_poll(bContext *C); /* Copy/Paste Buffer --------------------------------- */ /* gpencil_edit.c */ -extern ListBase gp_strokes_copypastebuf; +extern ListBase gpencil_strokes_copypastebuf; /* Build a map for converting between old colornames and destination-color-refs */ -struct GHash *gp_copybuf_validate_colormap(struct bContext *C); +struct GHash *gpencil_copybuf_validate_colormap(struct bContext *C); /* Stroke Editing ------------------------------------ */ -void gp_stroke_delete_tagged_points(bGPDframe *gpf, - bGPDstroke *gps, - bGPDstroke *next_stroke, - int tag_flags, - bool select, - int limit); -int gp_delete_selected_point_wrap(bContext *C); +void gpencil_stroke_delete_tagged_points(bGPDframe *gpf, + bGPDstroke *gps, + bGPDstroke *next_stroke, + int tag_flags, + bool select, + int limit); +int gpencil_delete_selected_point_wrap(bContext *C); -void gp_subdivide_stroke(bGPDstroke *gps, const int subdivide); +void gpencil_subdivide_stroke(bGPDstroke *gps, const int subdivide); /* Layers Enums -------------------------------------- */ diff --git a/source/blender/editors/gpencil/gpencil_merge.c b/source/blender/editors/gpencil/gpencil_merge.c index e609890b23c..26eec030803 100644 --- a/source/blender/editors/gpencil/gpencil_merge.c +++ b/source/blender/editors/gpencil/gpencil_merge.c @@ -178,7 +178,7 @@ static void gpencil_dissolve_points(bContext *C) } LISTBASE_FOREACH_MUTABLE (bGPDstroke *, gps, &gpf->strokes) { - gp_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_TAG, false, 0); + gpencil_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_TAG, false, 0); } } CTX_DATA_END; diff --git a/source/blender/editors/gpencil/gpencil_mesh.c b/source/blender/editors/gpencil/gpencil_mesh.c index ffb12404b43..03b6252e9ba 100644 --- a/source/blender/editors/gpencil/gpencil_mesh.c +++ b/source/blender/editors/gpencil/gpencil_mesh.c @@ -216,7 +216,7 @@ static int gp_bake_mesh_animation_exec(bContext *C, wmOperator *op) SnapObjectContext *sctx = NULL; if (project_type != GP_REPROJECT_KEEP) { /* Init space conversion stuff. */ - gp_point_conversion_init(C, &gsc); + gpencil_point_conversion_init(C, &gsc); /* Init snap context for geometry projection. */ sctx = ED_transform_snap_object_context_create_view3d(scene, 0, region, CTX_wm_view3d(C)); diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index e3512b8660f..a1961ea1630 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1082,7 +1082,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) pt = gps->points; for (i = 0; i < gps->totpoints; i++, pt++) { /* if parented change position relative to parent object */ - gp_apply_parent_point(depsgraph, obact, gpl, pt); + gpencil_apply_parent_point(depsgraph, obact, gpl, pt); } /* if camera view, reproject flat to view to avoid perspective effect */ @@ -1195,7 +1195,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) /* subdivide and smooth the stroke */ if ((brush->gpencil_settings->flag & GP_BRUSH_GROUP_SETTINGS) && (subdivide > 0)) { - gp_subdivide_stroke(gps, subdivide); + gpencil_subdivide_stroke(gps, subdivide); } /* Smooth stroke after subdiv - only if there's something to do for each iteration, @@ -1232,7 +1232,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) /* reproject to plane (only in 3d space) */ gp_reproject_toplane(p, gps); /* change position relative to parent object */ - gp_apply_parent(depsgraph, obact, gpl, gps); + gpencil_apply_parent(depsgraph, obact, gpl, gps); /* if camera view, reproject flat to view to avoid perspective effect */ if (is_camera) { ED_gpencil_project_stroke_to_view(p->C, p->gpl, gps); @@ -1456,8 +1456,8 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, /* only process if it hasn't been masked out... */ if (!(p->flags & GP_PAINTFLAG_SELECTMASK) || (gps->points->flag & GP_SPOINT_SELECT)) { bGPDspoint pt_temp; - gp_point_to_parent_space(gps->points, p->diff_mat, &pt_temp); - gp_point_to_xy(&p->gsc, gps, &pt_temp, &pc1[0], &pc1[1]); + gpencil_point_to_parent_space(gps->points, p->diff_mat, &pt_temp); + gpencil_point_to_xy(&p->gsc, gps, &pt_temp, &pc1[0], &pc1[1]); /* do boundbox check first */ if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) { /* only check if point is inside */ @@ -1480,8 +1480,8 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, /* get points to work with */ pt1 = gps->points + i; bGPDspoint npt; - gp_point_to_parent_space(pt1, p->diff_mat, &npt); - gp_point_to_xy(&p->gsc, gps, &npt, &pc1[0], &pc1[1]); + gpencil_point_to_parent_space(pt1, p->diff_mat, &npt); + gpencil_point_to_xy(&p->gsc, gps, &npt, &pc1[0], &pc1[1]); /* do boundbox check first */ if ((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) { @@ -1532,19 +1532,19 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, bGPDspoint npt; if (pt0) { - gp_point_to_parent_space(pt0, p->diff_mat, &npt); - gp_point_to_xy(&p->gsc, gps, &npt, &pc0[0], &pc0[1]); + gpencil_point_to_parent_space(pt0, p->diff_mat, &npt); + gpencil_point_to_xy(&p->gsc, gps, &npt, &pc0[0], &pc0[1]); } else { /* avoid null values */ copy_v2_v2_int(pc0, pc1); } - gp_point_to_parent_space(pt1, p->diff_mat, &npt); - gp_point_to_xy(&p->gsc, gps, &npt, &pc1[0], &pc1[1]); + gpencil_point_to_parent_space(pt1, p->diff_mat, &npt); + gpencil_point_to_xy(&p->gsc, gps, &npt, &pc1[0], &pc1[1]); - gp_point_to_parent_space(pt2, p->diff_mat, &npt); - gp_point_to_xy(&p->gsc, gps, &npt, &pc2[0], &pc2[1]); + gpencil_point_to_parent_space(pt2, p->diff_mat, &npt); + gpencil_point_to_xy(&p->gsc, gps, &npt, &pc2[0], &pc2[1]); /* Check that point segment of the boundbox of the eraser stroke */ if (((!ELEM(V2D_IS_CLIPPED, pc0[0], pc0[1])) && BLI_rcti_isect_pt(rect, pc0[0], pc0[1])) || @@ -1554,7 +1554,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, * eraser region (either within stroke painted, or on its lines) * - this assumes that linewidth is irrelevant */ - if (gp_stroke_inside_circle(mval, radius, pc0[0], pc0[1], pc2[0], pc2[1])) { + 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)) { @@ -1634,7 +1634,7 @@ static void gp_stroke_eraser_dostroke(tGPsdata *p, gp_stroke_soft_refine(gps); } - gp_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_TAG, false, 0); + gpencil_stroke_delete_tagged_points(gpf, gps, gps->next, GP_SPOINT_TAG, false, 0); } gp_update_cache(p->gpd); } @@ -2564,7 +2564,7 @@ static void gp_origin_get(tGPsdata *p, float origin[2]) copy_v3_v3(location, p->scene->cursor.location); } GP_SpaceConversion *gsc = &p->gsc; - gp_point_3d_to_xy(gsc, p->gpd->runtime.sbuffer_sflag, location, origin); + gpencil_point_3d_to_xy(gsc, p->gpd->runtime.sbuffer_sflag, location, origin); } /* speed guide initial values */ diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c index 82ae99b30be..82746058096 100644 --- a/source/blender/editors/gpencil/gpencil_primitive.c +++ b/source/blender/editors/gpencil/gpencil_primitive.c @@ -1011,7 +1011,7 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi) } /* convert screen-coordinates to 3D coordinates */ - gp_stroke_convertcoords_tpoint( + gpencil_stroke_convertcoords_tpoint( tgpi->scene, tgpi->region, tgpi->ob, p2d, depth_arr ? depth_arr + i : NULL, &pt->x); pt->pressure = pressure; @@ -1036,7 +1036,7 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi) bGPDcontrolpoint *cps = tgpi->gpd->runtime.cp_points; for (int i = 0; i < tgpi->gpd->runtime.tot_cp_points; i++) { bGPDcontrolpoint *cp = &cps[i]; - gp_stroke_convertcoords_tpoint( + gpencil_stroke_convertcoords_tpoint( tgpi->scene, tgpi->region, tgpi->ob, (tGPspoint *)cp, NULL, &cp->x); } } @@ -1052,7 +1052,7 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi) /* if parented change position relative to parent object */ for (int i = 0; i < gps->totpoints; i++) { bGPDspoint *pt = &gps->points[i]; - gp_apply_parent_point(tgpi->depsgraph, tgpi->ob, tgpi->gpl, pt); + gpencil_apply_parent_point(tgpi->depsgraph, tgpi->ob, tgpi->gpl, pt); } /* if camera view, reproject flat to view to avoid perspective effect */ diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c index 6bd945160a6..19d7ae7e483 100644 --- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c +++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c @@ -918,7 +918,7 @@ static void gp_brush_clone_init(bContext *C, tGP_BrushEditData *gso) gso->customdata = data = MEM_callocN(sizeof(tGPSB_CloneBrushData), "CloneBrushData"); /* compute midpoint of strokes on clipboard */ - for (gps = gp_strokes_copypastebuf.first; gps; gps = gps->next) { + for (gps = gpencil_strokes_copypastebuf.first; gps; gps = gps->next) { if (ED_gpencil_stroke_can_use(C, gps)) { const float dfac = 1.0f / ((float)gps->totpoints); float mid[3] = {0.0f}; @@ -954,7 +954,7 @@ static void gp_brush_clone_init(bContext *C, tGP_BrushEditData *gso) /* Init colormap for mapping between the pasted stroke's source color (names) * and the final colors that will be used here instead. */ - data->new_colors = gp_copybuf_validate_colormap(C); + data->new_colors = gpencil_copybuf_validate_colormap(C); } /* Free custom data used for "clone" brush */ @@ -999,7 +999,7 @@ static void gp_brush_clone_add(bContext *C, tGP_BrushEditData *gso) sub_v3_v3v3(delta, gso->dvec, data->buffer_midpoint); /* Copy each stroke into the layer */ - for (gps = gp_strokes_copypastebuf.first; gps; gps = gps->next) { + for (gps = gpencil_strokes_copypastebuf.first; gps; gps = gps->next) { if (ED_gpencil_stroke_can_use(C, gps)) { bGPDstroke *new_stroke; bGPDspoint *pt; @@ -1075,7 +1075,7 @@ static void gp_brush_clone_adjust(tGP_BrushEditData *gso) float influence; /* compute influence on point */ - gp_point_to_xy(&gso->gsc, gps, pt, &sco[0], &sco[1]); + gpencil_point_to_xy(&gso->gsc, gps, pt, &sco[0], &sco[1]); influence = gp_brush_influence_calc(gso, gso->brush->size, sco); /* adjust the amount of displacement to apply */ @@ -1209,7 +1209,7 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op) bool found = false; /* check that there are some usable strokes in the buffer */ - for (gps = gp_strokes_copypastebuf.first; gps; gps = gps->next) { + for (gps = gpencil_strokes_copypastebuf.first; gps; gps = gps->next) { if (ED_gpencil_stroke_can_use(C, gps)) { found = true; break; @@ -1246,7 +1246,7 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op) } /* setup space conversions */ - gp_point_conversion_init(C, &gso->gsc); + gpencil_point_conversion_init(C, &gso->gsc); /* update header */ gpsculpt_brush_header_set(C, gso); @@ -1402,12 +1402,12 @@ static float gpsculpt_rotation_eval_get(tGP_BrushEditData *gso, /* create 2D vectors of the stroke segments */ float v_orig_a[2], v_orig_b[2], v_eval_a[2], v_eval_b[2]; - gp_point_3d_to_xy(gsc, GP_STROKE_3DSPACE, &pt_orig->x, v_orig_a); - gp_point_3d_to_xy(gsc, GP_STROKE_3DSPACE, &pt_orig_prev->x, v_orig_b); + gpencil_point_3d_to_xy(gsc, GP_STROKE_3DSPACE, &pt_orig->x, v_orig_a); + gpencil_point_3d_to_xy(gsc, GP_STROKE_3DSPACE, &pt_orig_prev->x, v_orig_b); sub_v2_v2(v_orig_a, v_orig_b); - gp_point_3d_to_xy(gsc, GP_STROKE_3DSPACE, &pt_eval->x, v_eval_a); - gp_point_3d_to_xy(gsc, GP_STROKE_3DSPACE, &pt_prev_eval->x, v_eval_b); + gpencil_point_3d_to_xy(gsc, GP_STROKE_3DSPACE, &pt_eval->x, v_eval_a); + gpencil_point_3d_to_xy(gsc, GP_STROKE_3DSPACE, &pt_prev_eval->x, v_eval_b); sub_v2_v2(v_eval_a, v_eval_b); return angle_v2v2(v_orig_a, v_eval_a); @@ -1447,8 +1447,8 @@ static bool gpsculpt_brush_do_stroke(tGP_BrushEditData *gso, if (gps->totpoints == 1) { bGPDspoint pt_temp; pt = &gps->points[0]; - gp_point_to_parent_space(gps->points, diff_mat, &pt_temp); - gp_point_to_xy(gsc, gps, &pt_temp, &pc1[0], &pc1[1]); + gpencil_point_to_parent_space(gps->points, diff_mat, &pt_temp); + gpencil_point_to_xy(gsc, gps, &pt_temp, &pc1[0], &pc1[1]); pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; /* do boundbox check first */ @@ -1483,11 +1483,11 @@ static bool gpsculpt_brush_do_stroke(tGP_BrushEditData *gso, } } bGPDspoint npt; - gp_point_to_parent_space(pt1, diff_mat, &npt); - gp_point_to_xy(gsc, gps, &npt, &pc1[0], &pc1[1]); + gpencil_point_to_parent_space(pt1, diff_mat, &npt); + gpencil_point_to_xy(gsc, gps, &npt, &pc1[0], &pc1[1]); - gp_point_to_parent_space(pt2, diff_mat, &npt); - gp_point_to_xy(gsc, gps, &npt, &pc2[0], &pc2[1]); + gpencil_point_to_parent_space(pt2, diff_mat, &npt); + gpencil_point_to_xy(gsc, gps, &npt, &pc2[0], &pc2[1]); /* Check that point segment of the boundbox of the selection stroke */ if (((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) || @@ -1496,7 +1496,7 @@ static bool gpsculpt_brush_do_stroke(tGP_BrushEditData *gso, * brush region (either within stroke painted, or on its lines) * - this assumes that linewidth is irrelevant */ - if (gp_stroke_inside_circle(gso->mval, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { + if (gpencil_stroke_inside_circle(gso->mval, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { /* Apply operation to these points */ bool ok = false; diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c index 93e2a77c727..5e7e3cbe7dd 100644 --- a/source/blender/editors/gpencil/gpencil_select.c +++ b/source/blender/editors/gpencil/gpencil_select.c @@ -881,8 +881,8 @@ static bool gp_stroke_do_circle_sel(bGPdata *UNUSED(gpd), pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; bGPDspoint pt_temp; - gp_point_to_parent_space(pt_active, diff_mat, &pt_temp); - gp_point_to_xy(gsc, gps, &pt_temp, &x0, &y0); + gpencil_point_to_parent_space(pt_active, diff_mat, &pt_temp); + gpencil_point_to_xy(gsc, gps, &pt_temp, &x0, &y0); /* do boundbox check first */ if ((!ELEM(V2D_IS_CLIPPED, x0, y0)) && BLI_rcti_isect_pt(rect, x0, y0)) { @@ -988,7 +988,7 @@ static int gpencil_circle_select_exec(bContext *C, wmOperator *op) } /* init space conversion stuff */ - gp_point_conversion_init(C, &gsc); + gpencil_point_conversion_init(C, &gsc); /* rect is rectangle of selection circle */ rect.xmin = mx - radius; @@ -1102,7 +1102,7 @@ static int gpencil_generic_select_exec( } /* init space conversion stuff */ - gp_point_conversion_init(C, &gsc); + gpencil_point_conversion_init(C, &gsc); /* deselect all strokes first? */ if (SEL_OP_USE_PRE_DESELECT(sel_op) || (GPENCIL_PAINT_MODE(gpd))) { @@ -1200,7 +1200,7 @@ static int gpencil_generic_select_exec( /* if paint mode,delete selected points */ if (GPENCIL_PAINT_MODE(gpd)) { - gp_delete_selected_point_wrap(C); + gpencil_delete_selected_point_wrap(C); changed = true; DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); } @@ -1237,8 +1237,8 @@ static bool gpencil_test_box(bGPDstroke *gps, const struct GP_SelectBoxUserData *data = user_data; bGPDspoint pt2; int x0, y0; - gp_point_to_parent_space(pt, diff_mat, &pt2); - gp_point_to_xy(gsc, gps, &pt2, &x0, &y0); + gpencil_point_to_parent_space(pt, diff_mat, &pt2); + gpencil_point_to_xy(gsc, gps, &pt2, &x0, &y0); return ((!ELEM(V2D_IS_CLIPPED, x0, y0)) && BLI_rcti_isect_pt(&data->rect, x0, y0)); } @@ -1294,8 +1294,8 @@ static bool gpencil_test_lasso(bGPDstroke *gps, const struct GP_SelectLassoUserData *data = user_data; bGPDspoint pt2; int x0, y0; - gp_point_to_parent_space(pt, diff_mat, &pt2); - gp_point_to_xy(gsc, gps, &pt2, &x0, &y0); + gpencil_point_to_parent_space(pt, diff_mat, &pt2); + gpencil_point_to_xy(gsc, gps, &pt2, &x0, &y0); /* test if in lasso boundbox + within the lasso noose */ return ((!ELEM(V2D_IS_CLIPPED, x0, y0)) && BLI_rcti_isect_pt(&data->rect, x0, y0) && BLI_lasso_is_point_inside(data->mcoords, data->mcoords_len, x0, y0, INT_MAX)); @@ -1417,7 +1417,7 @@ static int gpencil_select_exec(bContext *C, wmOperator *op) } /* init space conversion stuff */ - gp_point_conversion_init(C, &gsc); + gpencil_point_conversion_init(C, &gsc); /* get mouse location */ RNA_int_get_array(op->ptr, "location", mval); @@ -1433,8 +1433,8 @@ static int gpencil_select_exec(bContext *C, wmOperator *op) int xy[2]; bGPDspoint pt2; - gp_point_to_parent_space(pt, gpstroke_iter.diff_mat, &pt2); - gp_point_to_xy(&gsc, gps, &pt2, &xy[0], &xy[1]); + gpencil_point_to_parent_space(pt, gpstroke_iter.diff_mat, &pt2); + gpencil_point_to_xy(&gsc, gps, &pt2, &xy[0], &xy[1]); /* do boundbox check first */ if (!ELEM(V2D_IS_CLIPPED, xy[0], xy[1])) { diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 4bb598fa530..a4fcbbb4d6b 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -358,7 +358,7 @@ bool ED_gpencil_has_keyframe_v3d(Scene *UNUSED(scene), Object *ob, int cfra) /* Poll Callbacks */ /* poll callback for adding data/layers - special */ -bool gp_add_poll(bContext *C) +bool gpencil_add_poll(bContext *C) { Object *ob = CTX_data_active_object(C); if (ob == NULL) { @@ -370,7 +370,7 @@ bool gp_add_poll(bContext *C) } /* poll callback for checking if there is an active layer */ -bool gp_active_layer_poll(bContext *C) +bool gpencil_active_layer_poll(bContext *C) { Object *ob = CTX_data_active_object(C); if ((ob == NULL) || (ob->type != OB_GPENCIL)) { @@ -383,7 +383,7 @@ bool gp_active_layer_poll(bContext *C) } /* poll callback for checking if there is an active brush */ -bool gp_active_brush_poll(bContext *C) +bool gpencil_active_brush_poll(bContext *C) { ToolSettings *ts = CTX_data_tool_settings(C); Paint *paint = &ts->gp_paint->paint; @@ -536,7 +536,7 @@ const EnumPropertyItem *ED_gpencil_material_enum_itemf(bContext *C, * \param x0, y0: The screen-space x and y coordinates of the start of the stroke segment * \param x1, y1: The screen-space x and y coordinates of the end of the stroke segment */ -bool gp_stroke_inside_circle(const float mval[2], int rad, int x0, int y0, int x1, int y1) +bool gpencil_stroke_inside_circle(const float mval[2], int rad, int x0, int y0, int x1, int y1) { /* simple within-radius check for now */ const float screen_co_a[2] = {x0, y0}; @@ -614,7 +614,7 @@ bool ED_gpencil_stroke_color_use(Object *ob, const bGPDlayer *gpl, const bGPDstr * * \param r_gsc: [out] The space conversion settings struct, populated with necessary params */ -void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc) +void gpencil_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc) { ScrArea *area = CTX_wm_area(C); ARegion *region = CTX_wm_region(C); @@ -661,7 +661,9 @@ void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc) * \param diff_mat: Matrix with the difference between original parent matrix * \param[out] r_pt: Pointer to new point after apply matrix */ -void gp_point_to_parent_space(const bGPDspoint *pt, const float diff_mat[4][4], bGPDspoint *r_pt) +void gpencil_point_to_parent_space(const bGPDspoint *pt, + const float diff_mat[4][4], + bGPDspoint *r_pt) { float fpt[3]; @@ -672,7 +674,7 @@ void gp_point_to_parent_space(const bGPDspoint *pt, const float diff_mat[4][4], /** * Change position relative to parent object */ -void gp_apply_parent(Depsgraph *depsgraph, Object *obact, bGPDlayer *gpl, bGPDstroke *gps) +void gpencil_apply_parent(Depsgraph *depsgraph, Object *obact, bGPDlayer *gpl, bGPDstroke *gps) { bGPDspoint *pt; int i; @@ -695,7 +697,10 @@ void gp_apply_parent(Depsgraph *depsgraph, Object *obact, bGPDlayer *gpl, bGPDst /** * Change point position relative to parent object */ -void gp_apply_parent_point(Depsgraph *depsgraph, Object *obact, bGPDlayer *gpl, bGPDspoint *pt) +void gpencil_apply_parent_point(Depsgraph *depsgraph, + Object *obact, + bGPDlayer *gpl, + bGPDspoint *pt) { /* undo matrix */ float diff_mat[4][4]; @@ -718,7 +723,7 @@ void gp_apply_parent_point(Depsgraph *depsgraph, Object *obact, bGPDlayer *gpl, * \warning This assumes that the caller has already checked * whether the stroke in question can be drawn. */ -void gp_point_to_xy( +void gpencil_point_to_xy( const GP_SpaceConversion *gsc, const bGPDstroke *gps, const bGPDspoint *pt, int *r_x, int *r_y) { const ARegion *region = gsc->region; @@ -773,11 +778,11 @@ void gp_point_to_xy( * \warning This assumes that the caller has already checked * whether the stroke in question can be drawn. */ -void gp_point_to_xy_fl(const GP_SpaceConversion *gsc, - const bGPDstroke *gps, - const bGPDspoint *pt, - float *r_x, - float *r_y) +void gpencil_point_to_xy_fl(const GP_SpaceConversion *gsc, + const bGPDstroke *gps, + const bGPDspoint *pt, + float *r_x, + float *r_y) { const ARegion *region = gsc->region; const View2D *v2d = gsc->v2d; @@ -833,10 +838,10 @@ void gp_point_to_xy_fl(const GP_SpaceConversion *gsc, /** * generic based on gp_point_to_xy_fl */ -void gp_point_3d_to_xy(const GP_SpaceConversion *gsc, - const short flag, - const float pt[3], - float xy[2]) +void gpencil_point_3d_to_xy(const GP_SpaceConversion *gsc, + const short flag, + const float pt[3], + float xy[2]) { const ARegion *region = gsc->region; const View2D *v2d = gsc->v2d; @@ -902,10 +907,10 @@ void gp_point_3d_to_xy(const GP_SpaceConversion *gsc, * * \warning Assumes that it is getting called in a 3D view only. */ -bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc, - Scene *scene, - const float screen_co[2], - float r_out[3]) +bool gpencil_point_xy_to_3d(const GP_SpaceConversion *gsc, + Scene *scene, + const float screen_co[2], + float r_out[3]) { const RegionView3D *rv3d = gsc->region->regiondata; float rvec[3]; @@ -942,12 +947,12 @@ bool gp_point_xy_to_3d(const GP_SpaceConversion *gsc, * \param depth: Depth array (via #ED_view3d_autodist_depth()). * \param r_out: The resulting 2D point data. */ -void gp_stroke_convertcoords_tpoint(Scene *scene, - ARegion *region, - Object *ob, - const tGPspoint *point2D, - float *depth, - float r_out[3]) +void gpencil_stroke_convertcoords_tpoint(Scene *scene, + ARegion *region, + Object *ob, + const tGPspoint *point2D, + float *depth, + float r_out[3]) { ToolSettings *ts = scene->toolsettings; @@ -1027,7 +1032,7 @@ void ED_gpencil_project_stroke_to_view(bContext *C, bGPDlayer *gpl, bGPDstroke * float inverse_diff_mat[4][4]; /* init space conversion stuff */ - gp_point_conversion_init(C, &gsc); + gpencil_point_conversion_init(C, &gsc); BKE_gpencil_parent_matrix_get(depsgraph, ob, gpl, diff_mat); invert_m4_m4(inverse_diff_mat, diff_mat); @@ -1037,11 +1042,11 @@ void ED_gpencil_project_stroke_to_view(bContext *C, bGPDlayer *gpl, bGPDstroke * float xy[2]; bGPDspoint pt2; - gp_point_to_parent_space(pt, diff_mat, &pt2); - gp_point_to_xy_fl(&gsc, gps, &pt2, &xy[0], &xy[1]); + gpencil_point_to_parent_space(pt, diff_mat, &pt2); + gpencil_point_to_xy_fl(&gsc, gps, &pt2, &xy[0], &xy[1]); /* Planar - All on same plane parallel to the viewplane */ - gp_point_xy_to_3d(&gsc, scene, xy, &pt->x); + gpencil_point_xy_to_3d(&gsc, scene, xy, &pt->x); /* Unapply parent corrections */ mul_m4_v3(inverse_diff_mat, &pt->x); @@ -1173,8 +1178,8 @@ void ED_gpencil_stroke_reproject(Depsgraph *depsgraph, * artifacts in the final points. */ bGPDspoint pt2; - gp_point_to_parent_space(pt, diff_mat, &pt2); - gp_point_to_xy_fl(gsc, gps_active, &pt2, &xy[0], &xy[1]); + gpencil_point_to_parent_space(pt, diff_mat, &pt2); + gpencil_point_to_xy_fl(gsc, gps_active, &pt2, &xy[0], &xy[1]); /* Project stroke in one axis */ if (ELEM(mode, GP_REPROJECT_FRONT, GP_REPROJECT_SIDE, GP_REPROJECT_TOP, GP_REPROJECT_CURSOR)) { @@ -1207,13 +1212,13 @@ void ED_gpencil_stroke_reproject(Depsgraph *depsgraph, copy_v3_v3(&pt->x, &pt2.x); /* apply parent again */ - gp_apply_parent_point(depsgraph, gsc->ob, gpl, pt); + gpencil_apply_parent_point(depsgraph, gsc->ob, gpl, pt); } /* Project screen-space back to 3D space (from current perspective) * so that all points have been treated the same way. */ else if (mode == GP_REPROJECT_VIEW) { /* Planar - All on same plane parallel to the view-plane. */ - gp_point_xy_to_3d(gsc, gsc->scene, xy, &pt->x); + gpencil_point_xy_to_3d(gsc, gsc->scene, xy, &pt->x); } else { /* Geometry - Snap to surfaces of visible geometry */ @@ -1241,7 +1246,7 @@ void ED_gpencil_stroke_reproject(Depsgraph *depsgraph, } else { /* Default to planar */ - gp_point_xy_to_3d(gsc, gsc->scene, xy, &pt->x); + gpencil_point_xy_to_3d(gsc, gsc->scene, xy, &pt->x); } } @@ -1333,7 +1338,7 @@ void ED_gp_project_point_to_plane(const Scene *scene, * \param gps: Stroke data * \param subdivide: Number of times to subdivide */ -void gp_subdivide_stroke(bGPDstroke *gps, const int subdivide) +void gpencil_subdivide_stroke(bGPDstroke *gps, const int subdivide) { bGPDspoint *temp_points; int totnewpoints, oldtotpoints; @@ -2924,12 +2929,12 @@ bool ED_gpencil_stroke_check_collision(GP_SpaceConversion *gsc, /* Convert bound box to 2d */ copy_v3_v3(&pt_dummy.x, gps->boundbox_min); - gp_point_to_parent_space(&pt_dummy, diff_mat, &pt_dummy_ps); - gp_point_to_xy_fl(gsc, gps, &pt_dummy_ps, &boundbox_min[0], &boundbox_min[1]); + gpencil_point_to_parent_space(&pt_dummy, diff_mat, &pt_dummy_ps); + gpencil_point_to_xy_fl(gsc, gps, &pt_dummy_ps, &boundbox_min[0], &boundbox_min[1]); copy_v3_v3(&pt_dummy.x, gps->boundbox_max); - gp_point_to_parent_space(&pt_dummy, diff_mat, &pt_dummy_ps); - gp_point_to_xy_fl(gsc, gps, &pt_dummy_ps, &boundbox_max[0], &boundbox_max[1]); + gpencil_point_to_parent_space(&pt_dummy, diff_mat, &pt_dummy_ps); + gpencil_point_to_xy_fl(gsc, gps, &pt_dummy_ps, &boundbox_max[0], &boundbox_max[1]); /* Ensure the bounding box is oriented to axis. */ if (boundbox_max[0] < boundbox_min[0]) { @@ -2976,8 +2981,8 @@ bool ED_gpencil_stroke_point_is_inside(bGPDstroke *gps, int i; for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { bGPDspoint pt2; - gp_point_to_parent_space(pt, diff_mat, &pt2); - gp_point_to_xy(gsc, gps, &pt2, &mcoords[i][0], &mcoords[i][1]); + gpencil_point_to_parent_space(pt, diff_mat, &pt2); + gpencil_point_to_xy(gsc, gps, &pt2, &mcoords[i][0], &mcoords[i][1]); } /* Compute bound-box of lasso (for faster testing later). */ diff --git a/source/blender/editors/gpencil/gpencil_uv.c b/source/blender/editors/gpencil/gpencil_uv.c index 0dfc7e0728e..e21b2049028 100644 --- a/source/blender/editors/gpencil/gpencil_uv.c +++ b/source/blender/editors/gpencil/gpencil_uv.c @@ -148,7 +148,7 @@ static bool gpencil_uv_transform_init(bContext *C, wmOperator *op) opdata->ob = CTX_data_active_object(C); opdata->gpd = (bGPdata *)opdata->ob->data; - gp_point_conversion_init(C, &opdata->gsc); + gpencil_point_conversion_init(C, &opdata->gsc); opdata->array_loc = NULL; opdata->array_rot = NULL; opdata->array_scale = NULL; @@ -197,7 +197,7 @@ static bool gpencil_uv_transform_init(bContext *C, wmOperator *op) GP_EDITABLE_STROKES_END(gpstroke_iter); } /* Convert to 2D. */ - gp_point_3d_to_xy(&opdata->gsc, GP_STROKE_3DSPACE, center, opdata->mcenter); + gpencil_point_3d_to_xy(&opdata->gsc, GP_STROKE_3DSPACE, center, opdata->mcenter); return true; } diff --git a/source/blender/editors/gpencil/gpencil_vertex_paint.c b/source/blender/editors/gpencil/gpencil_vertex_paint.c index fe3f0871fdc..9515dd90d7e 100644 --- a/source/blender/editors/gpencil/gpencil_vertex_paint.c +++ b/source/blender/editors/gpencil/gpencil_vertex_paint.c @@ -765,7 +765,7 @@ static bool gp_vertexpaint_brush_init(bContext *C, wmOperator *op) } /* Setup space conversions. */ - gp_point_conversion_init(C, &gso->gsc); + gpencil_point_conversion_init(C, &gso->gsc); /* Update header. */ gp_vertexpaint_brush_header_set(C); @@ -851,8 +851,8 @@ static void gp_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso, if (gps->totpoints == 1) { bGPDspoint pt_temp; pt = &gps->points[0]; - gp_point_to_parent_space(gps->points, diff_mat, &pt_temp); - gp_point_to_xy(gsc, gps, &pt_temp, &pc1[0], &pc1[1]); + gpencil_point_to_parent_space(gps->points, diff_mat, &pt_temp); + gpencil_point_to_xy(gsc, gps, &pt_temp, &pc1[0], &pc1[1]); pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; /* do boundbox check first */ @@ -888,11 +888,11 @@ static void gp_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso, } bGPDspoint npt; - gp_point_to_parent_space(pt1, diff_mat, &npt); - gp_point_to_xy(gsc, gps, &npt, &pc1[0], &pc1[1]); + gpencil_point_to_parent_space(pt1, diff_mat, &npt); + gpencil_point_to_xy(gsc, gps, &npt, &pc1[0], &pc1[1]); - gp_point_to_parent_space(pt2, diff_mat, &npt); - gp_point_to_xy(gsc, gps, &npt, &pc2[0], &pc2[1]); + gpencil_point_to_parent_space(pt2, diff_mat, &npt); + gpencil_point_to_xy(gsc, gps, &npt, &pc2[0], &pc2[1]); /* Check that point segment of the boundbox of the selection stroke */ if (((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) || @@ -901,7 +901,7 @@ static void gp_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso, * brush region (either within stroke painted, or on its lines) * - this assumes that linewidth is irrelevant */ - if (gp_stroke_inside_circle(gso->mval, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { + if (gpencil_stroke_inside_circle(gso->mval, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { /* To each point individually... */ pt = &gps->points[i]; diff --git a/source/blender/editors/gpencil/gpencil_weight_paint.c b/source/blender/editors/gpencil/gpencil_weight_paint.c index 2ebf1aba353..057074b5bf0 100644 --- a/source/blender/editors/gpencil/gpencil_weight_paint.c +++ b/source/blender/editors/gpencil/gpencil_weight_paint.c @@ -330,7 +330,7 @@ static bool gp_weightpaint_brush_init(bContext *C, wmOperator *op) } /* Setup space conversions. */ - gp_point_conversion_init(C, &gso->gsc); + gpencil_point_conversion_init(C, &gso->gsc); /* Update header. */ gp_weightpaint_brush_header_set(C); @@ -409,8 +409,8 @@ static void gp_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso, if (gps->totpoints == 1) { bGPDspoint pt_temp; pt = &gps->points[0]; - gp_point_to_parent_space(gps->points, diff_mat, &pt_temp); - gp_point_to_xy(gsc, gps, &pt_temp, &pc1[0], &pc1[1]); + gpencil_point_to_parent_space(gps->points, diff_mat, &pt_temp); + gpencil_point_to_xy(gsc, gps, &pt_temp, &pc1[0], &pc1[1]); pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; /* do boundbox check first */ @@ -436,11 +436,11 @@ static void gp_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso, pt2 = gps->points + i + 1; bGPDspoint npt; - gp_point_to_parent_space(pt1, diff_mat, &npt); - gp_point_to_xy(gsc, gps, &npt, &pc1[0], &pc1[1]); + gpencil_point_to_parent_space(pt1, diff_mat, &npt); + gpencil_point_to_xy(gsc, gps, &npt, &pc1[0], &pc1[1]); - gp_point_to_parent_space(pt2, diff_mat, &npt); - gp_point_to_xy(gsc, gps, &npt, &pc2[0], &pc2[1]); + gpencil_point_to_parent_space(pt2, diff_mat, &npt); + gpencil_point_to_xy(gsc, gps, &npt, &pc2[0], &pc2[1]); /* Check that point segment of the boundbox of the selection stroke */ if (((!ELEM(V2D_IS_CLIPPED, pc1[0], pc1[1])) && BLI_rcti_isect_pt(rect, pc1[0], pc1[1])) || @@ -449,7 +449,7 @@ static void gp_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso, * brush region (either within stroke painted, or on its lines) * - this assumes that linewidth is irrelevant */ - if (gp_stroke_inside_circle(gso->mval, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { + if (gpencil_stroke_inside_circle(gso->mval, radius, pc1[0], pc1[1], pc2[0], pc2[1])) { /* To each point individually... */ pt = &gps->points[i]; diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index 3b0db27e58d..01702d13d0d 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -175,28 +175,31 @@ void ED_annotation_draw_ex(struct Scene *scene, const char spacetype); /* ----------- Grease-Pencil AnimEdit API ------------------ */ -bool ED_gplayer_frames_looper(struct bGPDlayer *gpl, - struct Scene *scene, - short (*gpf_cb)(struct bGPDframe *, struct Scene *)); -void ED_gplayer_make_cfra_list(struct bGPDlayer *gpl, ListBase *elems, bool onlysel); - -bool ED_gplayer_frame_select_check(struct bGPDlayer *gpl); -void ED_gplayer_frame_select_set(struct bGPDlayer *gpl, short mode); -void ED_gplayer_frames_select_box(struct bGPDlayer *gpl, float min, float max, short select_mode); -void ED_gplayer_frames_select_region(struct KeyframeEditData *ked, - struct bGPDlayer *gpl, - short tool, - short select_mode); +bool ED_gpencil_layer_frames_looper(struct bGPDlayer *gpl, + struct Scene *scene, + short (*gpf_cb)(struct bGPDframe *, struct Scene *)); +void ED_gpencil_layer_make_cfra_list(struct bGPDlayer *gpl, ListBase *elems, bool onlysel); + +bool ED_gpencil_layer_frame_select_check(struct bGPDlayer *gpl); +void ED_gpencil_layer_frame_select_set(struct bGPDlayer *gpl, short mode); +void ED_gpencil_layer_frames_select_box(struct bGPDlayer *gpl, + float min, + float max, + short select_mode); +void ED_gpencil_layer_frames_select_region(struct KeyframeEditData *ked, + struct bGPDlayer *gpl, + short tool, + short select_mode); void ED_gpencil_select_frames(struct bGPDlayer *gpl, short select_mode); void ED_gpencil_select_frame(struct bGPDlayer *gpl, int selx, short select_mode); -bool ED_gplayer_frames_delete(struct bGPDlayer *gpl); -void ED_gplayer_frames_duplicate(struct bGPDlayer *gpl); +bool ED_gpencil_layer_frames_delete(struct bGPDlayer *gpl); +void ED_gpencil_layer_frames_duplicate(struct bGPDlayer *gpl); -void ED_gplayer_frames_keytype_set(struct bGPDlayer *gpl, short type); +void ED_gpencil_layer_frames_keytype_set(struct bGPDlayer *gpl, short type); -void ED_gplayer_snap_frames(struct bGPDlayer *gpl, struct Scene *scene, short mode); -void ED_gplayer_mirror_frames(struct bGPDlayer *gpl, struct Scene *scene, short mode); +void ED_gpencil_layer_snap_frames(struct bGPDlayer *gpl, struct Scene *scene, short mode); +void ED_gpencil_layer_mirror_frames(struct bGPDlayer *gpl, struct Scene *scene, short mode); void ED_gpencil_anim_copybuf_free(void); bool ED_gpencil_anim_copybuf_copy(struct bAnimContext *ac); diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index aa44982ccc5..aa784800be0 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -898,7 +898,7 @@ static void duplicate_action_keys(bAnimContext *ac) duplicate_fcurve_keys((FCurve *)ale->key_data); } else if (ale->type == ANIMTYPE_GPLAYER) { - ED_gplayer_frames_duplicate((bGPDlayer *)ale->data); + ED_gpencil_layer_frames_duplicate((bGPDlayer *)ale->data); } else if (ale->type == ANIMTYPE_MASKLAYER) { ED_masklayer_frames_duplicate((MaskLayer *)ale->data); @@ -974,7 +974,7 @@ static bool delete_action_keys(bAnimContext *ac) bool changed = false; if (ale->type == ANIMTYPE_GPLAYER) { - changed = ED_gplayer_frames_delete((bGPDlayer *)ale->data); + changed = ED_gpencil_layer_frames_delete((bGPDlayer *)ale->data); } else if (ale->type == ANIMTYPE_MASKLAYER) { changed = ED_masklayer_frames_delete((MaskLayer *)ale->data); @@ -1549,7 +1549,7 @@ static void setkeytype_gpencil_keys(bAnimContext *ac, short mode) /* loop through each layer */ for (ale = anim_data.first; ale; ale = ale->next) { if (ale->type == ANIMTYPE_GPLAYER) { - ED_gplayer_frames_keytype_set(ale->data, mode); + ED_gpencil_layer_frames_keytype_set(ale->data, mode); ale->update |= ANIM_UPDATE_DEPS; } } @@ -1750,7 +1750,7 @@ static void snap_action_keys(bAnimContext *ac, short mode) AnimData *adt = ANIM_nla_mapping_get(ac, ale); if (ale->type == ANIMTYPE_GPLAYER) { - ED_gplayer_snap_frames(ale->data, ac->scene, mode); + ED_gpencil_layer_snap_frames(ale->data, ac->scene, mode); } else if (ale->type == ANIMTYPE_MASKLAYER) { ED_masklayer_snap_frames(ale->data, ac->scene, mode); @@ -1880,7 +1880,7 @@ static void mirror_action_keys(bAnimContext *ac, short mode) AnimData *adt = ANIM_nla_mapping_get(ac, ale); if (ale->type == ANIMTYPE_GPLAYER) { - ED_gplayer_mirror_frames(ale->data, ac->scene, mode); + ED_gpencil_layer_mirror_frames(ale->data, ac->scene, mode); } else if (ale->type == ANIMTYPE_MASKLAYER) { /* TODO */ diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index bbb68f632fb..f40b792269b 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -270,7 +270,7 @@ static void deselect_action_keys(bAnimContext *ac, short test, short sel) if (test) { for (ale = anim_data.first; ale; ale = ale->next) { if (ale->type == ANIMTYPE_GPLAYER) { - if (ED_gplayer_frame_select_check(ale->data)) { + if (ED_gpencil_layer_frame_select_check(ale->data)) { sel = SELECT_SUBTRACT; break; } @@ -296,7 +296,7 @@ static void deselect_action_keys(bAnimContext *ac, short test, short sel) /* Now set the flags */ for (ale = anim_data.first; ale; ale = ale->next) { if (ale->type == ANIMTYPE_GPLAYER) { - ED_gplayer_frame_select_set(ale->data, sel); + ED_gpencil_layer_frame_select_set(ale->data, sel); ale->update |= ANIM_UPDATE_DEPS; } else if (ale->type == ANIMTYPE_MASKLAYER) { @@ -405,14 +405,14 @@ static void box_select_elem( bGPdata *gpd = ale->data; bGPDlayer *gpl; for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { - ED_gplayer_frames_select_box(gpl, xmin, xmax, data->selectmode); + ED_gpencil_layer_frames_select_box(gpl, xmin, xmax, data->selectmode); } ale->update |= ANIM_UPDATE_DEPS; break; } #endif case ANIMTYPE_GPLAYER: { - ED_gplayer_frames_select_box(ale->data, xmin, xmax, sel_data->selectmode); + ED_gpencil_layer_frames_select_box(ale->data, xmin, xmax, sel_data->selectmode); ale->update |= ANIM_UPDATE_DEPS; break; } @@ -641,13 +641,13 @@ static void region_select_elem(RegionSelectData *sel_data, bAnimListElem *ale, b bGPdata *gpd = ale->data; bGPDlayer *gpl; for (gpl = gpd->layers.first; gpl; gpl = gpl->next) { - ED_gplayer_frames_select_region(&rdata->ked, ale->data, rdata->mode, rdata->selectmode); + ED_gpencil_layer_frames_select_region(&rdata->ked, ale->data, rdata->mode, rdata->selectmode); } break; } #endif case ANIMTYPE_GPLAYER: { - ED_gplayer_frames_select_region( + ED_gpencil_layer_frames_select_region( &sel_data->ked, ale->data, sel_data->mode, sel_data->selectmode); ale->update |= ANIM_UPDATE_DEPS; break; @@ -972,7 +972,7 @@ static void markers_selectkeys_between(bAnimContext *ac) ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } else if (ale->type == ANIMTYPE_GPLAYER) { - ED_gplayer_frames_select_box(ale->data, min, max, SELECT_ADD); + ED_gpencil_layer_frames_select_box(ale->data, min, max, SELECT_ADD); ale->update |= ANIM_UPDATE_DEPS; } else if (ale->type == ANIMTYPE_MASKLAYER) { @@ -1008,7 +1008,7 @@ static void columnselect_action_keys(bAnimContext *ac, short mode) ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); for (ale = anim_data.first; ale; ale = ale->next) { - ED_gplayer_make_cfra_list(ale->data, &ked.list, 1); + ED_gpencil_layer_make_cfra_list(ale->data, &ked.list, 1); } } else { @@ -1385,7 +1385,7 @@ static void actkeys_select_leftright(bAnimContext *ac, short leftright, short se ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1); } else if (ale->type == ANIMTYPE_GPLAYER) { - ED_gplayer_frames_select_box(ale->data, ked.f1, ked.f2, select_mode); + ED_gpencil_layer_frames_select_box(ale->data, ked.f1, ked.f2, select_mode); ale->update |= ANIM_UPDATE_DEPS; } else if (ale->type == ANIMTYPE_MASKLAYER) { |