Cleanup: reduce CDDM use, remove unused function calls
authorCampbell Barton <ideasman42@gmail.com>
Wed, 26 Feb 2020 03:24:57 +0000 (14:24 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 26 Feb 2020 04:22:46 +0000 (15:22 +1100)
17 files changed:
source/blender/alembic/intern/alembic_capi.cc
source/blender/blenkernel/BKE_cdderivedmesh.h
source/blender/blenkernel/BKE_mesh.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/editmesh.c
source/blender/blenkernel/intern/lattice.c
source/blender/blenkernel/intern/modifier.c
source/blender/blenkernel/intern/particle.c
source/blender/bmesh/intern/bmesh_mesh.c
source/blender/editors/mesh/editmesh_knife_project.c
source/blender/editors/uvedit/uvedit_unwrap_ops.c
source/blender/modifiers/intern/MOD_explode.c
source/blender/modifiers/intern/MOD_fluid.c
source/blender/modifiers/intern/MOD_subsurf.c
source/blender/modifiers/intern/MOD_weighted_normal.c

index 6c7ab4d4b8740b1c5b1d5ef344af2a5b6ca83e81..c6f9e284d53bc7f4a07bbb8f0ae808d604037776 100644 (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"
index d39850a162b0ac8dd52b83be1f192ba49a63f053..7b84f2f04ab42e8c9f7b7e94169e82636dd1c9d2 100644 (file)
  * \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
index d6934e8a7dae69d66301390fe6f015f57260c367..1bc7010180372d0b3725285787b02d86a9be566e 100644 (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);
 
index c04079bed22aee9aa3c6ad99bb8bd8c27f3ffbbf..0e532fdedc25459398c74899f4215f78e55b07a3 100644 (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"
index 5fc4e909fac7341f9553fbd59477480a42f6b511..65297ba630c9552dabdf3ed3b055aa9a47f972c6 100644 (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;
-}
index fc310ee720a767e0952e5a87d6f63d1c74f89441..6d7d42b2293aeca52dbc5c7fdd7804b93bcdf73c 100644 (file)
 #include "DNA_object_types.h"
 #include "DNA_vfont_types.h"
 
-#include "BLI_blenlib.h"
-#include "BLI_memarena.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 "BLI_linklist.h"
 
 #include "BKE_displist.h"
-#include "BKE_cdderivedmesh.h"
 #include "BKE_object.h"
 #include "BKE_lib_id.h"
 #include "BKE_mball.h"
index 4c076256d9fa23edaeaa0f05842761d8e819416a..5f727c2d01e78f33d5189de26b7e4be5ec9e6a18 100644 (file)
 #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"
index 02cf7f1cd45a508c9ed719e79b1456ad3bc76ad7..5446640b2ddcb1244e2fda7817714b414752e132 100644 (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"
index 2591edb502e4b005aa23fb5c63acca45924009ec..51c70406692fdc59444629a06666eefa86f948e8 100644 (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"
index 68df93d742a605993d5f6fc0df44bfaa570b2026..0a5637c103bbad65b35741d678b8a6f19e8cd9f4 100644 (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"
index 334cb7c3db47b602b24017457c6dde3a4cc10b6f..ff618142bfa233b388af67a66a14ff9219ede37c 100644 (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"
index 2e175cb156ceae7cb0ebbee7f05cd0228a4f6693..8d5c146969405d86fb824d24f02079460e23b8aa 100644 (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"
index 49acf0ca3a42d4ab244e2026d02dbdda23ce5110..eb568acc0dd44d3264cc2d8bdc028d905a6fe8f6 100644 (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);
 
index 26a353b42352124faaafbf93e01cdce51f1f61bb..7dfa16ae9095c718182e45b86ee344054c818d25 100644 (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);
index 9347c54b0ac009bfd3e7a0166c81494919a6cf30..16dfe5ffc4069c6af9a9978447155558740ca067 100644 (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"
index 4a5887c312267da448b0793d33cdb7fbe81e10ed..5fcd9622c5d17b162ecb6027d488205fe6865994 100644 (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"
index 920551192986e18e9082df8e2ee0288506135fdf..1d6767a807706ac56733e77f82c5e5986a45d749 100644 (file)
 
 #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"