Cleanup: naming for mesh dirty flags

- NOCHECK -> ALL
- ALL -> MAYBE_ALL

Where 'MAYBE_ALL' checks to see if the mesh has changed.
This is clearer that `BKE_MESH_BATCH_DIRTY_ALL` is dirty and
going to be updated without any guess-work.
This commit is contained in:
2017-08-22 22:04:40 +10:00
parent 9457715d9a
commit 2f19559258
13 changed files with 30 additions and 30 deletions

View File

@@ -408,8 +408,8 @@ void BKE_mesh_eval_geometry(const struct EvaluationContext *eval_ctx,
/* Draw Cache */
enum {
BKE_MESH_BATCH_DIRTY_ALL = 0,
BKE_MESH_BATCH_DIRTY_MAYBE_ALL,
BKE_MESH_BATCH_DIRTY_SELECT,
BKE_MESH_BATCH_DIRTY_NOCHECK,
BKE_MESH_BATCH_DIRTY_SHADING,
BKE_MESH_BATCH_DIRTY_SCULPT_COORDS,
};

View File

@@ -74,7 +74,7 @@ bDeformGroup *BKE_defgroup_new(Object *ob, const char *name)
BLI_addtail(&ob->defbase, defgroup);
defgroup_unique_name(defgroup, ob);
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_NOCHECK);
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
return defgroup;
}

View File

@@ -407,7 +407,7 @@ void BKE_object_defgroup_remove(Object *ob, bDeformGroup *defgroup)
else
object_defgroup_remove_object_mode(ob, defgroup);
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_NOCHECK);
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
}
/**

View File

@@ -337,7 +337,7 @@ void BKE_object_eval_uber_data(const EvaluationContext *eval_ctx,
switch (ob->type) {
case OB_MESH:
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_MAYBE_ALL);
break;
case OB_LATTICE:
BKE_lattice_batch_cache_dirty(ob->data, BKE_LATTICE_BATCH_DIRTY_ALL);

View File

@@ -1494,8 +1494,8 @@ typedef struct MeshBatchCache {
Gwn_Batch *overlay_paint_edges;
/* settings to determine if cache is invalid */
bool is_dirty;
bool is_really_dirty; /* Instantly invalidates cache, skipping mesh check */
bool is_maybe_dirty;
bool is_dirty; /* Instantly invalidates cache, skipping mesh check */
int edge_len;
int tri_len;
int poly_len;
@@ -1519,18 +1519,18 @@ static bool mesh_batch_cache_valid(Mesh *me)
/* XXX find another place for this */
if (cache->mat_len != mesh_render_mat_len_get(me)) {
cache->is_dirty = true;
cache->is_maybe_dirty = true;
}
if (cache->is_editmode != (me->edit_btmesh != NULL)) {
return false;
}
if (cache->is_really_dirty) {
if (cache->is_dirty) {
return false;
}
if (cache->is_dirty == false) {
if (cache->is_maybe_dirty == false) {
return true;
}
else {
@@ -1572,8 +1572,8 @@ static void mesh_batch_cache_init(Mesh *me)
cache->mat_len = mesh_render_mat_len_get(me);
cache->is_maybe_dirty = false;
cache->is_dirty = false;
cache->is_really_dirty = false;
}
static MeshBatchCache *mesh_batch_cache_get(Mesh *me)
@@ -1592,8 +1592,8 @@ void DRW_mesh_batch_cache_dirty(Mesh *me, int mode)
return;
}
switch (mode) {
case BKE_MESH_BATCH_DIRTY_ALL:
cache->is_dirty = true;
case BKE_MESH_BATCH_DIRTY_MAYBE_ALL:
cache->is_maybe_dirty = true;
break;
case BKE_MESH_BATCH_DIRTY_SELECT:
GWN_VERTBUF_DISCARD_SAFE(cache->ed_tri_data);
@@ -1612,13 +1612,13 @@ void DRW_mesh_batch_cache_dirty(Mesh *me, int mode)
GWN_BATCH_DISCARD_SAFE(cache->edges_with_select_id);
GWN_BATCH_DISCARD_SAFE(cache->verts_with_select_id);
break;
case BKE_MESH_BATCH_DIRTY_NOCHECK:
cache->is_really_dirty = true;
case BKE_MESH_BATCH_DIRTY_ALL:
cache->is_dirty = true;
break;
case BKE_MESH_BATCH_DIRTY_SHADING:
/* TODO: This should only update UV and tangent data,
* and not free the entire cache. */
cache->is_really_dirty = true;
cache->is_dirty = true;
break;
case BKE_MESH_BATCH_DIRTY_SCULPT_COORDS:
cache->is_sculpt_points_tag = true;

View File

@@ -92,7 +92,7 @@ static void PAINT_WEIGHT_engine_init(void *UNUSED(vedata))
if (e_data.actdef != draw_ctx->obact->actdef) {
e_data.actdef = draw_ctx->obact->actdef;
BKE_mesh_batch_cache_dirty(draw_ctx->obact->data, BKE_MESH_BATCH_DIRTY_NOCHECK);
BKE_mesh_batch_cache_dirty(draw_ctx->obact->data, BKE_MESH_BATCH_DIRTY_ALL);
}
if (!e_data.weight_face_shader) {

View File

@@ -107,7 +107,7 @@ void paintface_flush_flags(Object *ob, short flag)
GPU_drawobject_free(dm);
}
BKE_mesh_batch_cache_dirty(me, BKE_MESH_BATCH_DIRTY_NOCHECK);
BKE_mesh_batch_cache_dirty(me, BKE_MESH_BATCH_DIRTY_ALL);
}
void paintface_hide(Object *ob, const bool unselected)
@@ -518,7 +518,7 @@ void paintvert_flush_flags(Object *ob)
}
}
BKE_mesh_batch_cache_dirty(me, BKE_MESH_BATCH_DIRTY_NOCHECK);
BKE_mesh_batch_cache_dirty(me, BKE_MESH_BATCH_DIRTY_ALL);
}
/* note: if the caller passes false to flush_flags, then they will need to run paintvert_flush_flags(ob) themselves */
void paintvert_deselect_all_visible(Object *ob, int action, bool flush_flags)

View File

@@ -1263,7 +1263,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op)
if (ob->type == OB_MESH) {
BKE_mesh_smooth_flag_set(ob, !clear);
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_NOCHECK);
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
DEG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);

View File

@@ -1091,7 +1091,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op)
for (tob = bmain->object.first; tob; tob = tob->id.next) {
if (tob->data && (((ID *)tob->data)->tag & LIB_TAG_DOIT)) {
BKE_mesh_batch_cache_dirty(tob->data, BKE_MESH_BATCH_DIRTY_NOCHECK);
BKE_mesh_batch_cache_dirty(tob->data, BKE_MESH_BATCH_DIRTY_ALL);
DEG_id_tag_update(&tob->id, OB_RECALC_OB | OB_RECALC_DATA);
}
}

View File

@@ -1825,7 +1825,7 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op)
ED_vgroup_sync_from_pose(ob);
}
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_NOCHECK);
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
/* Weightpaint works by overriding colors in mesh,
* so need to make sure we recalc on enter and
@@ -2391,7 +2391,7 @@ static void wpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
/* also needed for "View Selected" on last stroke */
paint_last_stroke_update(scene, vc->ar, mval);
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_NOCHECK);
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
DEG_id_tag_update(ob->data, 0);
ED_region_tag_redraw(vc->ar);
@@ -2598,7 +2598,7 @@ static int vpaint_mode_toggle_exec(bContext *C, wmOperator *op)
BKE_paint_init(scene, ePaintVertex, PAINT_CURSOR_VERTEX_PAINT);
}
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_NOCHECK);
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
/* update modifier stack for mapping requirements */
DEG_id_tag_update(&me->id, 0);
@@ -2874,7 +2874,7 @@ static void vpaint_stroke_update_step(bContext *C, struct PaintStroke *stroke, P
/* also needed for "View Selected" on last stroke */
paint_last_stroke_update(scene, vc->ar, mval);
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_NOCHECK);
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
ED_region_tag_redraw(vc->ar);

View File

@@ -239,7 +239,7 @@ static void rna_Mesh_update_data_edit_color(Main *bmain, Scene *scene, PointerRN
static void rna_Mesh_update_data_edit_weight(Main *bmain, Scene *scene, PointerRNA *ptr)
{
BKE_mesh_batch_cache_dirty(rna_mesh(ptr), BKE_MESH_BATCH_DIRTY_NOCHECK);
BKE_mesh_batch_cache_dirty(rna_mesh(ptr), BKE_MESH_BATCH_DIRTY_ALL);
rna_Mesh_update_data(bmain, scene, ptr);
}
@@ -247,7 +247,7 @@ static void rna_Mesh_update_data_edit_weight(Main *bmain, Scene *scene, PointerR
static void rna_Mesh_update_data_edit_active_color(Main *bmain, Scene *scene, PointerRNA *ptr)
{
BKE_mesh_batch_cache_dirty(rna_mesh(ptr), BKE_MESH_BATCH_DIRTY_NOCHECK);
BKE_mesh_batch_cache_dirty(rna_mesh(ptr), BKE_MESH_BATCH_DIRTY_ALL);
rna_Mesh_update_data(bmain, scene, ptr);
}
@@ -277,7 +277,7 @@ static void rna_Mesh_update_vertmask(Main *bmain, Scene *scene, PointerRNA *ptr)
me->editflag &= ~ME_EDIT_PAINT_FACE_SEL;
}
BKE_mesh_batch_cache_dirty(me, BKE_MESH_BATCH_DIRTY_NOCHECK);
BKE_mesh_batch_cache_dirty(me, BKE_MESH_BATCH_DIRTY_ALL);
rna_Mesh_update_draw(bmain, scene, ptr);
}
@@ -289,7 +289,7 @@ static void rna_Mesh_update_facemask(Main *bmain, Scene *scene, PointerRNA *ptr)
me->editflag &= ~ME_EDIT_PAINT_VERT_SEL;
}
BKE_mesh_batch_cache_dirty(me, BKE_MESH_BATCH_DIRTY_NOCHECK);
BKE_mesh_batch_cache_dirty(me, BKE_MESH_BATCH_DIRTY_ALL);
rna_Mesh_update_draw(bmain, scene, ptr);
}

View File

@@ -217,7 +217,7 @@ static void rna_Mesh_split_faces(Mesh *mesh, int free_loop_normals)
static void rna_Mesh_update_gpu_tag(Mesh *mesh)
{
BKE_mesh_batch_cache_dirty(mesh, BKE_MESH_BATCH_DIRTY_NOCHECK);
BKE_mesh_batch_cache_dirty(mesh, BKE_MESH_BATCH_DIRTY_ALL);
}

View File

@@ -2703,7 +2703,7 @@ static void rna_LayerCollectionEngineSettings_wire_update(bContext *C, PointerRN
Object *ob = OBACT_NEW(sl);
if (ob != NULL && ob->type == OB_MESH) {
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_NOCHECK);
BKE_mesh_batch_cache_dirty(ob->data, BKE_MESH_BATCH_DIRTY_ALL);
}
/* TODO(sergey): Use proper flag for tagging here. */