Cleanup: reduce CDDM use, remove unused function calls

This commit is contained in:
Campbell Barton 2020-02-26 14:24:57 +11:00
parent 00a3d99f93
commit c8d31807d2
17 changed files with 30 additions and 155 deletions

View File

@ -48,7 +48,6 @@ extern "C" {
#include "DNA_scene_types.h"
#include "BKE_cachefile.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_global.h"

View File

@ -22,59 +22,24 @@
* \section aboutcdderivedmesh CDDerivedMesh interface
* CDDerivedMesh (CD = Custom Data) is a DerivedMesh backend which stores
* mesh elements (vertices, edges and faces) as layers of custom element data.
*
* \note This is deprecated & should eventually be removed.
*/
#ifndef __BKE_CDDERIVEDMESH_H__
#define __BKE_CDDERIVEDMESH_H__
#include "BKE_DerivedMesh.h"
#include "BKE_customdata.h"
struct BMEditMesh;
struct CustomData_MeshMasks;
struct DerivedMesh;
struct Mesh;
/* creates a new CDDerivedMesh */
struct DerivedMesh *CDDM_new(int numVerts, int numEdges, int numFaces, int numLoops, int numPolys);
/* creates a CDDerivedMesh from the given Mesh, this will reference the
* original data in Mesh, but it is safe to apply vertex coordinates or
* calculate normals as those functions will automatically create new
* data to not overwrite the original */
* data to not overwrite the original. */
struct DerivedMesh *CDDM_from_mesh(struct Mesh *mesh);
/* creates a CDDerivedMesh from the given Mesh with custom allocation type. */
struct DerivedMesh *CDDM_from_mesh_ex(struct Mesh *mesh,
eCDAllocType alloctype,
const struct CustomData_MeshMasks *mask);
/* Copies the given DerivedMesh with verts, faces & edges stored as
* custom element data.
*/
* custom element data. */
struct DerivedMesh *CDDM_copy(struct DerivedMesh *dm);
void CDDM_recalc_looptri(struct DerivedMesh *dm);
/* vertex/edge/face access functions
* should always succeed if index is within bounds
* note these return pointers - any change modifies the internals of the mesh
*/
struct MVert *CDDM_get_vert(struct DerivedMesh *dm, int index);
struct MEdge *CDDM_get_edge(struct DerivedMesh *dm, int index);
struct MFace *CDDM_get_tessface(struct DerivedMesh *dm, int index);
struct MLoop *CDDM_get_loop(struct DerivedMesh *dm, int index);
struct MPoly *CDDM_get_poly(struct DerivedMesh *dm, int index);
/* vertex/edge/face array access functions - return the array holding the
* desired data
* should always succeed
* note these return pointers - any change modifies the internals of the mesh
*/
struct MVert *CDDM_get_verts(struct DerivedMesh *dm);
struct MEdge *CDDM_get_edges(struct DerivedMesh *dm);
struct MFace *CDDM_get_tessfaces(struct DerivedMesh *dm);
struct MLoop *CDDM_get_loops(struct DerivedMesh *dm);
struct MPoly *CDDM_get_polys(struct DerivedMesh *dm);
#endif

View File

@ -129,7 +129,7 @@ struct Mesh *BKE_mesh_new_nomain_from_template_ex(const struct Mesh *me_src,
int tessface_len,
int loops_len,
int polys_len,
CustomData_MeshMasks mask);
struct CustomData_MeshMasks mask);
void BKE_mesh_eval_delete(struct Mesh *me_eval);

View File

@ -43,7 +43,7 @@
#include "BLI_linklist.h"
#include "BLI_task.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_DerivedMesh.h"
#include "BKE_colorband.h"
#include "BKE_editmesh.h"
#include "BKE_key.h"

View File

@ -29,6 +29,7 @@
#include "BLI_math.h"
#include "BLI_utildefines.h"
#include "BKE_DerivedMesh.h"
#include "BKE_pbvh.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_mesh.h"
@ -193,7 +194,7 @@ static const MeshElemMap *cdDM_getPolyMap(Object *ob, DerivedMesh *dm)
return cddm->pmap;
}
void CDDM_recalc_looptri(DerivedMesh *dm)
static void cdDM_recalc_looptri(DerivedMesh *dm)
{
CDDerivedMesh *cddm = (CDDerivedMesh *)dm;
const unsigned int totpoly = dm->numPolyData;
@ -265,7 +266,7 @@ static CDDerivedMesh *cdDM_create(const char *desc)
dm->getEdgeDataArray = DM_get_edge_data_layer;
dm->getTessFaceDataArray = DM_get_tessface_data_layer;
dm->recalcLoopTri = CDDM_recalc_looptri;
dm->recalcLoopTri = cdDM_recalc_looptri;
dm->getVertCo = cdDM_getVertCo;
dm->getVertNo = cdDM_getVertNo;
@ -277,41 +278,9 @@ static CDDerivedMesh *cdDM_create(const char *desc)
return cddm;
}
DerivedMesh *CDDM_new(int numVerts, int numEdges, int numTessFaces, int numLoops, int numPolys)
{
CDDerivedMesh *cddm = cdDM_create("CDDM_new dm");
DerivedMesh *dm = &cddm->dm;
DM_init(dm, DM_TYPE_CDDM, numVerts, numEdges, numTessFaces, numLoops, numPolys);
CustomData_add_layer(&dm->vertData, CD_ORIGINDEX, CD_CALLOC, NULL, numVerts);
CustomData_add_layer(&dm->edgeData, CD_ORIGINDEX, CD_CALLOC, NULL, numEdges);
CustomData_add_layer(&dm->faceData, CD_ORIGINDEX, CD_CALLOC, NULL, numTessFaces);
CustomData_add_layer(&dm->polyData, CD_ORIGINDEX, CD_CALLOC, NULL, numPolys);
CustomData_add_layer(&dm->vertData, CD_MVERT, CD_CALLOC, NULL, numVerts);
CustomData_add_layer(&dm->edgeData, CD_MEDGE, CD_CALLOC, NULL, numEdges);
CustomData_add_layer(&dm->faceData, CD_MFACE, CD_CALLOC, NULL, numTessFaces);
CustomData_add_layer(&dm->loopData, CD_MLOOP, CD_CALLOC, NULL, numLoops);
CustomData_add_layer(&dm->polyData, CD_MPOLY, CD_CALLOC, NULL, numPolys);
cddm->mvert = CustomData_get_layer(&dm->vertData, CD_MVERT);
cddm->medge = CustomData_get_layer(&dm->edgeData, CD_MEDGE);
cddm->mface = CustomData_get_layer(&dm->faceData, CD_MFACE);
cddm->mloop = CustomData_get_layer(&dm->loopData, CD_MLOOP);
cddm->mpoly = CustomData_get_layer(&dm->polyData, CD_MPOLY);
return dm;
}
DerivedMesh *CDDM_from_mesh(Mesh *mesh)
{
return CDDM_from_mesh_ex(mesh, CD_REFERENCE, &CD_MASK_MESH);
}
DerivedMesh *CDDM_from_mesh_ex(Mesh *mesh,
eCDAllocType alloctype,
const CustomData_MeshMasks *mask)
static DerivedMesh *cdDM_from_mesh_ex(Mesh *mesh,
eCDAllocType alloctype,
const CustomData_MeshMasks *mask)
{
CDDerivedMesh *cddm = cdDM_create(__func__);
DerivedMesh *dm = &cddm->dm;
@ -370,6 +339,11 @@ DerivedMesh *CDDM_from_mesh_ex(Mesh *mesh,
return dm;
}
DerivedMesh *CDDM_from_mesh(Mesh *mesh)
{
return cdDM_from_mesh_ex(mesh, CD_REFERENCE, &CD_MASK_MESH);
}
DerivedMesh *CDDM_copy(DerivedMesh *source)
{
CDDerivedMesh *cddm = cdDM_create("CDDM_copy cddm");
@ -415,62 +389,3 @@ DerivedMesh *CDDM_copy(DerivedMesh *source)
return dm;
}
/* #define DEBUG_CLNORS */
#ifdef DEBUG_CLNORS
# include "BLI_linklist.h"
#endif
/* mesh element access functions */
MVert *CDDM_get_vert(DerivedMesh *dm, int index)
{
return &((CDDerivedMesh *)dm)->mvert[index];
}
MEdge *CDDM_get_edge(DerivedMesh *dm, int index)
{
return &((CDDerivedMesh *)dm)->medge[index];
}
MFace *CDDM_get_tessface(DerivedMesh *dm, int index)
{
return &((CDDerivedMesh *)dm)->mface[index];
}
MLoop *CDDM_get_loop(DerivedMesh *dm, int index)
{
return &((CDDerivedMesh *)dm)->mloop[index];
}
MPoly *CDDM_get_poly(DerivedMesh *dm, int index)
{
return &((CDDerivedMesh *)dm)->mpoly[index];
}
/* array access functions */
MVert *CDDM_get_verts(DerivedMesh *dm)
{
return ((CDDerivedMesh *)dm)->mvert;
}
MEdge *CDDM_get_edges(DerivedMesh *dm)
{
return ((CDDerivedMesh *)dm)->medge;
}
MFace *CDDM_get_tessfaces(DerivedMesh *dm)
{
return ((CDDerivedMesh *)dm)->mface;
}
MLoop *CDDM_get_loops(DerivedMesh *dm)
{
return ((CDDerivedMesh *)dm)->mloop;
}
MPoly *CDDM_get_polys(DerivedMesh *dm)
{
return ((CDDerivedMesh *)dm)->mpoly;
}

View File

@ -33,15 +33,16 @@
#include "DNA_object_types.h"
#include "DNA_vfont_types.h"
#include "BLI_blenlib.h"
#include "BLI_memarena.h"
#include "BLI_math.h"
#include "BLI_scanfill.h"
#include "BLI_utildefines.h"
#include "BLI_bitmap.h"
#include "BLI_linklist.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_memarena.h"
#include "BLI_scanfill.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BKE_displist.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_object.h"
#include "BKE_lib_id.h"
#include "BKE_mball.h"

View File

@ -27,10 +27,11 @@
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
#include "BLI_bitmap.h"
#include "BLI_math.h"
#include "BKE_DerivedMesh.h"
#include "BKE_editmesh.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_lib_id.h"
#include "BKE_mesh.h"
#include "BKE_mesh_iterators.h"

View File

@ -45,7 +45,6 @@
#include "BKE_animsys.h"
#include "BKE_anim.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_curve.h"
#include "BKE_displist.h"
#include "BKE_key.h"

View File

@ -48,7 +48,6 @@
#include "BLT_translation.h"
#include "BKE_appdir.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_editmesh.h"
#include "BKE_global.h"
#include "BKE_idcode.h"

View File

@ -68,7 +68,6 @@
#include "BKE_lib_id.h"
#include "BKE_modifier.h"
#include "BKE_mesh.h"
#include "BKE_cdderivedmesh.h" /* for weight_to_rgb() */
#include "BKE_pointcache.h"
#include "BKE_scene.h"
#include "BKE_deform.h"

View File

@ -25,6 +25,7 @@
#include "DNA_listBase.h"
#include "DNA_scene_types.h"
#include "BLI_bitmap.h"
#include "BLI_linklist_stack.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
@ -32,7 +33,6 @@
#include "BLI_task.h"
#include "BLI_utildefines.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_editmesh.h"
#include "BKE_mesh.h"
#include "BKE_multires.h"

View File

@ -31,7 +31,6 @@
#include "BKE_mesh.h"
#include "BKE_context.h"
#include "BKE_curve.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_editmesh.h"
#include "BKE_mesh_runtime.h"
#include "BKE_report.h"

View File

@ -504,7 +504,7 @@ static ParamHandle *construct_param_handle_subsurfed(const Scene *scene,
{
Mesh *me_from_em = BKE_mesh_from_bmesh_for_eval_nomain(em->bm, NULL, ob->data);
initialDerived = CDDM_from_mesh_ex(me_from_em, CD_REFERENCE, &CD_MASK_MESH);
initialDerived = CDDM_from_mesh(me_from_em);
derivedMesh = subsurf_make_derived_from_derived(
initialDerived, &smd, scene, NULL, SUBSURF_IN_EDIT_MODE);

View File

@ -977,7 +977,6 @@ static Mesh *explodeMesh(ExplodeModifierData *emd,
explode = BKE_mesh_new_nomain_from_template(mesh, totdup, 0, totface - delface, 0, 0);
mtface = CustomData_get_layer_named(&explode->fdata, CD_MTFACE, emd->uvname);
/*dupvert = CDDM_get_verts(explode);*/
/* getting back to object space */
invert_m4_m4(imat, ctx->object->obmat);

View File

@ -34,7 +34,6 @@
#include "DNA_object_force_types.h"
#include "DNA_mesh_types.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_layer.h"
#include "BKE_lib_query.h"
#include "BKE_modifier.h"

View File

@ -31,7 +31,6 @@
#include "DNA_scene_types.h"
#include "DNA_mesh_types.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_scene.h"
#include "BKE_subdiv.h"
#include "BKE_subdiv_ccg.h"

View File

@ -20,14 +20,15 @@
#include "MEM_guardedalloc.h"
#include "BLI_bitmap.h"
#include "BLI_linklist.h"
#include "BLI_math.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_deform.h"
#include "BKE_lib_id.h"
#include "BKE_mesh.h"