move validation into blender kernel so it can be called by internal modifier funcs more easily.

This commit is contained in:
Campbell Barton
2011-02-09 02:28:11 +00:00
parent 30552f9f46
commit 3e8ddef8e5
6 changed files with 25 additions and 13 deletions

View File

@@ -47,6 +47,8 @@ struct Object;
struct MTFace;
struct VecNor;
struct CustomData;
struct DerivedMesh;
struct Scene;
#ifdef __cplusplus
extern "C" {
@@ -147,9 +149,13 @@ int mesh_center_median(struct Mesh *me, float cent[3]);
int mesh_center_bounds(struct Mesh *me, float cent[3]);
void mesh_translate(struct Mesh *me, float offset[3], int do_keys);
/* mesh_validate.c */
void BKE_mesh_validate_arrays(struct MVert *mverts, int totvert, struct MEdge *medges, int totedge, struct MFace *mfaces, int totface);
void BKE_mesh_validate(struct Mesh *me);
void BKE_mesh_validate_dm(struct DerivedMesh *dm);
#ifdef __cplusplus
}
#endif
#endif
#endif /* BKE_MESH_H */

View File

@@ -105,6 +105,7 @@ set(SRC
intern/material.c
intern/mball.c
intern/mesh.c
intern/mesh_validate.c
intern/modifier.c
intern/multires.c
intern/nla.c

View File

@@ -34,6 +34,8 @@
#include "BLI_utildefines.h"
#include "BLI_edgehash.h"
#include "BKE_DerivedMesh.h"
#include "MEM_guardedalloc.h"
#include "ED_mesh.h"
@@ -71,7 +73,7 @@ static int search_face_cmp(const void *v1, const void *v2)
return 0;
}
void ED_mesh_validate_arrays(MVert *UNUSED(mverts), int totvert, MEdge *medges, int totedge, MFace *mfaces, int totface)
void BKE_mesh_validate_arrays(MVert *UNUSED(mverts), int totvert, MEdge *medges, int totedge, MFace *mfaces, int totface)
{
// MVert *mv;
MEdge *med;
@@ -242,11 +244,16 @@ void ED_mesh_validate_arrays(MVert *UNUSED(mverts), int totvert, MEdge *medges,
BLI_edgehash_free(edge_hash, NULL);
MEM_freeN(search_faces);
printf("ED_mesh_validate: finished\n\n");
printf("BKE_mesh_validate: finished\n\n");
}
void ED_mesh_validate(Mesh *me)
void BKE_mesh_validate(Mesh *me)
{
printf("MESH: %s\n", me->id.name+2);
ED_mesh_validate_arrays(me->mvert, me->totvert, me->medge, me->totedge, me->mface, me->totface);
BKE_mesh_validate_arrays(me->mvert, me->totvert, me->medge, me->totedge, me->mface, me->totface);
}
void BKE_mesh_validate_dm(DerivedMesh *dm)
{
BKE_mesh_validate_arrays(dm->getVertArray(dm), dm->getNumVerts(dm), dm->getEdgeArray(dm), dm->getNumEdges(dm), dm->getFaceArray(dm), dm->getNumFaces(dm));
}

View File

@@ -82,10 +82,6 @@ struct rcti;
#define B_FRACTAL 0x2000
#define B_SPHERE 0x4000
/* mesh_validate.c */
void ED_mesh_validate_arrays(struct MVert *mverts, int totvert, struct MEdge *medges, int totedge, struct MFace *mfaces, int totface);
void ED_mesh_validate(struct Mesh *me);
/* meshtools.c */
intptr_t mesh_octree_table(struct Object *ob, struct EditMesh *em, float *co, char mode);

View File

@@ -42,7 +42,6 @@ set(SRC
loopcut.c
mesh_data.c
mesh_ops.c
mesh_validate.c
meshtools.c
mesh_intern.h

View File

@@ -33,6 +33,7 @@
#include "BLO_sys_types.h"
#include "BKE_mesh.h"
#include "ED_mesh.h"
#ifdef RNA_RUNTIME
@@ -57,8 +58,10 @@ void RNA_api_mesh(StructRNA *srna)
RNA_def_boolean(func, "calc_edges", 0, "Calculate Edges", "Force recalculation of edges.");
RNA_def_function_flag(func, FUNC_USE_CONTEXT);
/* Linking errors! */
/* func= RNA_def_function(srna, "validate", "ED_mesh_validate"); */
/*
func= RNA_def_function(srna, "validate", "BKE_mesh_validate");
RNA_def_function_ui_description(func, "validate geometry.");
*/
}
#endif