GPencil: Cleanup - Rename annotation drawing function names
Actually, the static functions had the same name used for grease pencil. Now, the annotation functions have a different prefix.
This commit is contained in:
parent
9e3246ce6e
commit
1b65ec0a9b
|
@ -91,12 +91,12 @@ typedef enum eDrawStrokeFlags {
|
|||
/* ----- Tool Buffer Drawing ------ */
|
||||
|
||||
/* draw stroke defined in buffer (simple ogl lines/points for now, as dotted lines) */
|
||||
static void gp_draw_stroke_buffer(const tGPspoint *points,
|
||||
int totpoints,
|
||||
short thickness,
|
||||
short dflag,
|
||||
short sflag,
|
||||
float ink[4])
|
||||
static void annotation_draw_stroke_buffer(const tGPspoint *points,
|
||||
int totpoints,
|
||||
short thickness,
|
||||
short dflag,
|
||||
short sflag,
|
||||
float ink[4])
|
||||
{
|
||||
int draw_points = 0;
|
||||
|
||||
|
@ -181,7 +181,7 @@ static void gp_draw_stroke_buffer(const tGPspoint *points,
|
|||
|
||||
/* --------- 2D Stroke Drawing Helpers --------- */
|
||||
/* change in parameter list */
|
||||
static void gp_calc_2d_stroke_fxy(
|
||||
static void annotation_calc_2d_stroke_fxy(
|
||||
const float pt[3], short sflag, int offsx, int offsy, int winx, int winy, float r_co[2])
|
||||
{
|
||||
if (sflag & GP_STROKE_2DSPACE) {
|
||||
|
@ -207,15 +207,15 @@ static void gp_calc_2d_stroke_fxy(
|
|||
/* ----- Existing Strokes Drawing (3D and Point) ------ */
|
||||
|
||||
/* draw a given stroke - just a single dot (only one point) */
|
||||
static void gp_draw_stroke_point(const bGPDspoint *points,
|
||||
short thickness,
|
||||
short UNUSED(dflag),
|
||||
short sflag,
|
||||
int offsx,
|
||||
int offsy,
|
||||
int winx,
|
||||
int winy,
|
||||
const float ink[4])
|
||||
static void annotation_draw_stroke_point(const bGPDspoint *points,
|
||||
short thickness,
|
||||
short UNUSED(dflag),
|
||||
short sflag,
|
||||
int offsx,
|
||||
int offsy,
|
||||
int winx,
|
||||
int winy,
|
||||
const float ink[4])
|
||||
{
|
||||
const bGPDspoint *pt = points;
|
||||
|
||||
|
@ -234,7 +234,7 @@ static void gp_draw_stroke_point(const bGPDspoint *points,
|
|||
|
||||
/* get 2D coordinates of point */
|
||||
float co[3] = {0.0f};
|
||||
gp_calc_2d_stroke_fxy(fpt, sflag, offsx, offsy, winx, winy, co);
|
||||
annotation_calc_2d_stroke_fxy(fpt, sflag, offsx, offsy, winx, winy, co);
|
||||
copy_v3_v3(fpt, co);
|
||||
}
|
||||
|
||||
|
@ -252,12 +252,12 @@ static void gp_draw_stroke_point(const bGPDspoint *points,
|
|||
}
|
||||
|
||||
/* draw a given stroke in 3d (i.e. in 3d-space), using simple ogl lines */
|
||||
static void gp_draw_stroke_3d(const bGPDspoint *points,
|
||||
int totpoints,
|
||||
short thickness,
|
||||
short UNUSED(sflag),
|
||||
const float ink[4],
|
||||
bool cyclic)
|
||||
static void annotation_draw_stroke_3d(const bGPDspoint *points,
|
||||
int totpoints,
|
||||
short thickness,
|
||||
short UNUSED(sflag),
|
||||
const float ink[4],
|
||||
bool cyclic)
|
||||
{
|
||||
float curpressure = points[0].pressure;
|
||||
float cyclic_fpt[3];
|
||||
|
@ -336,16 +336,16 @@ static void gp_draw_stroke_3d(const bGPDspoint *points,
|
|||
/* ----- Fancy 2D-Stroke Drawing ------ */
|
||||
|
||||
/* draw a given stroke in 2d */
|
||||
static void gp_draw_stroke_2d(const bGPDspoint *points,
|
||||
int totpoints,
|
||||
short thickness_s,
|
||||
short dflag,
|
||||
short sflag,
|
||||
int offsx,
|
||||
int offsy,
|
||||
int winx,
|
||||
int winy,
|
||||
const float ink[4])
|
||||
static void annotation_draw_stroke_2d(const bGPDspoint *points,
|
||||
int totpoints,
|
||||
short thickness_s,
|
||||
short dflag,
|
||||
short sflag,
|
||||
int offsx,
|
||||
int offsy,
|
||||
int winx,
|
||||
int winy,
|
||||
const float ink[4])
|
||||
{
|
||||
/* otherwise thickness is twice that of the 3D view */
|
||||
float thickness = (float)thickness_s * 0.5f;
|
||||
|
@ -374,7 +374,7 @@ static void gp_draw_stroke_2d(const bGPDspoint *points,
|
|||
immBegin(GPU_PRIM_TRI_STRIP, totpoints * 2 + 4);
|
||||
|
||||
/* get x and y coordinates from first point */
|
||||
gp_calc_2d_stroke_fxy(&points->x, sflag, offsx, offsy, winx, winy, s0);
|
||||
annotation_calc_2d_stroke_fxy(&points->x, sflag, offsx, offsy, winx, winy, s0);
|
||||
|
||||
for (i = 0, pt1 = points, pt2 = points + 1; i < (totpoints - 1); i++, pt1++, pt2++) {
|
||||
float t0[2], t1[2]; /* tessellated coordinates */
|
||||
|
@ -384,7 +384,7 @@ static void gp_draw_stroke_2d(const bGPDspoint *points,
|
|||
|
||||
/* Get x and y coordinates from point2
|
||||
* (point1 has already been computed in previous iteration). */
|
||||
gp_calc_2d_stroke_fxy(&pt2->x, sflag, offsx, offsy, winx, winy, s1);
|
||||
annotation_calc_2d_stroke_fxy(&pt2->x, sflag, offsx, offsy, winx, winy, s1);
|
||||
|
||||
/* calculate gradient and normal - 'angle'=(ny/nx) */
|
||||
m1[1] = s1[1] - s0[1];
|
||||
|
@ -513,7 +513,7 @@ static void gp_draw_stroke_2d(const bGPDspoint *points,
|
|||
/* ----- 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 annotation_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 */
|
||||
|
@ -550,22 +550,22 @@ static bool gp_can_draw_stroke(const bGPDstroke *gps, const int dflag)
|
|||
}
|
||||
|
||||
/* draw a set of strokes */
|
||||
static void gp_draw_strokes(bGPdata *UNUSED(gpd),
|
||||
bGPDlayer *UNUSED(gpl),
|
||||
const bGPDframe *gpf,
|
||||
int offsx,
|
||||
int offsy,
|
||||
int winx,
|
||||
int winy,
|
||||
int dflag,
|
||||
short lthick,
|
||||
const float color[4])
|
||||
static void annotation_draw_strokes(bGPdata *UNUSED(gpd),
|
||||
bGPDlayer *UNUSED(gpl),
|
||||
const bGPDframe *gpf,
|
||||
int offsx,
|
||||
int offsy,
|
||||
int winx,
|
||||
int winy,
|
||||
int dflag,
|
||||
short lthick,
|
||||
const float color[4])
|
||||
{
|
||||
GPU_enable_program_point_size();
|
||||
|
||||
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
|
||||
/* check if stroke can be drawn */
|
||||
if (gp_can_draw_stroke(gps, dflag) == false) {
|
||||
if (annotation_can_draw_stroke(gps, dflag) == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -586,11 +586,11 @@ static void gp_draw_strokes(bGPdata *UNUSED(gpd),
|
|||
|
||||
/* 3D Lines - OpenGL primitives-based */
|
||||
if (gps->totpoints == 1) {
|
||||
gp_draw_stroke_point(
|
||||
annotation_draw_stroke_point(
|
||||
gps->points, lthick, dflag, gps->flag, offsx, offsy, winx, winy, color);
|
||||
}
|
||||
else {
|
||||
gp_draw_stroke_3d(
|
||||
annotation_draw_stroke_3d(
|
||||
gps->points, gps->totpoints, lthick, gps->flag, color, gps->flag & GP_STROKE_CYCLIC);
|
||||
}
|
||||
|
||||
|
@ -604,20 +604,20 @@ static void gp_draw_strokes(bGPdata *UNUSED(gpd),
|
|||
else {
|
||||
/* 2D Strokes... */
|
||||
if (gps->totpoints == 1) {
|
||||
gp_draw_stroke_point(
|
||||
annotation_draw_stroke_point(
|
||||
gps->points, lthick, dflag, gps->flag, offsx, offsy, winx, winy, color);
|
||||
}
|
||||
else {
|
||||
gp_draw_stroke_2d(gps->points,
|
||||
gps->totpoints,
|
||||
lthick,
|
||||
dflag,
|
||||
gps->flag,
|
||||
offsx,
|
||||
offsy,
|
||||
winx,
|
||||
winy,
|
||||
color);
|
||||
annotation_draw_stroke_2d(gps->points,
|
||||
gps->totpoints,
|
||||
lthick,
|
||||
dflag,
|
||||
gps->flag,
|
||||
offsx,
|
||||
offsy,
|
||||
winx,
|
||||
winy,
|
||||
color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -626,16 +626,16 @@ static void gp_draw_strokes(bGPdata *UNUSED(gpd),
|
|||
}
|
||||
|
||||
/* Draw selected verts for strokes being edited */
|
||||
static void gp_draw_strokes_edit(bGPdata *gpd,
|
||||
bGPDlayer *gpl,
|
||||
const bGPDframe *gpf,
|
||||
int offsx,
|
||||
int offsy,
|
||||
int winx,
|
||||
int winy,
|
||||
short dflag,
|
||||
short UNUSED(lflag),
|
||||
float alpha)
|
||||
static void annotation_draw_strokes_edit(bGPdata *gpd,
|
||||
bGPDlayer *gpl,
|
||||
const bGPDframe *gpf,
|
||||
int offsx,
|
||||
int offsy,
|
||||
int winx,
|
||||
int winy,
|
||||
short dflag,
|
||||
short UNUSED(lflag),
|
||||
float alpha)
|
||||
{
|
||||
/* if alpha 0 do not draw */
|
||||
if (alpha == 0.0f) {
|
||||
|
@ -663,7 +663,7 @@ static void gp_draw_strokes_edit(bGPdata *gpd,
|
|||
/* draw stroke verts */
|
||||
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
|
||||
/* check if stroke can be drawn */
|
||||
if (gp_can_draw_stroke(gps, dflag) == false) {
|
||||
if (annotation_can_draw_stroke(gps, dflag) == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -742,7 +742,7 @@ static void gp_draw_strokes_edit(bGPdata *gpd,
|
|||
}
|
||||
else {
|
||||
float co[2];
|
||||
gp_calc_2d_stroke_fxy(&pt->x, gps->flag, offsx, offsy, winx, winy, co);
|
||||
annotation_calc_2d_stroke_fxy(&pt->x, gps->flag, offsx, offsy, winx, winy, co);
|
||||
immVertex2fv(pos, co);
|
||||
}
|
||||
}
|
||||
|
@ -770,15 +770,15 @@ static void gp_draw_strokes_edit(bGPdata *gpd,
|
|||
|
||||
/* ----- General Drawing ------ */
|
||||
/* draw onion-skinning for a layer */
|
||||
static void gp_draw_onionskins(bGPdata *gpd,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *gpf,
|
||||
int offsx,
|
||||
int offsy,
|
||||
int winx,
|
||||
int winy,
|
||||
int UNUSED(cfra),
|
||||
int dflag)
|
||||
static void annotation_draw_onionskins(bGPdata *gpd,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *gpf,
|
||||
int offsx,
|
||||
int offsy,
|
||||
int winx,
|
||||
int winy,
|
||||
int UNUSED(cfra),
|
||||
int dflag)
|
||||
{
|
||||
const float alpha = 1.0f;
|
||||
float color[4];
|
||||
|
@ -797,7 +797,8 @@ static void gp_draw_onionskins(bGPdata *gpd,
|
|||
/* alpha decreases with distance from curframe index */
|
||||
fac = 1.0f - ((float)(gpf->framenum - gf->framenum) / (float)(gpl->gstep + 1));
|
||||
color[3] = alpha * fac * 0.66f;
|
||||
gp_draw_strokes(gpd, gpl, gf, offsx, offsy, winx, winy, dflag, gpl->thickness, color);
|
||||
annotation_draw_strokes(
|
||||
gpd, gpl, gf, offsx, offsy, winx, winy, dflag, gpl->thickness, color);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
|
@ -808,7 +809,8 @@ static void gp_draw_onionskins(bGPdata *gpd,
|
|||
/* draw the strokes for the ghost frames (at half of the alpha set by user) */
|
||||
if (gpf->prev) {
|
||||
color[3] = (alpha / 7);
|
||||
gp_draw_strokes(gpd, gpl, gpf->prev, offsx, offsy, winx, winy, dflag, gpl->thickness, color);
|
||||
annotation_draw_strokes(
|
||||
gpd, gpl, gpf->prev, offsx, offsy, winx, winy, dflag, gpl->thickness, color);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -829,7 +831,8 @@ static void gp_draw_onionskins(bGPdata *gpd,
|
|||
/* alpha decreases with distance from curframe index */
|
||||
fac = 1.0f - ((float)(gf->framenum - gpf->framenum) / (float)(gpl->gstep_next + 1));
|
||||
color[3] = alpha * fac * 0.66f;
|
||||
gp_draw_strokes(gpd, gpl, gf, offsx, offsy, winx, winy, dflag, gpl->thickness, color);
|
||||
annotation_draw_strokes(
|
||||
gpd, gpl, gf, offsx, offsy, winx, winy, dflag, gpl->thickness, color);
|
||||
}
|
||||
else {
|
||||
break;
|
||||
|
@ -840,7 +843,8 @@ static void gp_draw_onionskins(bGPdata *gpd,
|
|||
/* draw the strokes for the ghost frames (at half of the alpha set by user) */
|
||||
if (gpf->next) {
|
||||
color[3] = (alpha / 4);
|
||||
gp_draw_strokes(gpd, gpl, gpf->next, offsx, offsy, winx, winy, dflag, gpl->thickness, color);
|
||||
annotation_draw_strokes(
|
||||
gpd, gpl, gpf->next, offsx, offsy, winx, winy, dflag, gpl->thickness, color);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -849,7 +853,7 @@ static void gp_draw_onionskins(bGPdata *gpd,
|
|||
}
|
||||
|
||||
/* loop over gpencil data layers, drawing them */
|
||||
static void gp_draw_data_layers(
|
||||
static void annotation_draw_data_layers(
|
||||
bGPdata *gpd, int offsx, int offsy, int winx, int winy, int cfra, int dflag, float alpha)
|
||||
{
|
||||
float ink[4];
|
||||
|
@ -887,11 +891,11 @@ static void gp_draw_data_layers(
|
|||
|
||||
/* Draw 'onionskins' (frame left + right) */
|
||||
if (gpl->onion_flag & GP_LAYER_ONIONSKIN) {
|
||||
gp_draw_onionskins(gpd, gpl, gpf, offsx, offsy, winx, winy, cfra, dflag);
|
||||
annotation_draw_onionskins(gpd, gpl, gpf, offsx, offsy, winx, winy, cfra, dflag);
|
||||
}
|
||||
|
||||
/* draw the strokes already in active frame */
|
||||
gp_draw_strokes(gpd, gpl, gpf, offsx, offsy, winx, winy, dflag, lthick, ink);
|
||||
annotation_draw_strokes(gpd, gpl, gpf, offsx, offsy, winx, winy, dflag, lthick, ink);
|
||||
|
||||
/* Draw verts of selected strokes
|
||||
* - when doing OpenGL renders, we don't want to be showing these, as that ends up flickering
|
||||
|
@ -903,7 +907,8 @@ static void gp_draw_data_layers(
|
|||
/* XXX: perhaps we don't want to show these when users are drawing... */
|
||||
if ((G.f & G_FLAG_RENDER_VIEWPORT) == 0 && (gpl->flag & GP_LAYER_LOCKED) == 0 &&
|
||||
(gpd->flag & GP_DATA_STROKE_EDITMODE)) {
|
||||
gp_draw_strokes_edit(gpd, gpl, gpf, offsx, offsy, winx, winy, dflag, gpl->flag, alpha);
|
||||
annotation_draw_strokes_edit(
|
||||
gpd, gpl, gpf, offsx, offsy, winx, winy, dflag, gpl->flag, alpha);
|
||||
}
|
||||
|
||||
/* Check if may need to draw the active stroke cache, only if this layer is the active layer
|
||||
|
@ -917,18 +922,18 @@ static void gp_draw_data_layers(
|
|||
* It should also be noted that sbuffer contains temporary point types
|
||||
* i.e. tGPspoints NOT bGPDspoints
|
||||
*/
|
||||
gp_draw_stroke_buffer(gpd->runtime.sbuffer,
|
||||
gpd->runtime.sbuffer_size,
|
||||
lthick,
|
||||
dflag,
|
||||
gpd->runtime.sbuffer_sflag,
|
||||
ink);
|
||||
annotation_draw_stroke_buffer(gpd->runtime.sbuffer,
|
||||
gpd->runtime.sbuffer_size,
|
||||
lthick,
|
||||
dflag,
|
||||
gpd->runtime.sbuffer_sflag,
|
||||
ink);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* draw a short status message in the top-right corner */
|
||||
static void gp_draw_status_text(const bGPdata *gpd, ARegion *ar)
|
||||
static void annotation_draw_status_text(const bGPdata *gpd, ARegion *ar)
|
||||
{
|
||||
rcti rect;
|
||||
|
||||
|
@ -977,7 +982,7 @@ static void gp_draw_status_text(const bGPdata *gpd, ARegion *ar)
|
|||
}
|
||||
|
||||
/* draw grease-pencil datablock */
|
||||
static void gp_draw_data(
|
||||
static void annotation_draw_data(
|
||||
bGPdata *gpd, int offsx, int offsy, int winx, int winy, int cfra, int dflag, float alpha)
|
||||
{
|
||||
/* turn on smooth lines (i.e. anti-aliasing) */
|
||||
|
@ -989,7 +994,7 @@ static void gp_draw_data(
|
|||
GPU_blend(true);
|
||||
|
||||
/* draw! */
|
||||
gp_draw_data_layers(gpd, offsx, offsy, winx, winy, cfra, dflag, alpha);
|
||||
annotation_draw_data_layers(gpd, offsx, offsy, winx, winy, cfra, dflag, alpha);
|
||||
|
||||
/* turn off alpha blending, then smooth lines */
|
||||
GPU_blend(false); // alpha blending
|
||||
|
@ -998,15 +1003,15 @@ static void gp_draw_data(
|
|||
|
||||
/* if we have strokes for scenes (3d view)/clips (movie clip editor)
|
||||
* and objects/tracks, multiple data blocks have to be drawn */
|
||||
static void gp_draw_data_all(Scene *scene,
|
||||
bGPdata *gpd,
|
||||
int offsx,
|
||||
int offsy,
|
||||
int winx,
|
||||
int winy,
|
||||
int cfra,
|
||||
int dflag,
|
||||
const char spacetype)
|
||||
static void annotation_draw_data_all(Scene *scene,
|
||||
bGPdata *gpd,
|
||||
int offsx,
|
||||
int offsy,
|
||||
int winx,
|
||||
int winy,
|
||||
int cfra,
|
||||
int dflag,
|
||||
const char spacetype)
|
||||
{
|
||||
bGPdata *gpd_source = NULL;
|
||||
float alpha = 1.0f;
|
||||
|
@ -1022,14 +1027,14 @@ static void gp_draw_data_all(Scene *scene,
|
|||
}
|
||||
|
||||
if (gpd_source) {
|
||||
gp_draw_data(gpd_source, offsx, offsy, winx, winy, cfra, dflag, alpha);
|
||||
annotation_draw_data(gpd_source, offsx, offsy, winx, winy, cfra, dflag, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
/* scene/clip data has already been drawn, only object/track data is drawn here
|
||||
* if gpd_source == gpd, we don't have any object/track data and we can skip */
|
||||
if (gpd_source == NULL || (gpd_source && gpd_source != gpd)) {
|
||||
gp_draw_data(gpd, offsx, offsy, winx, winy, cfra, dflag, alpha);
|
||||
annotation_draw_data(gpd, offsx, offsy, winx, winy, cfra, dflag, alpha);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1106,7 +1111,7 @@ void ED_annotation_draw_2dimage(const bContext *C)
|
|||
}
|
||||
|
||||
/* draw it! */
|
||||
gp_draw_data_all(scene, gpd, offsx, offsy, sizex, sizey, CFRA, dflag, sa->spacetype);
|
||||
annotation_draw_data_all(scene, gpd, offsx, offsy, sizex, sizey, CFRA, dflag, sa->spacetype);
|
||||
}
|
||||
|
||||
/* draw grease-pencil sketches to specified 2d-view assuming that matrices are already set correctly
|
||||
|
@ -1143,11 +1148,11 @@ void ED_annotation_draw_view2d(const bContext *C, bool onlyv2d)
|
|||
dflag |= GP_DRAWDATA_NO_ONIONS;
|
||||
}
|
||||
|
||||
gp_draw_data_all(scene, gpd, 0, 0, ar->winx, ar->winy, CFRA, dflag, sa->spacetype);
|
||||
annotation_draw_data_all(scene, gpd, 0, 0, ar->winx, ar->winy, CFRA, dflag, sa->spacetype);
|
||||
|
||||
/* draw status text (if in screen/pixel-space) */
|
||||
if (!onlyv2d) {
|
||||
gp_draw_status_text(gpd, ar);
|
||||
annotation_draw_status_text(gpd, ar);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1201,7 +1206,7 @@ void ED_annotation_draw_view3d(
|
|||
}
|
||||
|
||||
/* draw it! */
|
||||
gp_draw_data_all(scene, gpd, offsx, offsy, winx, winy, CFRA, dflag, v3d->spacetype);
|
||||
annotation_draw_data_all(scene, gpd, offsx, offsy, winx, winy, CFRA, dflag, v3d->spacetype);
|
||||
}
|
||||
|
||||
void ED_annotation_draw_ex(
|
||||
|
@ -1209,7 +1214,7 @@ void ED_annotation_draw_ex(
|
|||
{
|
||||
int dflag = GP_DRAWDATA_NOSTATUS | GP_DRAWDATA_ONLYV2D;
|
||||
|
||||
gp_draw_data_all(scene, gpd, 0, 0, winx, winy, cfra, dflag, spacetype);
|
||||
annotation_draw_data_all(scene, gpd, 0, 0, winx, winy, cfra, dflag, spacetype);
|
||||
}
|
||||
|
||||
/* ************************************************** */
|
||||
|
|
Loading…
Reference in New Issue