[Bf-blender-cvs] [dbb35ff7c87] blender2.8: Cleanup: unused functions

Campbell Barton noreply at git.blender.org
Mon Oct 15 08:40:14 CEST 2018


Commit: dbb35ff7c87fbd8d8156d5a250d9c153ee51fa49
Author: Campbell Barton
Date:   Mon Oct 15 17:37:54 2018 +1100
Branches: blender2.8
https://developer.blender.org/rBdbb35ff7c87fbd8d8156d5a250d9c153ee51fa49

Cleanup: unused functions

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

M	source/blender/blenkernel/BKE_DerivedMesh.h
M	source/blender/blenkernel/BKE_cdderivedmesh.h
M	source/blender/blenkernel/intern/DerivedMesh.c
M	source/blender/blenkernel/intern/cdderivedmesh.c

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

diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h
index 4c43dd1e6d3..bdd4c3778f6 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -85,18 +85,13 @@ struct CCGKey;
 struct MVert;
 struct MEdge;
 struct MFace;
-struct MTFace;
 struct Object;
 struct Scene;
 struct Mesh;
 struct MLoopNorSpaceArray;
 struct BMEditMesh;
-struct KeyBlock;
 struct ModifierData;
-struct MCol;
-struct ColorBand;
 struct Depsgraph;
-struct GPUVertexAttribs;
 struct PBVH;
 
 /* number of sub-elements each mesh element has (for interpolation) */
@@ -464,16 +459,8 @@ void DM_free_poly_data(struct DerivedMesh *dm, int index, int count);
 void DM_DupPolys(DerivedMesh *source, DerivedMesh *target);
 
 void DM_ensure_normals(DerivedMesh *dm);
-void DM_ensure_tessface(DerivedMesh *dm);
 
 void DM_ensure_looptri_data(DerivedMesh *dm);
-void DM_verttri_from_looptri(MVertTri *verttri, const MLoop *mloop, const MLoopTri *looptri, int looptri_num);
-
-void DM_update_tessface_data(DerivedMesh *dm);
-void DM_generate_tangent_tessface_data(DerivedMesh *dm, bool generate);
-
-void DM_update_materials(DerivedMesh *dm, struct Object *ob);
-struct MLoopUV *DM_paint_uvlayer_active_get(DerivedMesh *dm, int mat_nr);
 
 void DM_interp_vert_data(
         struct DerivedMesh *source, struct DerivedMesh *dest,
@@ -494,8 +481,6 @@ void DM_interp_tessface_data(
         float *weights, FaceVertWeight *vert_weights,
         int count, int dest_index);
 
-void DM_swap_tessface_data(struct DerivedMesh *dm, int index, const int *corner_indices);
-
 void DM_interp_loop_data(
         struct DerivedMesh *source, struct DerivedMesh *dest,
         int *src_indices,
@@ -550,10 +535,6 @@ void makeDerivedMesh(
         struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct BMEditMesh *em,
         CustomDataMask dataMask, const bool build_shapekey_layers);
 
-void DM_calc_tangents_names_from_gpu(
-        const struct GPUVertexAttribs *gattribs,
-        char (*tangent_names)[MAX_NAME], int *tangent_names_count);
-
 void DM_add_named_tangent_layer_for_uv(
         CustomData *uv_data, CustomData *tan_data, int numLoopData,
         const char *layer_name);
diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h
index 6d96bd6ab7c..0d2d6057e8a 100644
--- a/source/blender/blenkernel/BKE_cdderivedmesh.h
+++ b/source/blender/blenkernel/BKE_cdderivedmesh.h
@@ -117,22 +117,11 @@ void CDDM_apply_vert_normals(struct DerivedMesh *cddm, short (*vertNormals)[3]);
 void CDDM_calc_normals_mapping_ex(struct DerivedMesh *dm, const bool only_face_normals);
 void CDDM_calc_normals_mapping(struct DerivedMesh *dm);
 void CDDM_calc_normals(struct DerivedMesh *dm);
-void CDDM_calc_normals_tessface(struct DerivedMesh *dm);
 
 void CDDM_calc_loop_normals(struct DerivedMesh *dm, const bool use_split_normals, const float split_angle);
 void CDDM_calc_loop_normals_spacearr(struct DerivedMesh *dm, const bool use_split_normals, const float split_angle,
                                      struct MLoopNorSpaceArray *r_lnors_spacearr);
 
-/* calculates edges for a CDDerivedMesh (from face data)
- * this completely replaces the current edge data in the DerivedMesh
- * builds edges from the tessellated face data.
- */
-void CDDM_calc_edges_tessface(struct DerivedMesh *dm);
-
-/* same as CDDM_calc_edges_tessface only makes edges from ngon faces instead of tessellation
- * faces*/
-void CDDM_calc_edges(struct DerivedMesh *dm);
-
 /* reconstitute face triangulation */
 void CDDM_recalc_tessellation(struct DerivedMesh *dm);
 void CDDM_recalc_tessellation_ex(struct DerivedMesh *dm, const bool do_face_nor_cpy);
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index 01908031431..00f2454d53b 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -70,7 +70,6 @@
 #include "BKE_multires.h"
 #include "BKE_bvhutils.h"
 #include "BKE_deform.h"
-#include "BKE_global.h" /* For debug flag, DM_update_tessface_data() func. */
 
 #include "BLI_sys_types.h" /* for intptr_t support */
 
@@ -464,33 +463,6 @@ void DM_ensure_normals(DerivedMesh *dm)
 	BLI_assert((dm->dirty & DM_DIRTY_NORMALS) == 0);
 }
 
-/* note: until all modifiers can take MPoly's as input,
- * use this at the start of modifiers  */
-void DM_ensure_tessface(DerivedMesh *dm)
-{
-	const int numTessFaces = dm->getNumTessFaces(dm);
-	const int numPolys =     dm->getNumPolys(dm);
-
-	if ((numTessFaces == 0) && (numPolys != 0)) {
-		dm->recalcTessellation(dm);
-
-		if (dm->getNumTessFaces(dm) != 0) {
-			/* printf("info %s: polys -> ngons calculated\n", __func__); */
-		}
-		else {
-			printf("warning %s: could not create tessfaces from %d polygons, dm->type=%u\n",
-			       __func__, numPolys, dm->type);
-		}
-	}
-
-	else if (dm->dirty & DM_DIRTY_TESS_CDLAYERS) {
-		BLI_assert(CustomData_has_layer(&dm->faceData, CD_ORIGINDEX) || numTessFaces == 0);
-		DM_update_tessface_data(dm);
-	}
-
-	dm->dirty &= ~DM_DIRTY_TESS_CDLAYERS;
-}
-
 /**
  * Ensure the array is large enough
  *
@@ -525,186 +497,6 @@ void DM_ensure_looptri_data(DerivedMesh *dm)
 	}
 }
 
-void DM_verttri_from_looptri(MVertTri *verttri, const MLoop *mloop, const MLoopTri *looptri, int looptri_num)
-{
-	int i;
-	for (i = 0; i < looptri_num; i++) {
-		verttri[i].tri[0] = mloop[looptri[i].tri[0]].v;
-		verttri[i].tri[1] = mloop[looptri[i].tri[1]].v;
-		verttri[i].tri[2] = mloop[looptri[i].tri[2]].v;
-	}
-}
-
-/* Update tessface CD data from loop/poly ones. Needed when not retessellating after modstack evaluation. */
-/* NOTE: Assumes dm has valid tessellated data! */
-void DM_update_tessface_data(DerivedMesh *dm)
-{
-	MFace *mf, *mface = dm->getTessFaceArray(dm);
-	MPoly *mp = dm->getPolyArray(dm);
-	MLoop *ml = dm->getLoopArray(dm);
-
-	CustomData *fdata = dm->getTessFaceDataLayout(dm);
-	CustomData *ldata = dm->getLoopDataLayout(dm);
-
-	const int totface = dm->getNumTessFaces(dm);
-	int mf_idx;
-
-	int *polyindex = CustomData_get_layer(fdata, CD_ORIGINDEX);
-	unsigned int (*loopindex)[4];
-
-	/* Should never occur, but better abort than segfault! */
-	if (!polyindex)
-		return;
-
-	CustomData_from_bmeshpoly(fdata, ldata, totface);
-
-	if (CustomData_has_layer(fdata, CD_MTFACE) ||
-	    CustomData_has_layer(fdata, CD_MCOL) ||
-	    CustomData_has_layer(fdata, CD_PREVIEW_MCOL) ||
-	    CustomData_has_layer(fdata, CD_ORIGSPACE) ||
-	    CustomData_has_layer(fdata, CD_TESSLOOPNORMAL) ||
-	    CustomData_has_layer(fdata, CD_TANGENT))
-	{
-		loopindex = MEM_malloc_arrayN(totface, sizeof(*loopindex), __func__);
-
-		for (mf_idx = 0, mf = mface; mf_idx < totface; mf_idx++, mf++) {
-			const int mf_len = mf->v4 ? 4 : 3;
-			unsigned int *ml_idx = loopindex[mf_idx];
-			int i, not_done;
-
-			/* Find out loop indices. */
-			/* NOTE: This assumes tessface are valid and in sync with loop/poly... Else, most likely, segfault! */
-			for (i = mp[polyindex[mf_idx]].loopstart, not_done = mf_len; not_done; i++) {
-				const int tf_v = BKE_MESH_TESSFACE_VINDEX_ORDER(mf, ml[i].v);
-				if (tf_v != -1) {
-					ml_idx[tf_v] = i;
-					not_done--;
-				}
-			}
-		}
-
-		/* NOTE: quad detection issue - fourth vertidx vs fourth loopidx:
-		 * Here, our tfaces' fourth vertex index is never 0 for a quad. However, we know our fourth loop index may be
-		 * 0 for quads (because our quads may have been rotated compared to their org poly, see tessellation code).
-		 * So we pass the MFace's, and BKE_mesh_loops_to_tessdata will use MFace->v4 index as quad test.
-		 */
-		BKE_mesh_loops_to_tessdata(fdata, ldata, mface, polyindex, loopindex, totface);
-
-		MEM_freeN(loopindex);
-	}
-
-	if (G.debug & G_DEBUG)
-		printf("%s: Updated tessellated customdata of dm %p\n", __func__, dm);
-
-	dm->dirty &= ~DM_DIRTY_TESS_CDLAYERS;
-}
-
-void DM_generate_tangent_tessface_data(DerivedMesh *dm, bool generate)
-{
-	MFace *mf, *mface = dm->getTessFaceArray(dm);
-	MPoly *mp = dm->getPolyArray(dm);
-	MLoop *ml = dm->getLoopArray(dm);
-
-	CustomData *fdata = dm->getTessFaceDataLayout(dm);
-	CustomData *ldata = dm->getLoopDataLayout(dm);
-
-	const int totface = dm->getNumTessFaces(dm);
-	int mf_idx;
-
-	int *polyindex = CustomData_get_layer(fdata, CD_ORIGINDEX);
-	unsigned int (*loopindex)[4] = NULL;
-
-	/* Should never occur, but better abort than segfault! */
-	if (!polyindex)
-		return;
-
-	if (generate) {
-		for (int j = 0; j < ldata->totlayer; j++) {
-			if (ldata->layers[j].type == CD_TANGENT) {
-				CustomData_add_layer_named(fdata, CD_TANGENT, CD_CALLOC, NULL, totface, ldata->layers[j].name);
-				CustomData_bmesh_update_active_layers(fdata, ldata);
-
-				if (!loopindex) {
-					loopindex = MEM_malloc_arrayN(totface, sizeof(*loopindex), __func__);
-					for (mf_idx = 0, mf = mface; mf_idx < totface; mf_idx++, mf++) {
-						const int mf_len = mf->v4 ? 4 : 3;
-						unsigned int *ml_idx = loopindex[mf_idx];
-
-						/* Find out loop indices. */
-						/* NOTE: This assumes tessface are valid and in sync with loop/poly... Else, most likely, segfault! */
-						for (int i = mp[polyindex[mf_idx]].loopstart, not_done = mf_len; not_done; i++) {
-							const int tf_v = BKE_MESH_TESSFACE_VINDEX_ORDER(mf, ml[i].v);
-							if (tf_v != -1) {
-								ml_idx[tf_v] = i;
-								not_done--;
-							}
-						}
-					}
-				}
-
-				/* NOTE: quad detection issue - fourth vertidx vs fourth loopidx:
-				 * Here, our tfaces' fourth vertex index is never 0 for a quad. However, we know our fourth loop index may be
-				 * 0 for quads (because our quads may have been rotated compared to their org poly, see tessellation code).
-				 * So we pass the MFace's, and BKE_mesh_loops_to_tessdata will use MFace->v4 index as quad test.
-				 */
-				BKE_mesh_tangent_loops_to_tessdata(fdata, ldata, mface, polyindex, loopindex, totface, ldata->layers[j].name);
-			}
-		}
-		if (loopindex)
-			MEM_freeN(loopindex);
-		BLI_assert(CustomData_from_bmeshpoly_test(fdata, ldata, true));
-	}
-
-	if (G.debug & G_DEBUG)
-		printf("%s: Updated tessellated tangents of dm %p\n", __func__, dm);
-}
-
-
-void DM_update_mate

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list