diff options
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_DerivedMesh.h | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_mesh.h | 7 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.cc | 142 |
3 files changed, 2 insertions, 155 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 0fff6d27031..932ef234342 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -413,14 +413,6 @@ void DM_calc_loop_tangents(DerivedMesh *dm, const char (*tangent_names)[MAX_NAME], int tangent_names_len); -/* debug only */ -#ifndef NDEBUG -char *DM_debug_info(DerivedMesh *dm); -void DM_debug_print(DerivedMesh *dm); - -bool DM_is_valid(DerivedMesh *dm); -#endif - #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index c39583d234a..2ccd317e3e4 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -867,15 +867,12 @@ void BKE_mesh_calc_relative_deform(const struct MPoly *mpoly, bool BKE_mesh_validate(struct Mesh *me, const bool do_verbose, const bool cddata_check_mask); /** * Checks if a Mesh is valid without any modification. This is always verbose. - * - * \see #DM_is_valid to call on derived meshes - * - * \returns is_valid. + * \returns True if the mesh is valid. */ bool BKE_mesh_is_valid(struct Mesh *me); /** * Check all material indices of polygons are valid, invalid ones are set to 0. - * \returns is_valid. + * \returns True if the material indices are valid. */ bool BKE_mesh_validate_material_indices(struct Mesh *me); diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc index 6c9c5490ca0..4bfd71ba932 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.cc +++ b/source/blender/blenkernel/intern/DerivedMesh.cc @@ -2311,145 +2311,3 @@ static void mesh_init_origspace(Mesh *mesh) BKE_mesh_tessface_clear(mesh); } - -/* derivedmesh info printing function, - * to help track down differences DM output */ - -#ifndef NDEBUG -# include "BLI_dynstr.h" - -static void dm_debug_info_layers(DynStr *dynstr, - DerivedMesh *dm, - CustomData *cd, - void *(*getElemDataArray)(DerivedMesh *, int)) -{ - int type; - - for (type = 0; type < CD_NUMTYPES; type++) { - if (CustomData_has_layer(cd, type)) { - /* NOTE: doesn't account for multiple layers. */ - const char *name = CustomData_layertype_name(type); - const int size = CustomData_sizeof(type); - const void *pt = getElemDataArray(dm, type); - const int pt_size = pt ? (int)(MEM_allocN_len(pt) / size) : 0; - const char *structname; - int structnum; - CustomData_file_write_info(type, &structname, &structnum); - BLI_dynstr_appendf( - dynstr, - " dict(name='%s', struct='%s', type=%d, ptr='%p', elem=%d, length=%d),\n", - name, - structname, - type, - (const void *)pt, - size, - pt_size); - } - } -} - -char *DM_debug_info(DerivedMesh *dm) -{ - DynStr *dynstr = BLI_dynstr_new(); - char *ret; - const char *tstr; - - BLI_dynstr_append(dynstr, "{\n"); - BLI_dynstr_appendf(dynstr, " 'ptr': '%p',\n", (void *)dm); - switch (dm->type) { - case DM_TYPE_CDDM: - tstr = "DM_TYPE_CDDM"; - break; - case DM_TYPE_CCGDM: - tstr = "DM_TYPE_CCGDM"; - break; - default: - tstr = "UNKNOWN"; - break; - } - BLI_dynstr_appendf(dynstr, " 'type': '%s',\n", tstr); - BLI_dynstr_appendf(dynstr, " 'numVertData': %d,\n", dm->numVertData); - BLI_dynstr_appendf(dynstr, " 'numEdgeData': %d,\n", dm->numEdgeData); - BLI_dynstr_appendf(dynstr, " 'numTessFaceData': %d,\n", dm->numTessFaceData); - BLI_dynstr_appendf(dynstr, " 'numPolyData': %d,\n", dm->numPolyData); - BLI_dynstr_appendf(dynstr, " 'deformedOnly': %d,\n", dm->deformedOnly); - - BLI_dynstr_append(dynstr, " 'vertexLayers': (\n"); - dm_debug_info_layers(dynstr, dm, &dm->vertData, dm->getVertDataArray); - BLI_dynstr_append(dynstr, " ),\n"); - - BLI_dynstr_append(dynstr, " 'edgeLayers': (\n"); - dm_debug_info_layers(dynstr, dm, &dm->edgeData, dm->getEdgeDataArray); - BLI_dynstr_append(dynstr, " ),\n"); - - BLI_dynstr_append(dynstr, " 'loopLayers': (\n"); - dm_debug_info_layers(dynstr, dm, &dm->loopData, dm->getLoopDataArray); - BLI_dynstr_append(dynstr, " ),\n"); - - BLI_dynstr_append(dynstr, " 'polyLayers': (\n"); - dm_debug_info_layers(dynstr, dm, &dm->polyData, dm->getPolyDataArray); - BLI_dynstr_append(dynstr, " ),\n"); - - BLI_dynstr_append(dynstr, " 'tessFaceLayers': (\n"); - dm_debug_info_layers(dynstr, dm, &dm->faceData, dm->getTessFaceDataArray); - BLI_dynstr_append(dynstr, " ),\n"); - - BLI_dynstr_append(dynstr, "}\n"); - - ret = BLI_dynstr_get_cstring(dynstr); - BLI_dynstr_free(dynstr); - return ret; -} - -void DM_debug_print(DerivedMesh *dm) -{ - char *str = DM_debug_info(dm); - puts(str); - fflush(stdout); - MEM_freeN(str); -} - -bool DM_is_valid(DerivedMesh *dm) -{ - const bool do_verbose = true; - const bool do_fixes = false; - - bool is_valid = true; - bool changed = true; - - is_valid &= BKE_mesh_validate_all_customdata( - dm->getVertDataLayout(dm), - dm->getNumVerts(dm), - dm->getEdgeDataLayout(dm), - dm->getNumEdges(dm), - dm->getLoopDataLayout(dm), - dm->getNumLoops(dm), - dm->getPolyDataLayout(dm), - dm->getNumPolys(dm), - false, /* setting mask here isn't useful, gives false positives */ - do_verbose, - do_fixes, - &changed); - - is_valid &= BKE_mesh_validate_arrays(nullptr, - dm->getVertArray(dm), - dm->getNumVerts(dm), - dm->getEdgeArray(dm), - dm->getNumEdges(dm), - dm->getTessFaceArray(dm), - dm->getNumTessFaces(dm), - dm->getLoopArray(dm), - dm->getNumLoops(dm), - dm->getPolyArray(dm), - dm->getNumPolys(dm), - (MDeformVert *)dm->getVertDataArray(dm, CD_MDEFORMVERT), - do_verbose, - do_fixes, - &changed); - - BLI_assert(changed == false); - - return is_valid; -} - -#endif /* NDEBUG */ |