add CDDM_lower_num_loops(), for completeness (currently unused).
authorCampbell Barton <ideasman42@gmail.com>
Mon, 4 Nov 2013 12:01:46 +0000 (12:01 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 4 Nov 2013 12:01:46 +0000 (12:01 +0000)
source/blender/blenkernel/BKE_cdderivedmesh.h
source/blender/blenkernel/intern/cdderivedmesh.c

index ddb36df74ca2afa0c031f59c42b4fb233ae7e19f..560617db47433d25cfe2d650a3fb94ba14618d7e 100644 (file)
@@ -122,6 +122,7 @@ void CDDM_recalc_tessellation_ex(struct DerivedMesh *dm, const int do_face_nor_c
  */
 void CDDM_lower_num_verts(struct DerivedMesh *dm, int numVerts);
 void CDDM_lower_num_edges(struct DerivedMesh *dm, int numEdges);
+void CDDM_lower_num_loops(struct DerivedMesh *dm, int numLoops);
 void CDDM_lower_num_polys(struct DerivedMesh *dm, int numPolys);
 void CDDM_lower_num_tessfaces(DerivedMesh *dm, int numTessFaces);
 
index 4846199b9d9a320f8305a2290da38b7f03e9edb4..d57d9180697980a21785187f3bf8e9855e8320be 100644 (file)
@@ -2786,6 +2786,7 @@ void CDDM_calc_edges(DerivedMesh *dm)
 
 void CDDM_lower_num_verts(DerivedMesh *dm, int numVerts)
 {
+       BLI_assert(numVerts >= 0);
        if (numVerts < dm->numVertData)
                CustomData_free_elem(&dm->vertData, numVerts, dm->numVertData - numVerts);
 
@@ -2794,6 +2795,7 @@ void CDDM_lower_num_verts(DerivedMesh *dm, int numVerts)
 
 void CDDM_lower_num_edges(DerivedMesh *dm, int numEdges)
 {
+       BLI_assert(numEdges >= 0);
        if (numEdges < dm->numEdgeData)
                CustomData_free_elem(&dm->edgeData, numEdges, dm->numEdgeData - numEdges);
 
@@ -2802,14 +2804,25 @@ void CDDM_lower_num_edges(DerivedMesh *dm, int numEdges)
 
 void CDDM_lower_num_tessfaces(DerivedMesh *dm, int numTessFaces)
 {
+       BLI_assert(numTessFaces >= 0);
        if (numTessFaces < dm->numTessFaceData)
                CustomData_free_elem(&dm->faceData, numTessFaces, dm->numTessFaceData - numTessFaces);
 
        dm->numTessFaceData = numTessFaces;
 }
 
+void CDDM_lower_num_loops(DerivedMesh *dm, int numLoops)
+{
+       BLI_assert(numLoops >= 0);
+       if (numLoops < dm->numLoopData)
+               CustomData_free_elem(&dm->loopData, numLoops, dm->numLoopData - numLoops);
+
+       dm->numLoopData = numLoops;
+}
+
 void CDDM_lower_num_polys(DerivedMesh *dm, int numPolys)
 {
+       BLI_assert(numPolys >= 0);
        if (numPolys < dm->numPolyData)
                CustomData_free_elem(&dm->polyData, numPolys, dm->numPolyData - numPolys);