[Bf-blender-cvs] [2f195592587] blender2.8: Cleanup: naming for mesh dirty flags

Campbell Barton noreply at git.blender.org
Tue Aug 22 14:06:17 CEST 2017


Commit: 2f195592587c652c7bf84bf26a6805e41773c2d5
Author: Campbell Barton
Date:   Tue Aug 22 22:04:40 2017 +1000
Branches: blender2.8
https://developer.blender.org/rB2f195592587c652c7bf84bf26a6805e41773c2d5

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.

===================================================================

M	source/blender/blenkernel/BKE_mesh.h
M	source/blender/blenkernel/intern/deform.c
M	source/blender/blenkernel/intern/object_deform.c
M	source/blender/blenkernel/intern/object_update.c
M	source/blender/draw/intern/draw_cache_impl_mesh.c
M	source/blender/draw/modes/paint_weight_mode.c
M	source/blender/editors/mesh/editface.c
M	source/blender/editors/object/object_edit.c
M	source/blender/editors/object/object_transform.c
M	source/blender/editors/sculpt_paint/paint_vertex.c
M	source/blender/makesrna/intern/rna_mesh.c
M	source/blender/makesrna/intern/rna_mesh_api.c
M	source/blender/makesrna/intern/rna_scene.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index 9463ea81bfc..5ee3b9be5f9 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -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,
 };
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 584942628fa..1fc83b69bfe 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -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;
 }
diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c
index 887618415be..81fa25b1b03 100644
--- a/source/blender/blenkernel/intern/object_deform.c
+++ b/source/blender/blenkernel/intern/object_deform.c
@@ -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);
 }
 
 /**
diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c
index c5d267ace9d..99010c7a9fc 100644
--- a/source/blender/blenkernel/intern/object_update.c
+++ b/source/blender/blenkernel/intern/object_update.c
@@ -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);
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index f77411c91e8..6b3ef31f8dd 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -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;
diff --git a/source/blender/draw/modes/paint_weight_mode.c b/source/blender/draw/modes/paint_weight_mode.c
index 809be5ef8b1..d837b273404 100644
--- a/source/blender/draw/modes/paint_weight_mode.c
+++ b/source/blender/draw/modes/paint_weight_mode.c
@@ -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) {
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index 94fe433e5d7..870eb68600a 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -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)
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 953dedab02d..d9d81cbc1fd 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -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);
 
diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c
index 32c342f9f02..944fbb0bbe1 100644
--- a/source/blender/editors/object/object_transform.c
+++ b/source/blender/editors/object/object_transform.c
@@ -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);
 		}
 	}
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 321ce1fe306..2da808b3a78 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -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);
 
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index 8ff5474ed91..e94b724043f 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -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_NOCH

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list