Mesh API: rename 'octree' to 'spatial' since internally its using kdtree

This commit is contained in:
Campbell Barton 2014-03-13 01:46:21 +11:00
parent 5bceb00a61
commit 35ed7486c7
10 changed files with 28 additions and 28 deletions

@ -403,7 +403,7 @@ static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob,
}
/* only generated in some cases but can call anyway */
mesh_octree_table(ob, NULL, NULL, 'e');
ED_mesh_mirror_spatial_table(ob, NULL, NULL, 'e');
/* free the memory allocated */
MEM_freeN(bonelist);

@ -301,8 +301,8 @@ int join_mesh_exec(struct bContext *C, struct wmOperator *op);
int join_mesh_shapes_exec(struct bContext *C, struct wmOperator *op);
/* mirror lookup api */
int mesh_octree_table(struct Object *ob, struct BMEditMesh *em, const float co[3], char mode);
int mesh_mirrtopo_table(struct Object *ob, char mode);
int ED_mesh_mirror_spatial_table(struct Object *ob, struct BMEditMesh *em, const float co[3], char mode);
int ED_mesh_mirror_topo_table(struct Object *ob, char mode);
/* retrieves mirrored cache vert, or NULL if there isn't one.
* note: calling this without ensuring the mirror cache state

@ -402,8 +402,8 @@ void EDBM_mesh_free(BMEditMesh *em)
/* These tables aren't used yet, so it's not strictly necessary
* to 'end' them (with 'e' param) but if someone tries to start
* using them, having these in place will save a lot of pain */
mesh_octree_table(NULL, NULL, NULL, 'e');
mesh_mirrtopo_table(NULL, 'e');
ED_mesh_mirror_spatial_table(NULL, NULL, NULL, 'e');
ED_mesh_mirror_topo_table(NULL, 'e');
BKE_editmesh_free(em);
}

@ -670,11 +670,11 @@ static struct { void *tree; } MirrKdStore = {NULL};
/* mode is 's' start, or 'e' end, or 'u' use */
/* if end, ob can be NULL */
int mesh_octree_table(Object *ob, BMEditMesh *em, const float co[3], char mode)
int ED_mesh_mirror_spatial_table(Object *ob, BMEditMesh *em, const float co[3], char mode)
{
if (mode == 'u') { /* use table */
if (MirrKdStore.tree == NULL)
mesh_octree_table(ob, em, NULL, 's');
ED_mesh_mirror_spatial_table(ob, em, NULL, 's');
if (MirrKdStore.tree) {
KDTreeNearest nearest;
@ -696,7 +696,7 @@ int mesh_octree_table(Object *ob, BMEditMesh *em, const float co[3], char mode)
int totvert;
if (MirrKdStore.tree) /* happens when entering this call without ending it */
mesh_octree_table(ob, em, co, 'e');
ED_mesh_mirror_spatial_table(ob, em, co, 'e');
if (em && me->edit_btmesh == em) {
totvert = em->bm->totvert;
@ -758,11 +758,11 @@ static MirrTopoStore_t mesh_topo_store = {NULL, -1. - 1, -1};
/* mode is 's' start, or 'e' end, or 'u' use */
/* if end, ob can be NULL */
/* note, is supposed return -1 on error, which callers are currently checking for, but is not used so far */
int mesh_mirrtopo_table(Object *ob, char mode)
int ED_mesh_mirror_topo_table(Object *ob, char mode)
{
if (mode == 'u') { /* use table */
if (ED_mesh_mirrtopo_recalc_check(ob->data, ob->mode, &mesh_topo_store)) {
mesh_mirrtopo_table(ob, 's');
ED_mesh_mirror_topo_table(ob, 's');
}
}
else if (mode == 's') { /* start table */
@ -792,12 +792,12 @@ static int mesh_get_x_mirror_vert_spatial(Object *ob, int index)
vec[1] = mvert->co[1];
vec[2] = mvert->co[2];
return mesh_octree_table(ob, NULL, vec, 'u');
return ED_mesh_mirror_spatial_table(ob, NULL, vec, 'u');
}
static int mesh_get_x_mirror_vert_topo(Object *ob, int index)
{
if (mesh_mirrtopo_table(ob, 'u') == -1)
if (ED_mesh_mirror_topo_table(ob, 'u') == -1)
return -1;
return mesh_topo_store.index_lookup[index];
@ -830,7 +830,7 @@ static BMVert *editbmesh_get_x_mirror_vert_spatial(Object *ob, BMEditMesh *em, c
vec[1] = co[1];
vec[2] = co[2];
i = mesh_octree_table(ob, em, vec, 'u');
i = ED_mesh_mirror_spatial_table(ob, em, vec, 'u');
if (i != -1) {
return BM_vert_at_index(em->bm, i);
}
@ -840,7 +840,7 @@ static BMVert *editbmesh_get_x_mirror_vert_spatial(Object *ob, BMEditMesh *em, c
static BMVert *editbmesh_get_x_mirror_vert_topo(Object *ob, struct BMEditMesh *em, BMVert *eve, int index)
{
intptr_t poinval;
if (mesh_mirrtopo_table(ob, 'u') == -1)
if (ED_mesh_mirror_topo_table(ob, 'u') == -1)
return NULL;
if (index == -1) {
@ -1018,12 +1018,12 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em)
mirrorverts = MEM_callocN(sizeof(int) * me->totvert, "MirrorVerts");
mirrorfaces = MEM_callocN(sizeof(int) * 2 * me->totface, "MirrorFaces");
mesh_octree_table(ob, em, NULL, 's');
ED_mesh_mirror_spatial_table(ob, em, NULL, 's');
for (a = 0, mv = mvert; a < me->totvert; a++, mv++)
mirrorverts[a] = mesh_get_x_mirror_vert(ob, a, use_topology);
mesh_octree_table(ob, em, NULL, 'e');
ED_mesh_mirror_spatial_table(ob, em, NULL, 'e');
fhash = BLI_ghash_new_ex(mirror_facehash, mirror_facecmp, "mirror_facehash gh", me->totface);
for (a = 0, mf = mface; a < me->totface; a++, mf++)

@ -338,8 +338,8 @@ static bool ED_object_editmode_load_ex(Object *obedit, const bool freedata)
me->edit_btmesh = NULL;
}
if (obedit->restore_mode & OB_MODE_WEIGHT_PAINT) {
mesh_octree_table(NULL, NULL, NULL, 'e');
mesh_mirrtopo_table(NULL, 'e');
ED_mesh_mirror_spatial_table(NULL, NULL, NULL, 'e');
ED_mesh_mirror_topo_table(NULL, 'e');
}
}
else if (obedit->type == OB_ARMATURE) {

@ -193,7 +193,7 @@ static bool object_shape_key_mirror(bContext *C, Object *ob,
float *fp1, *fp2;
float tvec[3];
mesh_octree_table(ob, NULL, NULL, 's');
ED_mesh_mirror_spatial_table(ob, NULL, NULL, 's');
for (i1 = 0, mv = me->mvert; i1 < me->totvert; i1++, mv++) {
i2 = mesh_get_x_mirror_vert(ob, i1, use_topology);
@ -224,7 +224,7 @@ static bool object_shape_key_mirror(bContext *C, Object *ob,
}
}
mesh_octree_table(ob, NULL, NULL, 'e');
ED_mesh_mirror_spatial_table(ob, NULL, NULL, 'e');
}
else if (ob->type == OB_LATTICE) {
Lattice *lt = ob->data;

@ -2060,8 +2060,8 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op)
}
/* weight paint specific */
mesh_octree_table(NULL, NULL, NULL, 'e');
mesh_mirrtopo_table(NULL, 'e');
ED_mesh_mirror_spatial_table(NULL, NULL, NULL, 'e');
ED_mesh_mirror_topo_table(NULL, 'e');
paint_cursor_delete_textures();
}
@ -2076,7 +2076,7 @@ static int wpaint_mode_toggle_exec(bContext *C, wmOperator *op)
BKE_paint_init(&wp->paint, PAINT_CURSOR_WEIGHT_PAINT);
/* weight paint specific */
mesh_octree_table(ob, NULL, NULL, 's');
ED_mesh_mirror_spatial_table(ob, NULL, NULL, 's');
ED_vgroup_sync_from_pose(ob);
}

@ -5687,7 +5687,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
if (t->obedit->type == OB_MESH) {
BMEditMesh *em = BKE_editmesh_from_object(t->obedit);
/* table needs to be created for each edit command, since vertices can move etc */
mesh_octree_table(t->obedit, em, NULL, 'e');
ED_mesh_mirror_spatial_table(t->obedit, em, NULL, 'e');
}
}
else if ((t->flag & T_POSE) && (t->poseobj)) {

@ -137,8 +137,8 @@ void ED_editors_exit(bContext *C)
}
/* global in meshtools... */
mesh_octree_table(NULL, NULL, NULL, 'e');
mesh_mirrtopo_table(NULL, 'e');
ED_mesh_mirror_spatial_table(NULL, NULL, NULL, 'e');
ED_mesh_mirror_topo_table(NULL, 'e');
}
/* flush any temp data from object editing to DNA before writing files,

@ -457,8 +457,8 @@ float ED_vgroup_vert_weight(struct Object *ob, struct bDeformGroup *dg, int vert
void ED_vgroup_delete(struct Object *ob, struct bDeformGroup *defgroup) RET_NONE
void ED_vgroup_clear(struct Object *ob) RET_NONE
bool ED_vgroup_object_is_edit_mode(struct Object *ob) RET_ZERO
int mesh_mirrtopo_table(struct Object *ob, char mode) RET_ZERO
int mesh_octree_table(struct Object *ob, struct BMEditMesh *em, const float co[3], char mode) RET_ZERO
int ED_mesh_mirror_topo_table(struct Object *ob, char mode) RET_ZERO
int ED_mesh_mirror_spatial_table(struct Object *ob, struct BMEditMesh *em, const float co[3], char mode) RET_ZERO
float ED_rollBoneToVector(EditBone *bone, const float new_up_axis[3], const short axis_only) RET_ZERO
void ED_space_image_get_size(struct SpaceImage *sima, int *width, int *height) RET_NONE