[Bf-blender-cvs] [72e90c5db30] blender2.8: Cleanup: remove unused EditDerivedBMesh

Campbell Barton noreply at git.blender.org
Tue Oct 9 07:01:07 CEST 2018


Commit: 72e90c5db30d830b27a42f4d3689f453e092c267
Author: Campbell Barton
Date:   Tue Oct 9 15:57:38 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB72e90c5db30d830b27a42f4d3689f453e092c267

Cleanup: remove unused EditDerivedBMesh

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

M	source/blender/blenkernel/BKE_DerivedMesh.h
M	source/blender/blenkernel/BKE_editmesh.h
M	source/blender/blenkernel/intern/DerivedMesh.c
M	source/blender/blenkernel/intern/editderivedmesh.c

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

diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index 5a60fc25241..3db032da1b1 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -526,10 +526,6 @@ DerivedMesh *mesh_create_derived_render(
         struct Depsgraph *depsgraph, struct Scene *scene,
         struct Object *ob, CustomDataMask dataMask);
 
-DerivedMesh *getEditDerivedBMesh(
-        struct BMEditMesh *em, struct Object *ob, CustomDataMask data_mask,
-        float (*vertexCos)[3]);
-
 /* same as above but wont use render settings */
 DerivedMesh *mesh_create_derived(struct Mesh *me, float (*vertCos)[3]);
 DerivedMesh *mesh_create_derived_no_deform(
diff --git a/source/blender/blenkernel/BKE_editmesh.h b/source/blender/blenkernel/BKE_editmesh.h
index 09f9c3dfbcf..65c2caa4d78 100644
--- a/source/blender/blenkernel/BKE_editmesh.h
+++ b/source/blender/blenkernel/BKE_editmesh.h
@@ -41,6 +41,7 @@ struct Scene;
 struct DerivedMesh;
 struct MeshStatVis;
 struct Depsgraph;
+struct EditMeshData;
 
 /**
  * This structure is used for mesh edit-mode.
@@ -97,8 +98,8 @@ void        BKE_editmesh_lnorspace_update(BMEditMesh *em);
 
 /* editderivedmesh.c */
 /* should really be defined in editmesh.c, but they use 'EditDerivedBMesh' */
-void        BKE_editmesh_statvis_calc(BMEditMesh *em, struct DerivedMesh *dm,
-                                      const struct MeshStatVis *statvis);
+void BKE_editmesh_statvis_calc(
+        BMEditMesh *em, struct EditMeshData *emd, const struct MeshStatVis *statvis);
 
 float (*BKE_editmesh_vertexCos_get(
            struct Depsgraph *depsgraph, struct BMEditMesh *em, struct Scene *scene, int *r_numVerts))[3];
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index e5b12b97033..72823e7b1b4 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1259,11 +1259,12 @@ static void add_orco_mesh(
 	}
 }
 
-static void UNUSED_FUNCTION(DM_update_statvis_color)(const Scene *scene, Object *ob, DerivedMesh *dm)
+static void UNUSED_FUNCTION(DM_update_statvis_color)(const Scene *scene, Object *ob)
 {
 	BMEditMesh *em = BKE_editmesh_from_object(ob);
-
-	BKE_editmesh_statvis_calc(em, dm, &scene->toolsettings->statvis);
+	Mesh *me = ob->data;
+	BKE_mesh_runtime_ensure_edit_data(me);
+	BKE_editmesh_statvis_calc(em, me->runtime.edit_data, &scene->toolsettings->statvis);
 }
 
 static void shapekey_layers_to_keyblocks(DerivedMesh *dm, Mesh *me, int actshape_uid)
@@ -2129,7 +2130,7 @@ static void editbmesh_calc_modifiers(
 #if 0
 		/* In this case, we should never have weight-modifying modifiers in stack... */
 		if (do_init_statvis) {
-			DM_update_statvis_color(scene, ob, *r_final);
+			DM_update_statvis_color(scene, ob);
 		}
 #endif
 	}
@@ -2148,7 +2149,7 @@ static void editbmesh_calc_modifiers(
 #if 0
 		/* In this case, we should never have weight-modifying modifiers in stack... */
 		if (do_init_statvis) {
-			DM_update_statvis_color(scene, ob, *r_final);
+			DM_update_statvis_color(scene, ob);
 		}
 #endif
 	}
@@ -2953,7 +2954,6 @@ char *DM_debug_info(DerivedMesh *dm)
 	BLI_dynstr_appendf(dynstr, "    'ptr': '%p',\n", (void *)dm);
 	switch (dm->type) {
 		case DM_TYPE_CDDM:     tstr = "DM_TYPE_CDDM";     break;
-		case DM_TYPE_EDITBMESH: tstr = "DM_TYPE_EDITMESH";  break;
 		case DM_TYPE_CCGDM:    tstr = "DM_TYPE_CCGDM";     break;
 		default:               tstr = "UNKNOWN";           break;
 	}
diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c
index 38a6556dc21..5ca8bcfd74d 100644
--- a/source/blender/blenkernel/intern/editderivedmesh.c
+++ b/source/blender/blenkernel/intern/editderivedmesh.c
@@ -62,919 +62,6 @@
 
 #include "MEM_guardedalloc.h"
 
-typedef struct EditDerivedBMesh {
-	DerivedMesh dm;
-
-	BMEditMesh *em;
-
-	EditMeshData emd;
-} EditDerivedBMesh;
-
-/* -------------------------------------------------------------------- */
-/* Lazy initialize datastructures */
-
-static void emDM_ensurePolyNormals(EditDerivedBMesh *bmdm);
-
-static void emDM_ensureVertNormals(EditDerivedBMesh *bmdm)
-{
-	BKE_editmesh_cache_ensure_vert_normals(bmdm->em, &bmdm->emd);
-}
-
-static void emDM_ensurePolyNormals(EditDerivedBMesh *bmdm)
-{
-	BKE_editmesh_cache_ensure_poly_normals(bmdm->em, &bmdm->emd);
-}
-
-static void emDM_ensurePolyCenters(EditDerivedBMesh *bmdm)
-{
-	BKE_editmesh_cache_ensure_poly_centers(bmdm->em, &bmdm->emd);
-}
-
-static void emDM_calcNormals(DerivedMesh *dm)
-{
-	/* Nothing to do: normals are already calculated and stored on the
-	 * BMVerts and BMFaces */
-	dm->dirty &= ~DM_DIRTY_NORMALS;
-}
-
-static void emDM_calcLoopNormalsSpaceArray(
-        DerivedMesh *dm, const bool use_split_normals, const float split_angle, MLoopNorSpaceArray *r_lnors_spacearr);
-
-static void emDM_calcLoopNormals(DerivedMesh *dm, const bool use_split_normals, const float split_angle)
-{
-	emDM_calcLoopNormalsSpaceArray(dm, use_split_normals, split_angle, NULL);
-}
-
-/* #define DEBUG_CLNORS */
-
-static void emDM_calcLoopNormalsSpaceArray(
-        DerivedMesh *dm, const bool use_split_normals, const float split_angle, MLoopNorSpaceArray *r_lnors_spacearr)
-{
-	EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
-	BMesh *bm = bmdm->em->bm;
-	const float (*vertexCos)[3], (*vertexNos)[3], (*polyNos)[3];
-	float (*loopNos)[3];
-	short (*clnors_data)[2];
-	int cd_loop_clnors_offset;
-
-	/* calculate loop normals from poly and vertex normals */
-	emDM_ensureVertNormals(bmdm);
-	emDM_ensurePolyNormals(bmdm);
-	dm->dirty &= ~DM_DIRTY_NORMALS;
-
-	vertexCos = bmdm->emd.vertexCos;
-	vertexNos = bmdm->emd.vertexNos;
-	polyNos = bmdm->emd.polyNos;
-
-	loopNos = dm->getLoopDataArray(dm, CD_NORMAL);
-	if (!loopNos) {
-		DM_add_loop_layer(dm, CD_NORMAL, CD_CALLOC, NULL);
-		loopNos = dm->getLoopDataArray(dm, CD_NORMAL);
-	}
-
-	/* We can have both, give priority to dm's data, and fallback to bm's ones. */
-	clnors_data = dm->getLoopDataArray(dm, CD_CUSTOMLOOPNORMAL);
-	cd_loop_clnors_offset = clnors_data ? -1 : CustomData_get_offset(&bm->ldata, CD_CUSTOMLOOPNORMAL);
-
-	BM_loops_calc_normal_vcos(bm, vertexCos, vertexNos, polyNos, use_split_normals, split_angle, loopNos,
-	                          r_lnors_spacearr, clnors_data, cd_loop_clnors_offset, false);
-#ifdef DEBUG_CLNORS
-	if (r_lnors_spacearr) {
-		int i;
-		for (i = 0; i < numLoops; i++) {
-			if (r_lnors_spacearr->lspacearr[i]->ref_alpha != 0.0f) {
-				LinkNode *loops = r_lnors_spacearr->lspacearr[i]->loops;
-				printf("Loop %d uses lnor space %p:\n", i, r_lnors_spacearr->lspacearr[i]);
-				print_v3("\tfinal lnor:", loopNos[i]);
-				print_v3("\tauto lnor:", r_lnors_spacearr->lspacearr[i]->vec_lnor);
-				print_v3("\tref_vec:", r_lnors_spacearr->lspacearr[i]->vec_ref);
-				printf("\talpha: %f\n\tbeta: %f\n\tloops: %p\n", r_lnors_spacearr->lspacearr[i]->ref_alpha,
-				       r_lnors_spacearr->lspacearr[i]->ref_beta, r_lnors_spacearr->lspacearr[i]->loops);
-				printf("\t\t(shared with loops");
-				while (loops) {
-					printf(" %d", POINTER_AS_INT(loops->link));
-					loops = loops->next;
-				}
-				printf(")\n");
-			}
-			else {
-				printf("Loop %d has no lnor space\n", i);
-			}
-		}
-	}
-#endif
-}
-
-static void emDM_calc_loop_tangents(
-        DerivedMesh *dm, bool calc_active_tangent,
-        const char (*tangent_names)[MAX_NAME], int tangent_names_len)
-{
-	EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
-	BMEditMesh *em = bmdm->em;
-
-	if (CustomData_number_of_layers(&em->bm->ldata, CD_MLOOPUV) == 0) {
-		return;
-	}
-
-	const float (*poly_normals)[3] = bmdm->emd.polyNos;
-	const float (*loop_normals)[3] = CustomData_get_layer(&dm->loopData, CD_NORMAL);
-	const float (*vert_orco)[3] = dm->getVertDataArray(dm, CD_ORCO);  /* can be NULL */
-	BKE_editmesh_loop_tangent_calc(
-	        em, calc_active_tangent,
-	        tangent_names, tangent_names_len,
-	        poly_normals, loop_normals,
-	        vert_orco,
-	        &dm->loopData, dm->numLoopData,
-	        &dm->tangent_mask);
-}
-
-
-static void emDM_recalcTessellation(DerivedMesh *UNUSED(dm))
-{
-	/* do nothing */
-}
-
-static void emDM_recalcLoopTri(DerivedMesh *dm)
-{
-	EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
-	BMLoop *(*looptris)[3] = bmdm->em->looptris;
-	MLoopTri *mlooptri;
-	const int tottri = bmdm->em->tottri;
-	int i;
-
-	DM_ensure_looptri_data(dm);
-	mlooptri = dm->looptris.array_wip;
-
-	BLI_assert(tottri == 0 || mlooptri != NULL);
-	BLI_assert(poly_to_tri_count(dm->numPolyData, dm->numLoopData) == dm->looptris.num);
-	BLI_assert(tottri == dm->looptris.num);
-
-	BM_mesh_elem_index_ensure(bmdm->em->bm, BM_FACE | BM_LOOP);
-
-	for (i = 0; i < tottri; i++) {
-		BMLoop **ltri = looptris[i];
-		MLoopTri *lt = &mlooptri[i];
-
-		ARRAY_SET_ITEMS(
-		        lt->tri,
-		        BM_elem_index_get(ltri[0]),
-		        BM_elem_index_get(ltri[1]),
-		        BM_elem_index_get(ltri[2]));
-		lt->poly = BM_elem_index_get(ltri[0]->f);
-	}
-
-	BLI_assert(dm->looptris.array == NULL);
-	atomic_cas_ptr((void **)&dm->looptris.array, dm->looptris.array, dm->looptris.array_wip);
-	dm->looptris.array_wip = NULL;
-}
-
-static void emDM_foreachMappedVert(
-        DerivedMesh *dm,
-        void (*func)(void *userData, int index, const float co[3], const float no_f[3], const short no_s[3]),
-        void *userData,
-        DMForeachFlag flag)
-{
-	EditDerivedBMesh *bmdm = (EditDerivedBMesh *)dm;
-	BMesh *bm = bmdm->em->bm;
-	BMVert *eve;
-	BMIter iter;
-	int i;
-
-	if (bmdm->emd.vertexCos) {
-		const float (*vertexCos)[3] = bmdm->emd.vertexCos;
-		const float (*vertexNos)[3];
-
-		if (flag & DM_FOREACH_USE_NORMAL) {
-			emDM_ensureVertNormals(bmdm);
-			vertexNos = bmdm->emd.vertexNos;
-		}
-		else {
-			vertexNos = NULL;
-		}
-
-		BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) {
-			const float *no = (flag & DM_FOREACH_USE_NORMAL) ? vertexNos[i] : NULL;
-			func(userData, i, vertexCos[i], no, NULL);
-		}
-	}
-	else {
-		BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) {
-			const float *no = (flag & DM_FOREACH_USE_NORMAL) ? eve->no : NULL;
-			func(userData, i,

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list