diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_editmesh.h | 13 | ||||
-rw-r--r-- | source/blender/blenkernel/BKE_editmesh_bvh.h | 21 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/anim.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/editderivedmesh.c | 19 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/editmesh.c | 46 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/editmesh_bvh.c | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/modifiers_bmesh.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 4 |
11 files changed, 64 insertions, 67 deletions
diff --git a/source/blender/blenkernel/BKE_editmesh.h b/source/blender/blenkernel/BKE_editmesh.h index 824ecd482e8..934689424fa 100644 --- a/source/blender/blenkernel/BKE_editmesh.h +++ b/source/blender/blenkernel/BKE_editmesh.h @@ -30,7 +30,6 @@ struct BMesh; struct BMLoop; struct BMFace; struct Mesh; -struct DerivedMesh; /* ok: the EDBM module is for editmode bmesh stuff. in contrast, the * BMEdit module is for code shared with blenkernel that concerns @@ -84,11 +83,11 @@ typedef struct BMEditMesh { int mirror_cdlayer; /* -1 is invalid */ } BMEditMesh; -void BMEdit_RecalcTessellation(BMEditMesh *em); -BMEditMesh *BMEdit_Create(BMesh *bm, const bool do_tessellate); -BMEditMesh *BMEdit_Copy(BMEditMesh *em); -BMEditMesh *BMEdit_FromObject(struct Object *ob); -void BMEdit_Free(BMEditMesh *em); -void BMEdit_UpdateLinkedCustomData(BMEditMesh *em); +void BKE_editmesh_tessface_calc(BMEditMesh *em); +BMEditMesh *BKE_editmesh_create(BMesh *bm, const bool do_tessellate); +BMEditMesh *BKE_editmesh_copy(BMEditMesh *em); +BMEditMesh *BKE_editmesh_from_object(struct Object *ob); +void BKE_editmesh_free(BMEditMesh *em); +void BKE_editmesh_update_linked_customdata(BMEditMesh *em); #endif /* __BKE_EDITMESH_H__ */ diff --git a/source/blender/blenkernel/BKE_editmesh_bvh.h b/source/blender/blenkernel/BKE_editmesh_bvh.h index edf261da6e8..cdab48f239c 100644 --- a/source/blender/blenkernel/BKE_editmesh_bvh.h +++ b/source/blender/blenkernel/BKE_editmesh_bvh.h @@ -34,27 +34,22 @@ struct BMEditMesh; struct BMFace; -struct BMEdge; struct BMVert; -struct RegionView3D; struct BMBVHTree; struct BVHTree; struct Scene; -struct Object; typedef struct BMBVHTree BMBVHTree; -BMBVHTree *BMBVH_NewBVH(struct BMEditMesh *em, int flag, struct Scene *scene); -void BMBVH_FreeBVH(BMBVHTree *tree); -struct BVHTree *BMBVH_BVHTree(BMBVHTree *tree); +BMBVHTree *BKE_bmbvh_new(struct BMEditMesh *em, int flag, struct Scene *scene); +void BKE_bmbvh_free(BMBVHTree *tree); +struct BVHTree *BKE_bmbvh_tree_get(BMBVHTree *tree); +struct BMFace *BKE_bmbvh_ray_cast(BMBVHTree *tree, const float co[3], const float dir[3], + float r_hitout[3], float r_cagehit[3]); +/* find a vert closest to co in a sphere of radius maxdist */ +struct BMVert *BKE_bmbvh_find_vert_closest(BMBVHTree *tree, const float co[3], const float maxdist); -struct BMFace *BMBVH_RayCast(BMBVHTree *tree, const float co[3], const float dir[3], - float r_hitout[3], float r_cagehit[3]); - -/*find a vert closest to co in a sphere of radius maxdist*/ -struct BMVert *BMBVH_FindClosestVert(BMBVHTree *tree, const float co[3], const float maxdist); - -/* BMBVH_NewBVH flag parameter */ +/* BKE_bmbvh_new flag parameter */ enum { BMBVH_USE_CAGE = 1, /* project geometry onto modifier cage */ BMBVH_RETURN_ORIG = 2, /* use with BMBVH_USE_CAGE, returns hits in relation to original geometry */ diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 8333fc4ab26..d1a1163d5c7 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -1198,7 +1198,7 @@ static void calc_colors_from_weights_array(const int num, const float *weights, void DM_update_weight_mcol(Object *ob, DerivedMesh *dm, int const draw_flag, float *weights, int num, const int *indices) { - BMEditMesh *em = (dm->type == DM_TYPE_EDITBMESH) ? BMEdit_FromObject(ob) : NULL; + BMEditMesh *em = (dm->type == DM_TYPE_EDITBMESH) ? BKE_editmesh_from_object(ob) : NULL; unsigned char (*wtcol_v)[4]; int numVerts = dm->getNumVerts(dm); int i; diff --git a/source/blender/blenkernel/intern/anim.c b/source/blender/blenkernel/intern/anim.c index 1f54da402ab..3494f68984c 100644 --- a/source/blender/blenkernel/intern/anim.c +++ b/source/blender/blenkernel/intern/anim.c @@ -964,7 +964,7 @@ static void vertex_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, fl /* simple preventing of too deep nested groups */ if (level > MAX_DUPLI_RECUR) return; - em = BMEdit_FromObject(par); + em = BKE_editmesh_from_object(par); /* get derived mesh */ dm_mask = CD_MASK_BAREMESH; @@ -1091,7 +1091,7 @@ static void face_duplilist(ListBase *lb, ID *id, Scene *scene, Object *par, floa if (level > MAX_DUPLI_RECUR) return; copy_m4_m4(pmat, par->obmat); - em = BMEdit_FromObject(par); + em = BKE_editmesh_from_object(par); /* get derived mesh */ dm_mask = CD_MASK_BAREMESH; diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 265cbe13217..af5a20e97b4 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -350,7 +350,7 @@ void BKE_constraint_mat_convertspace(Object *ob, bPoseChannel *pchan, float mat[ static void contarget_get_mesh_mat(Object *ob, const char *substring, float mat[4][4]) { DerivedMesh *dm = NULL; - BMEditMesh *em = BMEdit_FromObject(ob); + BMEditMesh *em = BKE_editmesh_from_object(ob); float vec[3] = {0.0f, 0.0f, 0.0f}; float normal[3] = {0.0f, 0.0f, 0.0f}, plane[3]; float imat[3][3], tmat[3][3]; diff --git a/source/blender/blenkernel/intern/editderivedmesh.c b/source/blender/blenkernel/intern/editderivedmesh.c index 706f817039d..447dd88a0a6 100644 --- a/source/blender/blenkernel/intern/editderivedmesh.c +++ b/source/blender/blenkernel/intern/editderivedmesh.c @@ -49,7 +49,6 @@ #include "BKE_mesh.h" #include "BKE_editmesh.h" - #include "DNA_mesh_types.h" #include "DNA_object_types.h" @@ -1531,21 +1530,3 @@ DerivedMesh *getEditDerivedBMesh(BMEditMesh *em, return (DerivedMesh *)bmdm; } - -/** - * \brief Return the BMEditMesh for a given object - * - * \note this function assumes this is a mesh object, - * don't add NULL data check here. caller must do that - */ -BMEditMesh *BMEdit_FromObject(Object *ob) -{ - BLI_assert(ob->type == OB_MESH); - /* sanity check */ -#ifndef NDEBUG - if (((Mesh *)ob->data)->edit_btmesh) { - BLI_assert(((Mesh *)ob->data)->edit_btmesh->ob == ob); - } -#endif - return ((Mesh *)ob->data)->edit_btmesh; -} diff --git a/source/blender/blenkernel/intern/editmesh.c b/source/blender/blenkernel/intern/editmesh.c index c82bc409c78..2782cecfd8d 100644 --- a/source/blender/blenkernel/intern/editmesh.c +++ b/source/blender/blenkernel/intern/editmesh.c @@ -29,29 +29,32 @@ * \ingroup bke */ -#include "BLI_math.h" +#include "MEM_guardedalloc.h" -#include "BKE_cdderivedmesh.h" +#include "DNA_listBase.h" +#include "DNA_object_types.h" +#include "DNA_mesh_types.h" -#include "MEM_guardedalloc.h" +#include "BLI_math.h" +#include "BLI_scanfill.h" #include "BKE_editmesh.h" -#include "BLI_scanfill.h" +#include "BKE_cdderivedmesh.h" -BMEditMesh *BMEdit_Create(BMesh *bm, const bool do_tessellate) +BMEditMesh *BKE_editmesh_create(BMesh *bm, const bool do_tessellate) { BMEditMesh *em = MEM_callocN(sizeof(BMEditMesh), __func__); em->bm = bm; if (do_tessellate) { - BMEdit_RecalcTessellation(em); + BKE_editmesh_tessface_calc(em); } return em; } -BMEditMesh *BMEdit_Copy(BMEditMesh *em) +BMEditMesh *BKE_editmesh_copy(BMEditMesh *em) { BMEditMesh *em_copy = MEM_callocN(sizeof(BMEditMesh), __func__); *em_copy = *em; @@ -77,7 +80,26 @@ BMEditMesh *BMEdit_Copy(BMEditMesh *em) return em_copy; } -static void BMEdit_RecalcTessellation_intern(BMEditMesh *em) +/** + * \brief Return the BMEditMesh for a given object + * + * \note this function assumes this is a mesh object, + * don't add NULL data check here. caller must do that + */ +BMEditMesh *BKE_editmesh_from_object(Object *ob) +{ + BLI_assert(ob->type == OB_MESH); + /* sanity check */ +#ifndef NDEBUG + if (((Mesh *)ob->data)->edit_btmesh) { + BLI_assert(((Mesh *)ob->data)->edit_btmesh->ob == ob); + } +#endif + return ((Mesh *)ob->data)->edit_btmesh; +} + + +static void editmesh_tessface_calc_intern(BMEditMesh *em) { /* use this to avoid locking pthread for _every_ polygon * and calling the fill function */ @@ -249,9 +271,9 @@ static void BMEdit_RecalcTessellation_intern(BMEditMesh *em) } -void BMEdit_RecalcTessellation(BMEditMesh *em) +void BKE_editmesh_tessface_calc(BMEditMesh *em) { - BMEdit_RecalcTessellation_intern(em); + editmesh_tessface_calc_intern(em); /* commented because editbmesh_build_data() ensures we get tessfaces */ #if 0 @@ -268,7 +290,7 @@ void BMEdit_RecalcTessellation(BMEditMesh *em) #endif } -void BMEdit_UpdateLinkedCustomData(BMEditMesh *em) +void BKE_editmesh_update_linked_customdata(BMEditMesh *em) { BMesh *bm = em->bm; int act; @@ -289,7 +311,7 @@ void BMEdit_UpdateLinkedCustomData(BMEditMesh *em) } /*does not free the BMEditMesh struct itself*/ -void BMEdit_Free(BMEditMesh *em) +void BKE_editmesh_free(BMEditMesh *em) { if (em->derivedFinal) { if (em->derivedFinal != em->derivedCage) { diff --git a/source/blender/blenkernel/intern/editmesh_bvh.c b/source/blender/blenkernel/intern/editmesh_bvh.c index 2d8249551fc..8a00887d26a 100644 --- a/source/blender/blenkernel/intern/editmesh_bvh.c +++ b/source/blender/blenkernel/intern/editmesh_bvh.c @@ -75,7 +75,7 @@ static void cage_mapped_verts_callback(void *userData, int index, const float co } } -BMBVHTree *BMBVH_NewBVH(BMEditMesh *em, int flag, struct Scene *scene) +BMBVHTree *BKE_bmbvh_new(BMEditMesh *em, int flag, struct Scene *scene) { BMBVHTree *tree = MEM_callocN(sizeof(*tree), "BMBVHTree"); DerivedMesh *cage, *final; @@ -88,7 +88,7 @@ BMBVHTree *BMBVH_NewBVH(BMEditMesh *em, int flag, struct Scene *scene) * so that e.g. mirror or array use original vertex coordinates and not mirrored or duplicate */ BLI_smallhash_init(&shash); - BMEdit_RecalcTessellation(em); + BKE_editmesh_tessface_calc(em); tree->ob = em->ob; tree->scene = scene; @@ -180,7 +180,7 @@ BMBVHTree *BMBVH_NewBVH(BMEditMesh *em, int flag, struct Scene *scene) return tree; } -void BMBVH_FreeBVH(BMBVHTree *tree) +void BKE_bmbvh_free(BMBVHTree *tree) { BLI_bvhtree_free(tree->tree); @@ -232,8 +232,8 @@ static void raycallback(void *userdata, int index, const BVHTreeRay *ray, BVHTre } } -BMFace *BMBVH_RayCast(BMBVHTree *tree, const float co[3], const float dir[3], - float r_hitout[3], float r_cagehit[3]) +BMFace *BKE_bmbvh_ray_cast(BMBVHTree *tree, const float co[3], const float dir[3], + float r_hitout[3], float r_cagehit[3]) { BVHTreeRayHit hit; @@ -273,7 +273,7 @@ BMFace *BMBVH_RayCast(BMBVHTree *tree, const float co[3], const float dir[3], return NULL; } -BVHTree *BMBVH_BVHTree(BMBVHTree *tree) +BVHTree *BKE_bmbvh_tree_get(BMBVHTree *tree) { return tree->tree; } @@ -300,7 +300,7 @@ static void vertsearchcallback(void *userdata, int index, const float *UNUSED(co } } -BMVert *BMBVH_FindClosestVert(BMBVHTree *tree, const float co[3], const float maxdist) +BMVert *BKE_bmbvh_find_vert_closest(BMBVHTree *tree, const float co[3], const float maxdist) { BVHTreeNearest hit; diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index a05f8e2d37c..31c2758795d 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -351,7 +351,7 @@ static void mesh_ensure_tessellation_customdata(Mesh *me) static void mesh_update_linked_customdata(Mesh *me, const bool do_ensure_tess_cd) { if (me->edit_btmesh) - BMEdit_UpdateLinkedCustomData(me->edit_btmesh); + BKE_editmesh_update_linked_customdata(me->edit_btmesh); if (do_ensure_tess_cd) { mesh_ensure_tessellation_customdata(me); diff --git a/source/blender/blenkernel/intern/modifiers_bmesh.c b/source/blender/blenkernel/intern/modifiers_bmesh.c index e2a4130b4d9..765e65361a8 100644 --- a/source/blender/blenkernel/intern/modifiers_bmesh.c +++ b/source/blender/blenkernel/intern/modifiers_bmesh.c @@ -217,11 +217,11 @@ BMEditMesh *DM_to_editbmesh(DerivedMesh *dm, BMEditMesh *existing, int do_tessel DM_to_bmesh_ex(dm, bm); if (!em) { - em = BMEdit_Create(bm, do_tessellate); + em = BKE_editmesh_create(bm, do_tessellate); } else { if (do_tessellate) { - BMEdit_RecalcTessellation(em); + BKE_editmesh_tessface_calc(em); } } diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 91845178a04..538cead5d5b 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2716,7 +2716,7 @@ void BKE_object_handle_update_ex(Scene *scene, Object *ob, case OB_MESH: { #if 0 // XXX, comment for 2.56a release, background wont set 'scene->customdata_mask' - BMEditMesh *em = (ob == scene->obedit) ? BMEdit_FromObject(ob) : NULL; + BMEditMesh *em = (ob == scene->obedit) ? BKE_editmesh_from_object(ob) : NULL; BLI_assert((scene->customdata_mask & CD_MASK_BAREMESH) == CD_MASK_BAREMESH); if (em) { makeDerivedMesh(scene, ob, em, scene->customdata_mask, 0); /* was CD_MASK_BAREMESH */ @@ -2726,7 +2726,7 @@ void BKE_object_handle_update_ex(Scene *scene, Object *ob, } #else /* ensure CD_MASK_BAREMESH for now */ - BMEditMesh *em = (ob == scene->obedit) ? BMEdit_FromObject(ob) : NULL; + BMEditMesh *em = (ob == scene->obedit) ? BKE_editmesh_from_object(ob) : NULL; uint64_t data_mask = scene->customdata_mask | ob->customdata_mask | CD_MASK_BAREMESH; if (em) { makeDerivedMesh(scene, ob, em, data_mask, 0); /* was CD_MASK_BAREMESH */ |