GP: Rename GP_STROKE_RECALC_CACHE to GP_STROKE_RECALC_GEOMETRY

The GP_STROKE_RECALC_CACHE identifier was changed to GP_STROKE_RECALC_GEOMETRY because the previous name was confusing and could be confused with the recalculation of the Draw Manager cache.
This commit is contained in:
Antonio Vazquez 2018-12-28 08:48:37 +01:00
parent 0661bcba32
commit fdc726eb61
18 changed files with 54 additions and 54 deletions

View File

@ -476,14 +476,14 @@ bGPDstroke *BKE_gpencil_add_stroke(bGPDframe *gpf, int mat_idx, int totpoints, s
gps->inittime = 0;
/* enable recalculation flag by default */
gps->flag = GP_STROKE_RECALC_CACHES | GP_STROKE_3DSPACE;
gps->flag = GP_STROKE_RECALC_GEOMETRY | GP_STROKE_3DSPACE;
gps->totpoints = totpoints;
gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points");
/* initialize triangle memory to dummy data */
gps->triangles = MEM_callocN(sizeof(bGPDtriangle), "GP Stroke triangulation");
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->tot_triangles = 0;
gps->mat_nr = mat_idx;
@ -532,7 +532,7 @@ bGPDstroke *BKE_gpencil_stroke_duplicate(bGPDstroke *gps_src)
* this data to get recalculated will destroy the data anyway though.
*/
gps_dst->triangles = MEM_dupallocN(gps_dst->triangles);
/* gps_dst->flag |= GP_STROKE_RECALC_CACHES; */
/* gps_dst->flag |= GP_STROKE_RECALC_GEOMETRY; */
/* return new stroke */
return gps_dst;
@ -1179,7 +1179,7 @@ void BKE_gpencil_transform(bGPdata *gpd, float mat[4][4])
}
/* TODO: Do we need to do this? distortion may mean we need to re-triangulate */
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->tot_triangles = 0;
}
}

View File

@ -227,7 +227,7 @@ static void gpencil_rdp_stroke(bGPDstroke *gps, vec2f *points2d, float epsilon)
old_dvert = MEM_dupallocN(gps->dvert);
}
/* resize gps */
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->tot_triangles = 0;
int j = 0;
@ -302,7 +302,7 @@ void BKE_gpencil_simplify_fixed(bGPDstroke *gps)
if (gps->dvert != NULL) {
gps->dvert = MEM_recallocN(gps->dvert, sizeof(*gps->dvert) * newtot);
}
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->tot_triangles = 0;
int j = 0;
@ -443,7 +443,7 @@ void BKE_gpencil_stroke_modifiers(Depsgraph *depsgraph, Object *ob, bGPDlayer *g
eGpencilModifierType_Offset))
{
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
}
}
}
@ -743,7 +743,7 @@ void BKE_gpencil_subdivide(bGPDstroke *gps, int level, int flag)
temp_dverts = MEM_dupallocN(gps->dvert);
gps->dvert = MEM_recallocN(gps->dvert, sizeof(*gps->dvert) * gps->totpoints);
}
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* move points from last to first to new place */
i2 = gps->totpoints - 1;

View File

@ -6597,7 +6597,7 @@ static void direct_link_gpencil(FileData *fd, bGPdata *gpd)
/* the triangulation is not saved, so need to be recalculated */
gps->triangles = NULL;
gps->tot_triangles = 0;
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
}
}
}

View File

@ -209,7 +209,7 @@ void DRW_gpencil_get_fill_geom(struct GpencilBatchCacheElem *be, Object *ob, bGP
BLI_assert(gps->totpoints >= 3);
/* Calculate triangles cache for filling area (must be done only after changes) */
if ((gps->flag & GP_STROKE_RECALC_CACHES) || (gps->tot_triangles == 0) || (gps->triangles == NULL)) {
if ((gps->flag & GP_STROKE_RECALC_GEOMETRY) || (gps->tot_triangles == 0) || (gps->triangles == NULL)) {
DRW_gpencil_triangulate_stroke_fill(ob, gps);
ED_gpencil_calc_stroke_uv(ob, gps);
}

View File

@ -219,7 +219,7 @@ static void gpencil_calc_stroke_fill_uv(
static void DRW_gpencil_recalc_geometry_caches(
Object *ob, bGPDlayer *gpl, MaterialGPencilStyle *gp_style, bGPDstroke *gps)
{
if (gps->flag & GP_STROKE_RECALC_CACHES) {
if (gps->flag & GP_STROKE_RECALC_GEOMETRY) {
/* Calculate triangles cache for filling area (must be done only after changes) */
if ((gps->tot_triangles == 0) || (gps->triangles == NULL)) {
if ((gps->totpoints > 2) &&
@ -234,7 +234,7 @@ static void DRW_gpencil_recalc_geometry_caches(
ED_gpencil_calc_stroke_uv(ob, gps);
/* clear flag */
gps->flag &= ~GP_STROKE_RECALC_CACHES;
gps->flag &= ~GP_STROKE_RECALC_GEOMETRY;
}
}
@ -1118,8 +1118,8 @@ void DRW_gpencil_triangulate_stroke_fill(Object *ob, bGPDstroke *gps)
}
/* disable recalculation flag */
if (gps->flag & GP_STROKE_RECALC_CACHES) {
gps->flag &= ~GP_STROKE_RECALC_CACHES;
if (gps->flag & GP_STROKE_RECALC_GEOMETRY) {
gps->flag &= ~GP_STROKE_RECALC_GEOMETRY;
}
/* clear memory */

View File

@ -447,7 +447,7 @@ static short gp_stroke_addpoint(
pts->time = pt->time;
/* force fill recalc */
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
}
/* increment counters */
@ -586,7 +586,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
gps->inittime = p->inittime;
/* enable recalculation flag by default (only used if hq fill) */
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* allocate enough memory for a continuous array for storage points */
gps->points = MEM_callocN(sizeof(bGPDspoint) * gps->totpoints, "gp_stroke_points");

View File

@ -513,8 +513,8 @@ static void gp_triangulate_stroke_fill(bGPDstroke *gps)
}
/* disable recalculation flag */
if (gps->flag & GP_STROKE_RECALC_CACHES) {
gps->flag &= ~GP_STROKE_RECALC_CACHES;
if (gps->flag & GP_STROKE_RECALC_GEOMETRY) {
gps->flag &= ~GP_STROKE_RECALC_GEOMETRY;
}
/* clear memory */
@ -591,7 +591,7 @@ static void gp_draw_stroke_fill(
MaterialGPencilStyle *gp_style = ma->gp_style;
/* Calculate triangles cache for filling area (must be done only after changes) */
if ((gps->flag & GP_STROKE_RECALC_CACHES) || (gps->tot_triangles == 0) || (gps->triangles == NULL)) {
if ((gps->flag & GP_STROKE_RECALC_GEOMETRY) || (gps->tot_triangles == 0) || (gps->triangles == NULL)) {
gp_triangulate_stroke_fill(gps);
}
BLI_assert(gps->tot_triangles >= 1);

View File

@ -319,7 +319,7 @@ static bool gp_brush_smooth_apply(
BKE_gpencil_smooth_stroke_uv(gps, pt_index, inf);
}
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
return true;
}
@ -535,7 +535,7 @@ static void gp_brush_grab_apply_cached(
/* compute lock axis */
gpsculpt_compute_lock_axis(gso, pt, save_pt);
}
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
}
/* free customdata used for handling this stroke */
@ -575,7 +575,7 @@ static bool gp_brush_push_apply(
/* compute lock axis */
gpsculpt_compute_lock_axis(gso, pt, save_pt);
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* done */
return true;
@ -661,7 +661,7 @@ static bool gp_brush_pinch_apply(
/* compute lock axis */
gpsculpt_compute_lock_axis(gso, pt, save_pt);
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* done */
return true;
@ -743,7 +743,7 @@ static bool gp_brush_twist_apply(
}
}
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* done */
return true;
@ -867,7 +867,7 @@ static bool gp_brush_randomize_apply(
CLAMP(pt->uv_rot, -M_PI_2, M_PI_2);
}
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* done */
return true;
@ -1609,7 +1609,7 @@ static bool gpsculpt_brush_do_frame(
}
/* Triangulation must be calculated if changed */
if (changed) {
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->tot_triangles = 0;
}
}

View File

@ -631,7 +631,7 @@ static void gp_duplicate_points(const bGPDstroke *gps, ListBase *new_strokes, co
/* initialize triangle memory - will be calculated on next redraw */
gpsd->triangles = NULL;
gpsd->flag |= GP_STROKE_RECALC_CACHES;
gpsd->flag |= GP_STROKE_RECALC_GEOMETRY;
gpsd->tot_triangles = 0;
/* now, make a new points array, and copy of the relevant parts */
@ -713,7 +713,7 @@ static int gp_duplicate_exec(bContext *C, wmOperator *op)
}
/* triangle information - will be calculated on next redraw */
gpsd->flag |= GP_STROKE_RECALC_CACHES;
gpsd->flag |= GP_STROKE_RECALC_GEOMETRY;
gpsd->triangles = NULL;
/* add to temp buffer */
@ -936,7 +936,7 @@ static int gp_strokes_copy_exec(bContext *C, wmOperator *op)
}
/* triangles cache - will be recalculated on next redraw */
gpsd->flag |= GP_STROKE_RECALC_CACHES;
gpsd->flag |= GP_STROKE_RECALC_GEOMETRY;
gpsd->tot_triangles = 0;
gpsd->triangles = NULL;
@ -1113,7 +1113,7 @@ static int gp_strokes_paste_exec(bContext *C, wmOperator *op)
new_stroke->dvert = MEM_dupallocN(gps->dvert);
BKE_gpencil_stroke_weights_duplicate(gps, new_stroke);
}
new_stroke->flag |= GP_STROKE_RECALC_CACHES;
new_stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
new_stroke->triangles = NULL;
new_stroke->next = new_stroke->prev = NULL;
@ -1777,7 +1777,7 @@ static int gp_dissolve_selected_points(bContext *C, eGP_DissolveMode mode)
gps->totpoints = tot;
/* triangles cache needs to be recalculated */
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->tot_triangles = 0;
/* deselect the stroke, since none of its selected points will still be selected */
@ -1877,7 +1877,7 @@ void gp_stroke_delete_tagged_points(bGPDframe *gpf, bGPDstroke *gps, bGPDstroke
/* initialize triangle memory - to be calculated on next redraw */
new_stroke->triangles = NULL;
new_stroke->flag |= GP_STROKE_RECALC_CACHES;
new_stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
new_stroke->tot_triangles = 0;
/* Compute new buffer size (+ 1 needed as the endpoint index is "inclusive") */
@ -2707,7 +2707,7 @@ static int gp_stroke_join_exec(bContext *C, wmOperator *op)
}
new_stroke->triangles = NULL;
new_stroke->tot_triangles = 0;
new_stroke->flag |= GP_STROKE_RECALC_CACHES;
new_stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
/* if new, set current color */
if (type == GP_STROKE_JOINCOPY) {
@ -3124,7 +3124,7 @@ static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op)
if (gps->dvert != NULL) {
gps->dvert = MEM_recallocN(gps->dvert, sizeof(*gps->dvert) * gps->totpoints);
}
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* loop and interpolate */
i2 = 0;
@ -3195,7 +3195,7 @@ static int gp_stroke_subdivide_exec(bContext *C, wmOperator *op)
}
/* triangles cache needs to be recalculated */
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->tot_triangles = 0;
}
}

View File

@ -863,7 +863,7 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
/* initialize triangle memory to dummy data */
gps->tot_triangles = 0;
gps->triangles = NULL;
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* add stroke to frame */
if ((ts->gpencil_flags & GP_TOOL_FLAG_PAINT_ONBACK) || (tgpf->on_back == true)) {

View File

@ -306,7 +306,7 @@ static void gp_interpolate_set_points(bContext *C, tGPDinterpolate *tgpi)
}
new_stroke->totpoints = gps_to->totpoints;
new_stroke->tot_triangles = 0;
new_stroke->flag |= GP_STROKE_RECALC_CACHES;
new_stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
}
/* update points position */
gp_interpolate_update_points(gps_from, gps_to, new_stroke, tgpil->factor);
@ -320,7 +320,7 @@ static void gp_interpolate_set_points(bContext *C, tGPDinterpolate *tgpi)
}
new_stroke->tot_triangles = 0;
new_stroke->triangles = MEM_recallocN(new_stroke->triangles, sizeof(*new_stroke->triangles));
new_stroke->flag |= GP_STROKE_RECALC_CACHES;
new_stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
}
/* add to strokes */
@ -596,7 +596,7 @@ static int gpencil_interpolate_modal(bContext *C, wmOperator *op, const wmEvent
BKE_gpencil_stroke_weights_duplicate(gps_src, gps_dst);
}
gps_dst->triangles = MEM_dupallocN(gps_src->triangles);
gps_dst->flag |= GP_STROKE_RECALC_CACHES;
gps_dst->flag |= GP_STROKE_RECALC_GEOMETRY;
BLI_addtail(&gpf_dst->strokes, gps_dst);
}
}
@ -1033,7 +1033,7 @@ static int gpencil_interpolate_seq_exec(bContext *C, wmOperator *op)
}
new_stroke->totpoints = gps_to->totpoints;
new_stroke->tot_triangles = 0;
new_stroke->flag |= GP_STROKE_RECALC_CACHES;
new_stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
}
/* update points position */

View File

@ -816,7 +816,7 @@ static short gp_stroke_addpoint(
}
/* force fill recalc */
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* drawing batch cache is dirty now */
gp_update_cache(p->gpd);
}
@ -895,7 +895,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
gps->inittime = p->inittime;
/* enable recalculation flag by default (only used if hq fill) */
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* allocate enough memory for a continuous array for storage points */
const int subdivide = brush->gpencil_settings->draw_subdivide;
@ -904,7 +904,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
/* initialize triangle memory to dummy data */
gps->triangles = MEM_callocN(sizeof(bGPDtriangle), "GP Stroke triangulation");
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->tot_triangles = 0;
/* drawing batch cache is dirty now */
gp_update_cache(p->gpd);

View File

@ -332,7 +332,7 @@ static void gp_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi)
gps->inittime = 0.0f;
/* enable recalculation flag by default */
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->flag &= ~GP_STROKE_SELECT;
/* the polygon must be closed, so enabled cyclic */
if (ELEM(tgpi->type, GP_STROKE_BOX, GP_STROKE_CIRCLE)) {
@ -349,7 +349,7 @@ static void gp_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi)
/* initialize triangle memory to dummy data */
gps->tot_triangles = 0;
gps->triangles = NULL;
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* add to strokes */
BLI_addtail(&tgpi->gpf->strokes, gps);
@ -975,7 +975,7 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
}
/* force fill recalc */
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
MEM_SAFE_FREE(depth_arr);
@ -1203,7 +1203,7 @@ static void gpencil_primitive_interaction_end(bContext *C, wmOperator *op, wmWin
gps = tgpi->gpf->strokes.first;
if (gps) {
gps->thickness = tgpi->brush->size;
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->tot_triangles = 0;
}

View File

@ -997,7 +997,7 @@ void gp_subdivide_stroke(bGPDstroke *gps, const int subdivide)
if (gps->dvert != NULL) {
gps->dvert = MEM_recallocN(gps->dvert, sizeof(*gps->dvert) * gps->totpoints);
}
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
/* move points from last to first to new place */
i2 = gps->totpoints - 1;

View File

@ -1080,7 +1080,7 @@ static void recalcData_gpencil_strokes(TransInfo *t)
for (int i = 0; i < tc->data_len; i++, td++) {
bGPDstroke *gps = td->extra;
if (gps != NULL) {
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
}
}
}

View File

@ -178,7 +178,7 @@ static void reduce_stroke_points(bGPDstroke *gps, const int num_points, const eB
gps->totpoints = num_points;
/* mark stroke as needing to have its geometry caches rebuilt */
gps->flag |= GP_STROKE_RECALC_CACHES;
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->tot_triangles = 0;
MEM_SAFE_FREE(gps->triangles);
}

View File

@ -196,8 +196,8 @@ typedef enum eGPDstroke_Flag {
GP_STROKE_2DIMAGE = (1 << 2),
/* stroke is selected */
GP_STROKE_SELECT = (1 << 3),
/* Recalculate triangulation for high quality fill (when true, force a new recalc) */
GP_STROKE_RECALC_CACHES = (1 << 4),
/* Recalculate geometry data (triangulation, UVs, Bound Box,... (when true, force a new recalc) */
GP_STROKE_RECALC_GEOMETRY = (1 << 4),
/* Flag used to indicate that stroke is closed and draw edge between last and first point */
GP_STROKE_CYCLIC = (1 << 7),
/* Flag used to indicate that stroke is used for fill close and must use fill color for stroke and no fill area */

View File

@ -528,7 +528,7 @@ static void rna_GPencil_stroke_point_add(ID *id, bGPDstroke *stroke, int count,
stroke->totpoints += count;
stroke->flag |= GP_STROKE_RECALC_CACHES;
stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
gpd->flag |= GP_DATA_PYTHON_UPDATED;
DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
@ -581,7 +581,7 @@ static void rna_GPencil_stroke_point_pop(ID *id, bGPDstroke *stroke, ReportList
MEM_freeN(pt_dvert);
}
stroke->flag |= GP_STROKE_RECALC_CACHES;
stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
gpd->flag |= GP_DATA_PYTHON_UPDATED;
DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);