Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-10-15 09:37:54 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-10-15 09:37:54 +0300
commitdbb35ff7c87fbd8d8156d5a250d9c153ee51fa49 (patch)
tree46c19f767dd1bf00a48dddf1b01bb0eb0233994d /source/blender
parent27389362a48a7d79df7c7f6df46760f27d421e6f (diff)
Cleanup: unused functions
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_DerivedMesh.h19
-rw-r--r--source/blender/blenkernel/BKE_cdderivedmesh.h11
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c213
-rw-r--r--source/blender/blenkernel/intern/cdderivedmesh.c170
4 files changed, 1 insertions, 412 deletions
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_materials(DerivedMesh *dm, Object *ob)
-{
- int i, totmat = ob->totcol + 1; /* materials start from 1, default material is 0 */
-
- if (dm->totmat != totmat) {
- dm->totmat = totmat;
- /* invalidate old materials */
- if (dm->mat)
- MEM_freeN(dm->mat);
-
- dm->mat = MEM_malloc_arrayN(totmat, sizeof(*dm->mat), "DerivedMesh.mat");
- }
-
- /* we leave last material as empty - rationale here is being able to index
- * the materials by using the mf->mat_nr directly and leaving the last
- * material as NULL in case no materials exist on mesh, so indexing will not fail */
- for (i = 0; i < totmat - 1; i++) {
- dm->mat[i] = give_current_material(ob, i + 1);
- }
- dm->mat[i] = NULL;
-}
-
-MLoopUV *DM_paint_uvlayer_active_get(DerivedMesh *dm, int mat_nr)
-{
- MLoopUV *uv_base;
-
- BLI_assert(mat_nr < dm->totmat);
-
- if (dm->mat[mat_nr] && dm->mat[mat_nr]->texpaintslot &&
- dm->mat[mat_nr]->texpaintslot[dm->mat[mat_nr]->paint_active_slot].uvname)
- {
- uv_base = CustomData_get_layer_named(&dm->loopData, CD_MLOOPUV,
- dm->mat[mat_nr]->texpaintslot[dm->mat[mat_nr]->paint_active_slot].uvname);
- /* This can fail if we have changed the name in the UV layer list and have assigned the old name in the material
- * texture slot.*/
- if (!uv_base)
- uv_base = CustomData_get_layer(&dm->loopData, CD_MLOOPUV);
- }
- else {
- uv_base = CustomData_get_layer(&dm->loopData, CD_MLOOPUV);
- }
-
- return uv_base;
-}
-
void DM_to_mesh(DerivedMesh *dm, Mesh *me, Object *ob, CustomDataMask mask, bool take_ownership)
{
/* dm might depend on me, so we need to do everything with a local copy */
@@ -1107,11 +899,6 @@ void DM_interp_tessface_data(
weights, (float *)vert_weights, count, dest_index);
}
-void DM_swap_tessface_data(DerivedMesh *dm, int index, const int *corner_indices)
-{
- CustomData_swap_corners(&dm->faceData, index, corner_indices);
-}
-
void DM_interp_loop_data(
DerivedMesh *source, DerivedMesh *dest,
int *src_indices,
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index ef418fc68f5..298a6ab0ec4 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -99,7 +99,7 @@ static int cdDM_getNumTessFaces(DerivedMesh *dm)
* to help debug tessfaces issues since BMESH merge. */
#if 0
if (dm->numTessFaceData == 0 && dm->numPolyData != 0) {
- printf("%s: has no faces!, call DM_ensure_tessface() if you need them\n");
+ printf("%s: has no faces!\n");
}
#endif
return dm->numTessFaceData;
@@ -1289,29 +1289,6 @@ void CDDM_calc_loop_normals_spacearr(
#endif
}
-
-void CDDM_calc_normals_tessface(DerivedMesh *dm)
-{
- CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
- float (*face_nors)[3];
-
- if (dm->numVertData == 0) return;
-
- /* we don't want to overwrite any referenced layers */
- cddm->mvert = CustomData_duplicate_referenced_layer(&dm->vertData, CD_MVERT, dm->numVertData);
-
- /* fill in if it exists */
- face_nors = CustomData_get_layer(&dm->faceData, CD_NORMAL);
- if (!face_nors) {
- face_nors = CustomData_add_layer(&dm->faceData, CD_NORMAL, CD_CALLOC, NULL, dm->numTessFaceData);
- }
-
- BKE_mesh_calc_normals_tessface(cddm->mvert, dm->numVertData,
- cddm->mface, dm->numTessFaceData, face_nors);
-
- cddm->dm.dirty &= ~DM_DIRTY_NORMALS;
-}
-
#if 1
/* TODO(sybren): Delete everything in this #if block after we have ported the modifiers
* to use Mesh instead of DerivedMesh. The code has been copied to mesh_merge.c and ported. */
@@ -1953,151 +1930,6 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
}
#endif
-void CDDM_calc_edges_tessface(DerivedMesh *dm)
-{
- CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
- CustomData edgeData;
- EdgeSetIterator *ehi;
- MFace *mf = cddm->mface;
- MEdge *med;
- EdgeSet *eh;
- int i, *index, numEdges, numFaces = dm->numTessFaceData;
-
- eh = BLI_edgeset_new_ex(__func__, BLI_EDGEHASH_SIZE_GUESS_FROM_POLYS(numFaces));
-
- for (i = 0; i < numFaces; i++, mf++) {
- BLI_edgeset_add(eh, mf->v1, mf->v2);
- BLI_edgeset_add(eh, mf->v2, mf->v3);
-
- if (mf->v4) {
- BLI_edgeset_add(eh, mf->v3, mf->v4);
- BLI_edgeset_add(eh, mf->v4, mf->v1);
- }
- else {
- BLI_edgeset_add(eh, mf->v3, mf->v1);
- }
- }
-
- numEdges = BLI_edgeset_len(eh);
-
- /* write new edges into a temporary CustomData */
- CustomData_reset(&edgeData);
- CustomData_add_layer(&edgeData, CD_MEDGE, CD_CALLOC, NULL, numEdges);
- CustomData_add_layer(&edgeData, CD_ORIGINDEX, CD_CALLOC, NULL, numEdges);
-
- med = CustomData_get_layer(&edgeData, CD_MEDGE);
- index = CustomData_get_layer(&edgeData, CD_ORIGINDEX);
-
- for (ehi = BLI_edgesetIterator_new(eh), i = 0;
- BLI_edgesetIterator_isDone(ehi) == false;
- BLI_edgesetIterator_step(ehi), i++, med++, index++)
- {
- BLI_edgesetIterator_getKey(ehi, &med->v1, &med->v2);
-
- med->flag = ME_EDGEDRAW | ME_EDGERENDER;
- *index = ORIGINDEX_NONE;
- }
- BLI_edgesetIterator_free(ehi);
-
- /* free old CustomData and assign new one */
- CustomData_free(&dm->edgeData, dm->numEdgeData);
- dm->edgeData = edgeData;
- dm->numEdgeData = numEdges;
-
- cddm->medge = CustomData_get_layer(&dm->edgeData, CD_MEDGE);
-
- BLI_edgeset_free(eh);
-}
-
-/* warning, this uses existing edges but CDDM_calc_edges_tessface() doesn't */
-void CDDM_calc_edges(DerivedMesh *dm)
-{
- CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
- CustomData edgeData;
- EdgeHashIterator *ehi;
- MPoly *mp = cddm->mpoly;
- MLoop *ml;
- MEdge *med, *origmed;
- EdgeHash *eh;
- unsigned int eh_reserve;
- int v1, v2;
- const int *eindex;
- int i, j, *index;
- const int numFaces = dm->numPolyData;
- const int numLoops = dm->numLoopData;
- int numEdges = dm->numEdgeData;
-
- eindex = DM_get_edge_data_layer(dm, CD_ORIGINDEX);
- med = cddm->medge;
-
- eh_reserve = max_ii(med ? numEdges : 0, BLI_EDGEHASH_SIZE_GUESS_FROM_LOOPS(numLoops));
- eh = BLI_edgehash_new_ex(__func__, eh_reserve);
- if (med) {
- for (i = 0; i < numEdges; i++, med++) {
- BLI_edgehash_insert(eh, med->v1, med->v2, POINTER_FROM_INT(i + 1));
- }
- }
-
- for (i = 0; i < numFaces; i++, mp++) {
- ml = cddm->mloop + mp->loopstart;
- for (j = 0; j < mp->totloop; j++, ml++) {
- v1 = ml->v;
- v2 = ME_POLY_LOOP_NEXT(cddm->mloop, mp, j)->v;
- BLI_edgehash_reinsert(eh, v1, v2, NULL);
- }
- }
-
- numEdges = BLI_edgehash_len(eh);
-
- /* write new edges into a temporary CustomData */
- CustomData_reset(&edgeData);
- CustomData_add_layer(&edgeData, CD_MEDGE, CD_CALLOC, NULL, numEdges);
- CustomData_add_layer(&edgeData, CD_ORIGINDEX, CD_CALLOC, NULL, numEdges);
-
- origmed = cddm->medge;
- med = CustomData_get_layer(&edgeData, CD_MEDGE);
- index = CustomData_get_layer(&edgeData, CD_ORIGINDEX);
-
- for (ehi = BLI_edgehashIterator_new(eh), i = 0;
- BLI_edgehashIterator_isDone(ehi) == false;
- BLI_edgehashIterator_step(ehi), ++i, ++med, ++index)
- {
- BLI_edgehashIterator_getKey(ehi, &med->v1, &med->v2);
- j = POINTER_AS_INT(BLI_edgehashIterator_getValue(ehi));
-
- if (j == 0 || !eindex) {
- med->flag = ME_EDGEDRAW | ME_EDGERENDER;
- *index = ORIGINDEX_NONE;
- }
- else {
- med->flag = ME_EDGEDRAW | ME_EDGERENDER | origmed[j - 1].flag;
- *index = eindex[j - 1];
- }
-
- BLI_edgehashIterator_setValue(ehi, POINTER_FROM_INT(i));
- }
- BLI_edgehashIterator_free(ehi);
-
- /* free old CustomData and assign new one */
- CustomData_free(&dm->edgeData, dm->numEdgeData);
- dm->edgeData = edgeData;
- dm->numEdgeData = numEdges;
-
- cddm->medge = CustomData_get_layer(&dm->edgeData, CD_MEDGE);
-
- mp = cddm->mpoly;
- for (i = 0; i < numFaces; i++, mp++) {
- ml = cddm->mloop + mp->loopstart;
- for (j = 0; j < mp->totloop; j++, ml++) {
- v1 = ml->v;
- v2 = ME_POLY_LOOP_NEXT(cddm->mloop, mp, j)->v;
- ml->e = POINTER_AS_INT(BLI_edgehash_lookup(eh, v1, v2));
- }
- }
-
- BLI_edgehash_free(eh, NULL);
-}
-
void CDDM_lower_num_verts(DerivedMesh *dm, int numVerts)
{
BLI_assert(numVerts >= 0);