Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r--source/blender/editors/mesh/editface.c158
-rw-r--r--source/blender/editors/mesh/editmesh_add.c4
-rw-r--r--source/blender/editors/mesh/editmesh_bvh.c3
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c9
-rw-r--r--source/blender/editors/mesh/mesh_data.c124
-rw-r--r--source/blender/editors/mesh/mesh_navmesh.c72
-rw-r--r--source/blender/editors/mesh/mesh_ops.c2
-rw-r--r--source/blender/editors/mesh/meshtools.c248
8 files changed, 316 insertions, 304 deletions
diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c
index a7f72481456..efa5ce0395c 100644
--- a/source/blender/editors/mesh/editface.c
+++ b/source/blender/editors/mesh/editface.c
@@ -77,7 +77,7 @@ void paintface_flush_flags(Object *ob)
int totface, totpoly;
int i;
- if(me==NULL || dm==NULL)
+ if (me==NULL || dm==NULL)
return;
/*
@@ -169,20 +169,20 @@ void paintface_hide(Object *ob, const int unselected)
int a;
me= get_mesh(ob);
- if(me==NULL || me->totpoly==0) return;
+ if (me==NULL || me->totpoly==0) return;
mface= me->mpoly;
a= me->totpoly;
- while(a--) {
- if((mface->flag & ME_HIDE) == 0) {
- if(unselected) {
- if( (mface->flag & ME_FACE_SEL)==0) mface->flag |= ME_HIDE;
+ while (a--) {
+ if ((mface->flag & ME_HIDE) == 0) {
+ if (unselected) {
+ if ( (mface->flag & ME_FACE_SEL)==0) mface->flag |= ME_HIDE;
}
else {
- if( (mface->flag & ME_FACE_SEL)) mface->flag |= ME_HIDE;
+ if ( (mface->flag & ME_FACE_SEL)) mface->flag |= ME_HIDE;
}
}
- if(mface->flag & ME_HIDE) mface->flag &= ~ME_FACE_SEL;
+ if (mface->flag & ME_HIDE) mface->flag &= ~ME_FACE_SEL;
mface++;
}
@@ -198,12 +198,12 @@ void paintface_reveal(Object *ob)
int a;
me= get_mesh(ob);
- if(me==NULL || me->totpoly==0) return;
+ if (me==NULL || me->totpoly==0) return;
mface= me->mpoly;
a= me->totpoly;
- while(a--) {
- if(mface->flag & ME_HIDE) {
+ while (a--) {
+ if (mface->flag & ME_HIDE) {
mface->flag |= ME_FACE_SEL;
mface->flag -= ME_HIDE;
}
@@ -239,8 +239,8 @@ static void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int ind
seamhash = BLI_edgehash_new();
linkflag= MEM_callocN(sizeof(char)*me->totpoly, "linkflaguv");
- for(med=me->medge, a=0; a < me->totedge; a++, med++)
- if(med->flag & ME_SEAM)
+ for (med=me->medge, a=0; a < me->totedge; a++, med++)
+ if (med->flag & ME_SEAM)
BLI_edgehash_insert(seamhash, med->v1, med->v2, NULL);
if (mode==0 || mode==1) {
@@ -252,25 +252,25 @@ static void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int ind
else {
/* fill array by selection */
mf= me->mpoly;
- for(a=0; a<me->totpoly; a++, mf++) {
- if(mf->flag & ME_HIDE);
- else if(mf->flag & ME_FACE_SEL) {
+ for (a=0; a<me->totpoly; a++, mf++) {
+ if (mf->flag & ME_HIDE);
+ else if (mf->flag & ME_FACE_SEL) {
hash_add_face(ehash, mf, me->mloop + mf->loopstart);
linkflag[a]= 1;
}
}
}
- while(doit) {
+ while (doit) {
doit= 0;
/* expand selection */
mf= me->mpoly;
- for(a=0; a<me->totpoly; a++, mf++) {
- if(mf->flag & ME_HIDE)
+ for (a=0; a<me->totpoly; a++, mf++) {
+ if (mf->flag & ME_HIDE)
continue;
- if(!linkflag[a]) {
+ if (!linkflag[a]) {
MLoop *mnextl;
mark= 0;
@@ -282,7 +282,7 @@ static void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int ind
mark = 1;
}
- if(mark) {
+ if (mark) {
linkflag[a]= 1;
hash_add_face(ehash, mf, me->mloop + mf->loopstart);
doit= 1;
@@ -295,26 +295,26 @@ static void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int ind
BLI_edgehash_free(ehash, NULL);
BLI_edgehash_free(seamhash, NULL);
- if(mode==0 || mode==2) {
- for(a=0, mf=me->mpoly; a<me->totpoly; a++, mf++)
- if(linkflag[a])
+ if (mode==0 || mode==2) {
+ for (a=0, mf=me->mpoly; a<me->totpoly; a++, mf++)
+ if (linkflag[a])
mf->flag |= ME_FACE_SEL;
else
mf->flag &= ~ME_FACE_SEL;
}
- else if(mode==1) {
- for(a=0, mf=me->mpoly; a<me->totpoly; a++, mf++)
- if(linkflag[a] && (mf->flag & ME_FACE_SEL))
+ else if (mode==1) {
+ for (a=0, mf=me->mpoly; a<me->totpoly; a++, mf++)
+ if (linkflag[a] && (mf->flag & ME_FACE_SEL))
break;
if (a<me->totpoly) {
- for(a=0, mf=me->mpoly; a<me->totpoly; a++, mf++)
- if(linkflag[a])
+ for (a=0, mf=me->mpoly; a<me->totpoly; a++, mf++)
+ if (linkflag[a])
mf->flag &= ~ME_FACE_SEL;
}
else {
- for(a=0, mf=me->mpoly; a<me->totpoly; a++, mf++)
- if(linkflag[a])
+ for (a=0, mf=me->mpoly; a<me->totpoly; a++, mf++)
+ if (linkflag[a])
mf->flag |= ME_FACE_SEL;
}
}
@@ -328,7 +328,7 @@ void paintface_select_linked(bContext *UNUSED(C), Object *ob, int UNUSED(mval[2]
unsigned int index=0;
me = get_mesh(ob);
- if(me==NULL || me->totpoly==0) return;
+ if (me==NULL || me->totpoly==0) return;
if (mode==0 || mode==1) {
// XXX - Causes glitches, not sure why
@@ -350,13 +350,13 @@ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags)
int a;
me= get_mesh(ob);
- if(me==NULL) return;
+ if (me==NULL) return;
- if(action == SEL_INVERT) {
+ if (action == SEL_INVERT) {
mface= me->mpoly;
a= me->totpoly;
- while(a--) {
- if((mface->flag & ME_HIDE) == 0) {
+ while (a--) {
+ if ((mface->flag & ME_HIDE) == 0) {
mface->flag ^= ME_FACE_SEL;
}
mface++;
@@ -368,8 +368,8 @@ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags)
mface= me->mpoly;
a= me->totpoly;
- while(a--) {
- if((mface->flag & ME_HIDE) == 0 && mface->flag & ME_FACE_SEL) {
+ while (a--) {
+ if ((mface->flag & ME_HIDE) == 0 && mface->flag & ME_FACE_SEL) {
action = SEL_DESELECT;
break;
}
@@ -379,8 +379,8 @@ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags)
mface= me->mpoly;
a= me->totpoly;
- while(a--) {
- if((mface->flag & ME_HIDE) == 0) {
+ while (a--) {
+ if ((mface->flag & ME_HIDE) == 0) {
switch (action) {
case SEL_SELECT:
mface->flag |= ME_FACE_SEL;
@@ -397,7 +397,7 @@ void paintface_deselect_all_visible(Object *ob, int action, short flush_flags)
}
}
- if(flush_flags) {
+ if (flush_flags) {
paintface_flush_flags(ob);
}
}
@@ -413,7 +413,7 @@ int paintface_minmax(Object *ob, float *min, float *max)
float vec[3], bmat[3][3];
me= get_mesh(ob);
- if(!me || !me->mtpoly) return ok;
+ if (!me || !me->mtpoly) return ok;
copy_m3_m4(bmat, ob->obmat);
@@ -462,7 +462,7 @@ void seam_mark_clear_tface(Scene *scene, short mode)
int a, b;
me= get_mesh(OBACT);
- if(me==0 || me->totpoly==0) return;
+ if (me==0 || me->totpoly==0) return;
if (mode == 0)
mode = pupmenu("Seams%t|Mark Border Seam %x1|Clear Seam %x2");
@@ -571,7 +571,7 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, int select, int extend)
me= get_mesh(ob);
- if(me==NULL || me->totpoly==0 || sx*sy <= 0)
+ if (me==NULL || me->totpoly==0 || sx*sy <= 0)
return OPERATOR_CANCELLED;
selar= MEM_callocN(me->totpoly+1, "selar");
@@ -580,8 +580,8 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, int select, int extend)
paintface_deselect_all_visible(vc->obact, SEL_DESELECT, FALSE);
mface= me->mpoly;
- for(a=1; a<=me->totpoly; a++, mface++) {
- if((mface->flag & ME_HIDE) == 0)
+ for (a=1; a<=me->totpoly; a++, mface++) {
+ if ((mface->flag & ME_HIDE) == 0)
mface->flag &= ~ME_FACE_SEL;
}
}
@@ -591,23 +591,23 @@ int do_paintface_box_select(ViewContext *vc, rcti *rect, int select, int extend)
ibuf = IMB_allocImBuf(sx,sy,32,IB_rect);
rt = ibuf->rect;
glReadPixels(rect->xmin+vc->ar->winrct.xmin, rect->ymin+vc->ar->winrct.ymin, sx, sy, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
- if(ENDIAN_ORDER==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
+ if (ENDIAN_ORDER==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf);
a= sx*sy;
- while(a--) {
- if(*rt) {
+ while (a--) {
+ if (*rt) {
index= WM_framebuffer_to_index(*rt);
- if(index<=me->totpoly) selar[index]= 1;
+ if (index<=me->totpoly) selar[index]= 1;
}
rt++;
}
mface= me->mpoly;
- for(a=1; a<=me->totpoly; a++, mface++) {
- if(selar[a]) {
- if(mface->flag & ME_HIDE);
+ for (a=1; a<=me->totpoly; a++, mface++) {
+ if (selar[a]) {
+ if (mface->flag & ME_HIDE);
else {
- if(select) mface->flag |= ME_FACE_SEL;
+ if (select) mface->flag |= ME_FACE_SEL;
else mface->flag &= ~ME_FACE_SEL;
}
}
@@ -638,7 +638,7 @@ void paintvert_flush_flags(Object *ob)
int totvert;
int i;
- if(me==NULL || dm==NULL)
+ if (me==NULL || dm==NULL)
return;
index_array = dm->getVertDataArray(dm, CD_ORIGINDEX);
@@ -648,11 +648,11 @@ void paintvert_flush_flags(Object *ob)
dm_mv= dm_mvert;
- if(index_array) {
+ if (index_array) {
int orig_index;
for (i= 0; i<totvert; i++, dm_mv++) {
orig_index= index_array[i];
- if(orig_index != ORIGINDEX_NONE) {
+ if (orig_index != ORIGINDEX_NONE) {
dm_mv->flag= me->mvert[index_array[i]].flag;
}
}
@@ -671,13 +671,13 @@ void paintvert_deselect_all_visible(Object *ob, int action, short flush_flags)
int a;
me= get_mesh(ob);
- if(me==NULL) return;
+ if (me==NULL) return;
- if(action == SEL_INVERT) {
+ if (action == SEL_INVERT) {
mvert= me->mvert;
a= me->totvert;
- while(a--) {
- if((mvert->flag & ME_HIDE) == 0) {
+ while (a--) {
+ if ((mvert->flag & ME_HIDE) == 0) {
mvert->flag ^= SELECT;
}
mvert++;
@@ -689,8 +689,8 @@ void paintvert_deselect_all_visible(Object *ob, int action, short flush_flags)
mvert= me->mvert;
a= me->totvert;
- while(a--) {
- if((mvert->flag & ME_HIDE) == 0 && mvert->flag & SELECT) {
+ while (a--) {
+ if ((mvert->flag & ME_HIDE) == 0 && mvert->flag & SELECT) {
action = SEL_DESELECT;
break;
}
@@ -700,8 +700,8 @@ void paintvert_deselect_all_visible(Object *ob, int action, short flush_flags)
mvert= me->mvert;
a= me->totvert;
- while(a--) {
- if((mvert->flag & ME_HIDE) == 0) {
+ while (a--) {
+ if ((mvert->flag & ME_HIDE) == 0) {
switch (action) {
case SEL_SELECT:
mvert->flag |= SELECT;
@@ -718,7 +718,7 @@ void paintvert_deselect_all_visible(Object *ob, int action, short flush_flags)
}
}
- if(flush_flags) {
+ if (flush_flags) {
paintvert_flush_flags(ob);
}
}
@@ -763,7 +763,7 @@ int ED_mesh_mirrtopo_recalc_check(Mesh *me, const int ob_mode, MirrTopoStore_t *
totedge = me->totedge;
}
- if( (mesh_topo_store->index_lookup==NULL) ||
+ if ( (mesh_topo_store->index_lookup==NULL) ||
(mesh_topo_store->prev_ob_mode != ob_mode) ||
(totvert != mesh_topo_store->prev_vert_tot) ||
(totedge != mesh_topo_store->prev_edge_tot))
@@ -801,7 +801,7 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
mesh_topo_store->prev_ob_mode = ob_mode;
- if(em) {
+ if (em) {
BM_mesh_elem_index_ensure(em->bm, BM_VERT);
totvert = em->bm->totvert;
@@ -813,7 +813,7 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
topo_hash = MEM_callocN(totvert * sizeof(MirrTopoHash_t), "TopoMirr");
/* Initialize the vert-edge-user counts used to detect unique topology */
- if(em) {
+ if (em) {
totedge = me->edit_btmesh->bm->totedge;
BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
@@ -824,7 +824,7 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
else {
totedge = me->totedge;
- for(a=0, medge=me->medge; a < me->totedge; a++, medge++) {
+ for (a=0, medge=me->medge; a < me->totedge; a++, medge++) {
topo_hash[medge->v1]++;
topo_hash[medge->v2]++;
}
@@ -833,17 +833,17 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
topo_hash_prev = MEM_dupallocN(topo_hash);
tot_unique_prev = -1;
- while(1) {
+ while (1) {
/* use the number of edges per vert to give verts unique topology IDs */
- if(em) {
+ if (em) {
BM_ITER(eed, &iter, em->bm, BM_EDGES_OF_MESH, NULL) {
topo_hash[BM_elem_index_get(eed->v1)] += topo_hash_prev[BM_elem_index_get(eed->v2)];
topo_hash[BM_elem_index_get(eed->v2)] += topo_hash_prev[BM_elem_index_get(eed->v1)];
}
}
else {
- for(a=0, medge=me->medge; a<me->totedge; a++, medge++) {
+ for (a=0, medge=me->medge; a<me->totedge; a++, medge++) {
/* This can make really big numbers, wrapping around here is fine */
topo_hash[medge->v1] += topo_hash_prev[medge->v2];
topo_hash[medge->v2] += topo_hash_prev[medge->v1];
@@ -855,7 +855,7 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
qsort(topo_hash_prev, totvert, sizeof(MirrTopoHash_t), mirrtopo_hash_sort);
tot_unique = 1; /* account for skiping the first value */
- for(a=1; a<totvert; a++) {
+ for (a=1; a<totvert; a++) {
if (topo_hash_prev[a-1] != topo_hash_prev[a]) {
tot_unique++;
}
@@ -879,14 +879,14 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
/* since we are looping through verts, initialize these values here too */
index_lookup = MEM_mallocN(totvert * sizeof(*index_lookup), "mesh_topo_lookup");
- if(em) {
+ if (em) {
if (skip_em_vert_array_init == FALSE) {
EDBM_init_index_arrays(em,1, 0, 0);
}
}
- for(a=0; a<totvert; a++) {
+ for (a=0; a<totvert; a++) {
topo_pairs[a].hash = topo_hash[a];
topo_pairs[a].v_index = a;
@@ -901,11 +901,11 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
/* Get the pairs out of the sorted hashes, note, totvert+1 means we can use the previous 2,
* but you cant ever access the last 'a' index of MirrTopoPairs */
- for(a=2; a <= totvert; a++) {
+ for (a=2; a <= totvert; a++) {
/* printf("I %d %ld %d\n", (a-last), MirrTopoPairs[a ].hash, MirrTopoPairs[a ].v_index ); */
if ((a==totvert) || (topo_pairs[a-1].hash != topo_pairs[a].hash)) {
if (a-last==2) {
- if(em) {
+ if (em) {
index_lookup[topo_pairs[a-1].v_index] = (intptr_t)EDBM_get_vert_for_index(em, topo_pairs[a-2].v_index);
index_lookup[topo_pairs[a-2].v_index] = (intptr_t)EDBM_get_vert_for_index(em, topo_pairs[a-1].v_index);
}
@@ -917,7 +917,7 @@ void ED_mesh_mirrtopo_init(Mesh *me, const int ob_mode, MirrTopoStore_t *mesh_to
last = a;
}
}
- if(em) {
+ if (em) {
if (skip_em_vert_array_init == FALSE) {
EDBM_free_index_arrays(em);
}
diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c
index 74160b3f2de..d816d33c9df 100644
--- a/source/blender/editors/mesh/editmesh_add.c
+++ b/source/blender/editors/mesh/editmesh_add.c
@@ -98,7 +98,9 @@ static void make_prim_init(bContext *C, const char *idname,
ED_object_enter_editmode(C, EM_DO_UNDO|EM_IGNORE_LAYER); /* rare cases the active layer is messed up */
*state = 1;
}
- else DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
+ else {
+ DAG_id_tag_update(&obedit->id, OB_RECALC_DATA);
+ }
*dia *= new_primitive_matrix(C, loc, rot, mat);
}
diff --git a/source/blender/editors/mesh/editmesh_bvh.c b/source/blender/editors/mesh/editmesh_bvh.c
index 3716949cb46..6571af11af5 100644
--- a/source/blender/editors/mesh/editmesh_bvh.c
+++ b/source/blender/editors/mesh/editmesh_bvh.c
@@ -229,7 +229,8 @@ BMFace *BMBVH_RayCast(BMBVHTree *tree, float *co, float *dir, float *hitout, flo
((v3->co[i] - v1->co[i]) * tree->uv[1]);
}
copy_v3_v3(hitout, co);
- } else {
+ }
+ else {
copy_v3_v3(hitout, hit.co);
}
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 3448ac608e1..d26d6f2cbfe 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -3767,11 +3767,14 @@ static int edbm_select_by_number_vertices_exec(bContext *C, wmOperator *op)
if (type == 0 && efa->len < numverts) {
select = 1;
- }else if (type == 1 && efa->len == numverts) {
+ }
+ else if (type == 1 && efa->len == numverts) {
select = 1;
- }else if (type == 2 && efa->len > numverts) {
+ }
+ else if (type == 2 && efa->len > numverts) {
select = 1;
- }else if (type == 3 && efa->len != numverts) {
+ }
+ else if (type == 3 && efa->len != numverts) {
select = 1;
}
diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c
index 10fdd31db3e..a8836b466a8 100644
--- a/source/blender/editors/mesh/mesh_data.c
+++ b/source/blender/editors/mesh/mesh_data.c
@@ -87,7 +87,8 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
if (layer->type == CD_MLOOPCOL || layer->type == CD_MLOOPUV) {
data = (me->edit_btmesh)? &me->edit_btmesh->bm->ldata: &me->ldata;
tot = me->totloop;
- } else {
+ }
+ else {
data = (me->edit_btmesh)? &me->edit_btmesh->bm->pdata: &me->pdata;
tot = me->totpoly;
}
@@ -107,7 +108,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
stencillayerdata = data->layers[CustomData_get_stencil_layer_index(data, type)].data;
CustomData_set_layer_active(data, type, layer - &data->layers[index]);
- if(me->edit_btmesh) {
+ if (me->edit_btmesh) {
BM_data_layer_free(me->edit_btmesh->bm, data, type);
}
else {
@@ -115,7 +116,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la
mesh_update_customdata_pointers(me, TRUE);
}
- if(!CustomData_has_layer(data, type) && (type == CD_MLOOPCOL && (ob->mode & OB_MODE_VERTEX_PAINT)))
+ if (!CustomData_has_layer(data, type) && (type == CD_MLOOPCOL && (ob->mode & OB_MODE_VERTEX_PAINT)))
ED_object_toggle_modes(C, OB_MODE_VERTEX_PAINT);
/* reconstruct active layer */
@@ -186,7 +187,7 @@ static void copy_editface_active_customdata(BMEditMesh *em, int type, int index)
EditFace *efa;
int n= CustomData_get_active_layer(&em->fdata, type);
- for(efa= em->faces.first; efa; efa= efa->next) {
+ for (efa= em->faces.first; efa; efa= efa->next) {
void *data= CustomData_em_get_n(&em->fdata, efa->data, type, n);
CustomData_em_set_n(&em->fdata, efa->data, type, index, data);
}
@@ -259,7 +260,8 @@ int ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me)
fuvs[2][0] = 1.0;
fuvs[2][1] = 1.0;
- } else if (len == 4) {
+ }
+ else if (len == 4) {
fuvs[0][0] = 0.0;
fuvs[0][1] = 0.0;
@@ -272,7 +274,8 @@ int ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me)
fuvs[3][0] = 0.0;
fuvs[3][1] = 1.0;
/*make sure we ignore 2-sided faces*/
- } else if (len > 2) {
+ }
+ else if (len > 2) {
float fac = 0.0f, dfac = 1.0f / (float)len;
dfac *= M_PI*2;
@@ -327,7 +330,7 @@ int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_s
CustomData_set_layer_name(&em->bm->ldata, CD_MLOOPUV, layernum, name);
CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPUV, layernum);
- if(active_set || layernum == 0) {
+ if (active_set || layernum == 0) {
CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPUV, layernum);
}
}
@@ -340,7 +343,8 @@ int ED_mesh_uv_texture_add(bContext *C, Mesh *me, const char *name, int active_s
CustomData_add_layer_named(&me->pdata, CD_MTEXPOLY, CD_DUPLICATE, me->mtpoly, me->totpoly, name);
CustomData_add_layer_named(&me->ldata, CD_MLOOPUV, CD_DUPLICATE, me->mloopuv, me->totloop, name);
CustomData_add_layer_named(&me->fdata, CD_MTFACE, CD_DUPLICATE, me->mtface, me->totface, name);
- } else {
+ }
+ else {
CustomData_add_layer_named(&me->pdata, CD_MTEXPOLY, CD_DEFAULT, NULL, me->totpoly, name);
CustomData_add_layer_named(&me->ldata, CD_MLOOPUV, CD_DEFAULT, NULL, me->totloop, name);
CustomData_add_layer_named(&me->fdata, CD_MTFACE, CD_DEFAULT, NULL, me->totface, name);
@@ -419,7 +423,7 @@ int ED_mesh_color_add(bContext *C, Scene *UNUSED(scene), Object *UNUSED(ob), Mes
return -1;
}
- if(me->mloopcol) {
+ if (me->mloopcol) {
CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DUPLICATE, me->mloopcol, me->totloop, name);
CustomData_add_layer_named(&me->fdata, CD_MCOL, CD_DUPLICATE, me->mcol, me->totface, name);
}
@@ -428,7 +432,7 @@ int ED_mesh_color_add(bContext *C, Scene *UNUSED(scene), Object *UNUSED(ob), Mes
CustomData_add_layer_named(&me->fdata, CD_MCOL, CD_DEFAULT, NULL, me->totface, name);
}
- if(active_set || layernum==0) {
+ if (active_set || layernum==0) {
CustomData_set_layer_active(&me->ldata, CD_MLOOPCOL, layernum);
CustomData_set_layer_active(&me->fdata, CD_MCOL, layernum);
}
@@ -450,7 +454,7 @@ int ED_mesh_color_remove(bContext *C, Object *ob, Mesh *me)
index= CustomData_get_active_layer_index(&me->ldata, CD_MLOOPCOL);
cdl= (index == -1)? NULL: &me->ldata.layers[index];
- if(!cdl)
+ if (!cdl)
return 0;
delete_customdata_layer(C, ob, cdl);
@@ -468,7 +472,7 @@ int ED_mesh_color_remove_named(bContext *C, Object *ob, Mesh *me, const char *na
index= CustomData_get_named_layer_index(&me->ldata, CD_MLOOPCOL, name);
cdl= (index == -1)? NULL: &me->ldata.layers[index];
- if(!cdl)
+ if (!cdl)
return 0;
delete_customdata_layer(C, ob, cdl);
@@ -492,7 +496,7 @@ static int mesh_uv_texture_add_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob= ED_object_context(C);
Mesh *me= ob->data;
- if(ED_mesh_uv_texture_add(C, me, NULL, TRUE) == -1)
+ if (ED_mesh_uv_texture_add(C, me, NULL, TRUE) == -1)
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -526,13 +530,13 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
char name[MAX_ID_NAME-2];
/* Check context */
- if(base==NULL || base->object->type!=OB_MESH) {
+ if (base==NULL || base->object->type!=OB_MESH) {
BKE_report(op->reports, RPT_ERROR, "Not an Object or Mesh");
return OPERATOR_CANCELLED;
}
/* check input variables */
- if(RNA_struct_property_is_set(op->ptr, "filepath")) {
+ if (RNA_struct_property_is_set(op->ptr, "filepath")) {
char path[FILE_MAX];
RNA_string_get(op->ptr, "filepath", path);
@@ -543,7 +547,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
ima= (Image *)find_id("IM", name);
}
- if(!ima) {
+ if (!ima) {
BKE_report(op->reports, RPT_ERROR, "Not an Image");
return OPERATOR_CANCELLED;
}
@@ -552,16 +556,16 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
obedit= base->object;
me= obedit->data;
- if(me->edit_btmesh==NULL) {
+ if (me->edit_btmesh==NULL) {
EDBM_MakeEditBMesh(scene->toolsettings, scene, obedit);
exitmode= 1;
}
- if(me->edit_btmesh==NULL)
+ if (me->edit_btmesh==NULL)
return OPERATOR_CANCELLED;
ED_uvedit_assign_image(bmain, scene, obedit, ima, NULL);
- if(exitmode) {
+ if (exitmode) {
EDBM_LoadEditBMesh(scene, obedit);
EDBM_FreeEditBMesh(me->edit_btmesh);
MEM_freeN(me->edit_btmesh);
@@ -573,7 +577,7 @@ static int drop_named_image_invoke(bContext *C, wmOperator *op, wmEvent *event)
}
/* dummie drop support; ensure view shows a result :) */
- if(v3d)
+ if (v3d)
v3d->flag2 |= V3D_SOLID_TEX;
WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data);
@@ -605,7 +609,7 @@ static int mesh_uv_texture_remove_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob= ED_object_context(C);
Mesh *me= ob->data;
- if(!ED_mesh_uv_texture_remove(C, ob, me))
+ if (!ED_mesh_uv_texture_remove(C, ob, me))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -634,7 +638,7 @@ static int mesh_vertex_color_add_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob= ED_object_context(C);
Mesh *me= ob->data;
- if(ED_mesh_color_add(C, scene, ob, me, NULL, TRUE) == -1)
+ if (ED_mesh_color_add(C, scene, ob, me, NULL, TRUE) == -1)
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -660,7 +664,7 @@ static int mesh_vertex_color_remove_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob= ED_object_context(C);
Mesh *me= ob->data;
- if(!ED_mesh_color_remove(C, ob, me))
+ if (!ED_mesh_color_remove(C, ob, me))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -692,7 +696,7 @@ static int mesh_sticky_add_exec(bContext *C, wmOperator *UNUSED(op))
/* why is this commented out? */
#if 0
- if(me->msticky)
+ if (me->msticky)
return OPERATOR_CANCELLED;
#endif
@@ -724,7 +728,7 @@ static int mesh_sticky_remove_exec(bContext *C, wmOperator *UNUSED(op))
Object *ob= ED_object_context(C);
Mesh *me= ob->data;
- if(!me->msticky)
+ if (!me->msticky)
return OPERATOR_CANCELLED;
CustomData_free_layer_active(&me->vdata, CD_MSTICKY, me->totvert);
@@ -759,7 +763,7 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface)
float (*face_nors)[3];
int tessface_input = FALSE;
- if(mesh->totface > 0 && mesh->totpoly == 0) {
+ if (mesh->totface > 0 && mesh->totpoly == 0) {
convert_mfaces_to_mpolys(mesh);
/* would only be converting back again, don't bother */
@@ -769,7 +773,7 @@ void ED_mesh_update(Mesh *mesh, bContext *C, int calc_edges, int calc_tessface)
calc_edges = FALSE;
}
- if(calc_edges || (mesh->totpoly && mesh->totedge == 0))
+ if (calc_edges || (mesh->totpoly && mesh->totedge == 0))
BKE_mesh_calc_edges(mesh, calc_edges);
if (calc_tessface) {
@@ -815,14 +819,14 @@ static void mesh_add_verts(Mesh *mesh, int len)
MVert *mvert;
int i, totvert;
- if(len == 0)
+ if (len == 0)
return;
totvert= mesh->totvert + len;
CustomData_copy(&mesh->vdata, &vdata, CD_MASK_MESH, CD_DEFAULT, totvert);
CustomData_copy_data(&mesh->vdata, &vdata, 0, 0, mesh->totvert);
- if(!CustomData_has_layer(&vdata, CD_MVERT))
+ if (!CustomData_has_layer(&vdata, CD_MVERT))
CustomData_add_layer(&vdata, CD_MVERT, CD_CALLOC, NULL, totvert);
CustomData_free(&mesh->vdata, mesh->totvert);
@@ -832,7 +836,7 @@ static void mesh_add_verts(Mesh *mesh, int len)
/* scan the input list and insert the new vertices */
mvert= &mesh->mvert[mesh->totvert];
- for(i=0; i<len; i++, mvert++)
+ for (i=0; i<len; i++, mvert++)
mvert->flag |= SELECT;
/* set final vertex list size */
@@ -844,7 +848,7 @@ void ED_mesh_transform(Mesh *me, float *mat)
int i;
MVert *mvert= me->mvert;
- for(i= 0; i < me->totvert; i++, mvert++)
+ for (i= 0; i < me->totvert; i++, mvert++)
mul_m4_v3((float (*)[4])mat, mvert->co);
mesh_calc_normals_mapping(me->mvert, me->totvert, me->mloop, me->mpoly, me->totloop, me->totpoly, NULL, NULL, 0, NULL, NULL);
@@ -856,7 +860,7 @@ static void mesh_add_edges(Mesh *mesh, int len)
MEdge *medge;
int i, totedge;
- if(len == 0)
+ if (len == 0)
return;
totedge= mesh->totedge+len;
@@ -865,7 +869,7 @@ static void mesh_add_edges(Mesh *mesh, int len)
CustomData_copy(&mesh->edata, &edata, CD_MASK_MESH, CD_DEFAULT, totedge);
CustomData_copy_data(&mesh->edata, &edata, 0, 0, mesh->totedge);
- if(!CustomData_has_layer(&edata, CD_MEDGE))
+ if (!CustomData_has_layer(&edata, CD_MEDGE))
CustomData_add_layer(&edata, CD_MEDGE, CD_CALLOC, NULL, totedge);
CustomData_free(&mesh->edata, mesh->totedge);
@@ -874,7 +878,7 @@ static void mesh_add_edges(Mesh *mesh, int len)
/* set default flags */
medge= &mesh->medge[mesh->totedge];
- for(i=0; i<len; i++, medge++)
+ for (i=0; i<len; i++, medge++)
medge->flag= ME_EDGEDRAW|ME_EDGERENDER|SELECT;
mesh->totedge= totedge;
@@ -886,7 +890,7 @@ static void mesh_add_faces(Mesh *mesh, int len)
MFace *mface;
int i, totface;
- if(len == 0)
+ if (len == 0)
return;
totface= mesh->totface + len; /* new face count */
@@ -895,7 +899,7 @@ static void mesh_add_faces(Mesh *mesh, int len)
CustomData_copy(&mesh->fdata, &fdata, CD_MASK_MESH, CD_DEFAULT, totface);
CustomData_copy_data(&mesh->fdata, &fdata, 0, 0, mesh->totface);
- if(!CustomData_has_layer(&fdata, CD_MFACE))
+ if (!CustomData_has_layer(&fdata, CD_MFACE))
CustomData_add_layer(&fdata, CD_MFACE, CD_CALLOC, NULL, totface);
CustomData_free(&mesh->fdata, mesh->totface);
@@ -904,7 +908,7 @@ static void mesh_add_faces(Mesh *mesh, int len)
/* set default flags */
mface= &mesh->mface[mesh->totface];
- for(i=0; i<len; i++, mface++)
+ for (i=0; i<len; i++, mface++)
mface->flag= ME_FACE_SEL;
mesh->totface= totface;
@@ -915,7 +919,7 @@ static void mesh_add_loops(Mesh *mesh, int len)
CustomData ldata;
int totloop;
- if(len == 0)
+ if (len == 0)
return;
totloop= mesh->totloop + len; /* new face count */
@@ -924,7 +928,7 @@ static void mesh_add_loops(Mesh *mesh, int len)
CustomData_copy(&mesh->ldata, &ldata, CD_MASK_MESH, CD_DEFAULT, totloop);
CustomData_copy_data(&mesh->ldata, &ldata, 0, 0, mesh->totloop);
- if(!CustomData_has_layer(&ldata, CD_MLOOP))
+ if (!CustomData_has_layer(&ldata, CD_MLOOP))
CustomData_add_layer(&ldata, CD_MLOOP, CD_CALLOC, NULL, totloop);
CustomData_free(&mesh->ldata, mesh->totloop);
@@ -940,7 +944,7 @@ static void mesh_add_polys(Mesh *mesh, int len)
MPoly *mpoly;
int i, totpoly;
- if(len == 0)
+ if (len == 0)
return;
totpoly= mesh->totpoly + len; /* new face count */
@@ -949,7 +953,7 @@ static void mesh_add_polys(Mesh *mesh, int len)
CustomData_copy(&mesh->pdata, &pdata, CD_MASK_MESH, CD_DEFAULT, totpoly);
CustomData_copy_data(&mesh->pdata, &pdata, 0, 0, mesh->totpoly);
- if(!CustomData_has_layer(&pdata, CD_MPOLY))
+ if (!CustomData_has_layer(&pdata, CD_MPOLY))
CustomData_add_layer(&pdata, CD_MPOLY, CD_CALLOC, NULL, totpoly);
CustomData_free(&mesh->pdata, mesh->totpoly);
@@ -958,7 +962,7 @@ static void mesh_add_polys(Mesh *mesh, int len)
/* set default flags */
mpoly= &mesh->mpoly[mesh->totpoly];
- for(i=0; i<len; i++, mpoly++)
+ for (i=0; i<len; i++, mpoly++)
mpoly->flag= ME_FACE_SEL;
mesh->totpoly= totpoly;
@@ -968,7 +972,7 @@ static void mesh_remove_verts(Mesh *mesh, int len)
{
int totvert;
- if(len == 0)
+ if (len == 0)
return;
totvert= mesh->totvert - len;
@@ -982,7 +986,7 @@ static void mesh_remove_edges(Mesh *mesh, int len)
{
int totedge;
- if(len == 0)
+ if (len == 0)
return;
totedge= mesh->totedge - len;
@@ -995,7 +999,7 @@ static void mesh_remove_faces(Mesh *mesh, int len)
{
int totface;
- if(len == 0)
+ if (len == 0)
return;
totface= mesh->totface - len; /* new face count */
@@ -1007,23 +1011,23 @@ static void mesh_remove_faces(Mesh *mesh, int len)
#if 0
void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges, int faces)
{
- if(mesh->edit_btmesh) {
+ if (mesh->edit_btmesh) {
BKE_report(reports, RPT_ERROR, "Can't add geometry in edit mode");
return;
}
- if(verts)
+ if (verts)
mesh_add_verts(mesh, verts);
- if(edges)
+ if (edges)
mesh_add_edges(mesh, edges);
- if(faces)
+ if (faces)
mesh_add_faces(mesh, faces);
}
#endif
void ED_mesh_faces_add(Mesh *mesh, ReportList *reports, int count)
{
- if(mesh->edit_btmesh) {
+ if (mesh->edit_btmesh) {
BKE_report(reports, RPT_ERROR, "Can't add faces in edit mode");
return;
}
@@ -1033,7 +1037,7 @@ void ED_mesh_faces_add(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
{
- if(mesh->edit_btmesh) {
+ if (mesh->edit_btmesh) {
BKE_report(reports, RPT_ERROR, "Can't add edges in edit mode");
return;
}
@@ -1043,7 +1047,7 @@ void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_vertices_add(Mesh *mesh, ReportList *reports, int count)
{
- if(mesh->edit_btmesh) {
+ if (mesh->edit_btmesh) {
BKE_report(reports, RPT_ERROR, "Can't add vertices in edit mode");
return;
}
@@ -1053,11 +1057,11 @@ void ED_mesh_vertices_add(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_faces_remove(Mesh *mesh, ReportList *reports, int count)
{
- if(mesh->edit_btmesh) {
+ if (mesh->edit_btmesh) {
BKE_report(reports, RPT_ERROR, "Can't remove faces in edit mode");
return;
}
- else if(count > mesh->totface) {
+ else if (count > mesh->totface) {
BKE_report(reports, RPT_ERROR, "Can't remove more faces than the mesh contains");
return;
}
@@ -1067,11 +1071,11 @@ void ED_mesh_faces_remove(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_edges_remove(Mesh *mesh, ReportList *reports, int count)
{
- if(mesh->edit_btmesh) {
+ if (mesh->edit_btmesh) {
BKE_report(reports, RPT_ERROR, "Can't remove edges in edit mode");
return;
}
- else if(count > mesh->totedge) {
+ else if (count > mesh->totedge) {
BKE_report(reports, RPT_ERROR, "Can't remove more edges than the mesh contains");
return;
}
@@ -1081,11 +1085,11 @@ void ED_mesh_edges_remove(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_vertices_remove(Mesh *mesh, ReportList *reports, int count)
{
- if(mesh->edit_btmesh) {
+ if (mesh->edit_btmesh) {
BKE_report(reports, RPT_ERROR, "Can't remove vertices in edit mode");
return;
}
- else if(count > mesh->totvert) {
+ else if (count > mesh->totvert) {
BKE_report(reports, RPT_ERROR, "Can't remove more vertices than the mesh contains");
return;
}
@@ -1095,7 +1099,7 @@ void ED_mesh_vertices_remove(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_loops_add(Mesh *mesh, ReportList *reports, int count)
{
- if(mesh->edit_btmesh) {
+ if (mesh->edit_btmesh) {
BKE_report(reports, RPT_ERROR, "Can't add loops in edit mode.");
return;
}
@@ -1105,7 +1109,7 @@ void ED_mesh_loops_add(Mesh *mesh, ReportList *reports, int count)
void ED_mesh_polys_add(Mesh *mesh, ReportList *reports, int count)
{
- if(mesh->edit_btmesh) {
+ if (mesh->edit_btmesh) {
BKE_report(reports, RPT_ERROR, "Can't add polys in edit mode.");
return;
}
diff --git a/source/blender/editors/mesh/mesh_navmesh.c b/source/blender/editors/mesh/mesh_navmesh.c
index 58899acff9b..02ef1540cc1 100644
--- a/source/blender/editors/mesh/mesh_navmesh.c
+++ b/source/blender/editors/mesh/mesh_navmesh.c
@@ -85,7 +85,7 @@ static void createVertsTrisData(bContext *C, LinkNode *obs, int *nverts_r, float
ntris = 0;
/* calculate number of verts and tris */
- for(oblink = obs; oblink; oblink= oblink->next) {
+ for (oblink = obs; oblink; oblink= oblink->next) {
ob= (Object*) oblink->link;
dm= mesh_create_derived_no_virtual(scene, ob, NULL, CD_MASK_MESH);
BLI_linklist_append(&dms, (void*)dm);
@@ -96,9 +96,9 @@ static void createVertsTrisData(bContext *C, LinkNode *obs, int *nverts_r, float
/* resolve quad faces */
mface= dm->getTessFaceArray(dm);
- for(i= 0; i<nfaces; i++) {
+ for (i= 0; i<nfaces; i++) {
MFace *mf= &mface[i];
- if(mf->v4)
+ if (mf->v4)
ntris+=1;
}
}
@@ -109,7 +109,7 @@ static void createVertsTrisData(bContext *C, LinkNode *obs, int *nverts_r, float
basenverts= 0;
tri= tris;
- for(oblink= obs, dmlink= dms; oblink && dmlink;
+ for (oblink= obs, dmlink= dms; oblink && dmlink;
oblink= oblink->next, dmlink= dmlink->next) {
ob= (Object*) oblink->link;
dm= (DerivedMesh*) dmlink->link;
@@ -118,7 +118,7 @@ static void createVertsTrisData(bContext *C, LinkNode *obs, int *nverts_r, float
mvert= dm->getVertArray(dm);
/* copy verts */
- for(i= 0; i<curnverts; i++) {
+ for (i= 0; i<curnverts; i++) {
MVert *v= &mvert[i];
copy_v3_v3(co, v->co);
@@ -133,7 +133,7 @@ static void createVertsTrisData(bContext *C, LinkNode *obs, int *nverts_r, float
curnfaces= dm->getNumTessFaces(dm);
mface= dm->getTessFaceArray(dm);
- for(i= 0; i<curnfaces; i++) {
+ for (i= 0; i<curnfaces; i++) {
MFace *mf= &mface[i];
tri[0]= basenverts + mf->v1;
@@ -141,7 +141,7 @@ static void createVertsTrisData(bContext *C, LinkNode *obs, int *nverts_r, float
tri[2]= basenverts + mf->v2;
tri += 3;
- if(mf->v4) {
+ if (mf->v4) {
tri[0]= basenverts + mf->v1;
tri[1]= basenverts + mf->v4;
tri[2]= basenverts + mf->v3;
@@ -153,7 +153,7 @@ static void createVertsTrisData(bContext *C, LinkNode *obs, int *nverts_r, float
}
/* release derived mesh */
- for(dmlink= dms; dmlink; dmlink= dmlink->next) {
+ for (dmlink= dms; dmlink; dmlink= dmlink->next) {
dm= (DerivedMesh*) dmlink->link;
dm->release(dm);
}
@@ -198,7 +198,7 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
/* Allocate voxel heightfield where we rasterize our input data to */
solid= recast_newHeightfield();
- if(!recast_createHeightfield(solid, width, height, bmin, bmax, recastParams->cellsize, recastParams->cellheight)) {
+ if (!recast_createHeightfield(solid, width, height, bmin, bmax, recastParams->cellsize, recastParams->cellheight)) {
recast_destroyHeightfield(solid);
return 0;
@@ -220,7 +220,7 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
/* ** Step 4: Partition walkable surface to simple regions ** */
chf= recast_newCompactHeightfield();
- if(!recast_buildCompactHeightfield(walkableHeight, walkableClimb, solid, chf)) {
+ if (!recast_buildCompactHeightfield(walkableHeight, walkableClimb, solid, chf)) {
recast_destroyHeightfield(solid);
recast_destroyCompactHeightfield(chf);
@@ -237,14 +237,14 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
}
/* Prepare for region partitioning, by calculating distance field along the walkable surface */
- if(!recast_buildDistanceField(chf)) {
+ if (!recast_buildDistanceField(chf)) {
recast_destroyCompactHeightfield(chf);
return 0;
}
/* Partition the walkable surface into simple regions without holes */
- if(!recast_buildRegions(chf, 0, minRegionArea, mergeRegionArea)) {
+ if (!recast_buildRegions(chf, 0, minRegionArea, mergeRegionArea)) {
recast_destroyCompactHeightfield(chf);
return 0;
@@ -254,7 +254,7 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
/* Create contours */
cset= recast_newContourSet();
- if(!recast_buildContours(chf, recastParams->edgemaxerror, maxEdgeLen, cset)) {
+ if (!recast_buildContours(chf, recastParams->edgemaxerror, maxEdgeLen, cset)) {
recast_destroyCompactHeightfield(chf);
recast_destroyContourSet(cset);
@@ -263,7 +263,7 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
/* ** Step 6: Build polygons mesh from contours ** */
*pmesh= recast_newPolyMesh();
- if(!recast_buildPolyMesh(cset, recastParams->vertsperpoly, *pmesh)) {
+ if (!recast_buildPolyMesh(cset, recastParams->vertsperpoly, *pmesh)) {
recast_destroyCompactHeightfield(chf);
recast_destroyContourSet(cset);
recast_destroyPolyMesh(*pmesh);
@@ -275,7 +275,7 @@ static int buildNavMesh(const RecastData *recastParams, int nverts, float *verts
/* ** Step 7: Create detail mesh which allows to access approximate height on each polygon ** */
*dmesh= recast_newPolyMeshDetail();
- if(!recast_buildPolyMeshDetail(*pmesh, chf, detailSampleDist, detailSampleMaxError, *dmesh)) {
+ if (!recast_buildPolyMeshDetail(*pmesh, chf, detailSampleDist, detailSampleMaxError, *dmesh)) {
recast_destroyCompactHeightfield(chf);
recast_destroyContourSet(cset);
recast_destroyPolyMesh(*pmesh);
@@ -309,7 +309,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
zero_v3(co);
zero_v3(rot);
- if(createob) {
+ if (createob) {
/* create new object */
obedit= ED_object_add_type(C, OB_MESH, co, rot, FALSE, 1);
}
@@ -323,7 +323,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
ED_object_enter_editmode(C, EM_DO_UNDO|EM_IGNORE_LAYER);
em = BMEdit_FromObject(obedit);
- if(!createob) {
+ if (!createob) {
/* clear */
EDBM_ClearMesh(em);
}
@@ -333,7 +333,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
recast_polyMeshGetBoundbox(pmesh, bmin, NULL);
recast_polyMeshGetCell(pmesh, &cs, &ch);
- for(i= 0; i<nverts; i++) {
+ for (i= 0; i<nverts; i++) {
v= &verts[3*i];
co[0]= bmin[0] + v[0]*cs;
co[1]= bmin[1] + v[1]*ch;
@@ -351,7 +351,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
dverts= recast_polyMeshDetailGetVerts(dmesh, NULL);
tris= recast_polyMeshDetailGetTris(dmesh, NULL);
- for(i= 0; i<nmeshes; i++) {
+ for (i= 0; i<nmeshes; i++) {
int uniquevbase= em->bm->totvert;
unsigned int vbase= meshes[4*i+0];
unsigned short ndv= meshes[4*i+1];
@@ -360,13 +360,13 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
const unsigned short *p= &polys[i*nvp*2];
int nv= 0;
- for(j= 0; j < nvp; ++j) {
- if(p[j]==0xffff) break;
+ for (j= 0; j < nvp; ++j) {
+ if (p[j]==0xffff) break;
nv++;
}
/* create unique verts */
- for(j= nv; j<ndv; j++) {
+ for (j= nv; j<ndv; j++) {
copy_v3_v3(co, &dverts[3*(vbase + j)]);
SWAP(float, co[1], co[2]);
BM_vert_create(em->bm, co, NULL);
@@ -375,13 +375,13 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
EDBM_init_index_arrays(em, 1, 0, 0);
/* create faces */
- for(j= 0; j<trinum; j++) {
+ for (j= 0; j<trinum; j++) {
unsigned char *tri= &tris[4*(tribase+j)];
BMFace *newFace;
int *polygonIdx;
- for(k= 0; k<3; k++) {
- if(tri[k]<nv)
+ for (k= 0; k<3; k++) {
+ if (tri[k]<nv)
face[k] = p[tri[k]]; /* shared vertex */
else
face[k] = uniquevbase+tri[k]-nv; /* unique vertex */
@@ -410,7 +410,7 @@ static Object *createRepresentation(bContext *C, struct recast_polyMesh *pmesh,
ED_object_exit_editmode(C, EM_FREEDATA);
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, obedit);
- if(createob) {
+ if (createob) {
obedit->gameflag&= ~OB_COLLISION;
obedit->gameflag|= OB_NAVMESH;
obedit->body_type= OB_BODY_TYPE_NAVMESH;
@@ -489,17 +489,17 @@ static int navmesh_face_copy_exec(bContext *C, wmOperator *op)
/* do work here */
BMFace *efa_act= BM_active_face_get(em->bm, FALSE);
- if(efa_act) {
- if(CustomData_has_layer(&em->bm->pdata, CD_RECAST)) {
+ if (efa_act) {
+ if (CustomData_has_layer(&em->bm->pdata, CD_RECAST)) {
BMFace *efa;
BMIter iter;
int targetPolyIdx= *(int*)CustomData_bmesh_get(&em->bm->pdata, efa_act->head.data, CD_RECAST);
targetPolyIdx= targetPolyIdx>=0? targetPolyIdx : -targetPolyIdx;
- if(targetPolyIdx > 0) {
+ if (targetPolyIdx > 0) {
/* set target poly idx to other selected faces */
BM_ITER(efa, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
- if(BM_elem_flag_test(efa, BM_ELEM_SELECT) && efa != efa_act) {
+ if (BM_elem_flag_test(efa, BM_ELEM_SELECT) && efa != efa_act) {
int *recastDataBlock = (int*)CustomData_bmesh_get(&em->bm->pdata, efa->head.data, CD_RECAST);
*recastDataBlock = targetPolyIdx;
}
@@ -557,10 +557,10 @@ static int findFreeNavPolyIndex(BMEditMesh *em)
/* search first free index */
freeIdx = 1;
- for(i = 0; i<numfaces; i++) {
- if(indices[i]==freeIdx)
+ for (i = 0; i<numfaces; i++) {
+ if (indices[i]==freeIdx)
freeIdx++;
- else if(indices[i]>freeIdx)
+ else if (indices[i]>freeIdx)
break;
}
@@ -576,15 +576,15 @@ static int navmesh_face_add_exec(bContext *C, wmOperator *UNUSED(op))
BMFace *ef;
BMIter iter;
- if(CustomData_has_layer(&em->bm->pdata, CD_RECAST)) {
+ if (CustomData_has_layer(&em->bm->pdata, CD_RECAST)) {
int targetPolyIdx = findFreeNavPolyIndex(em);
- if(targetPolyIdx>0) {
+ if (targetPolyIdx>0) {
/* set target poly idx to selected faces */
/*XXX this originally went last to first, but that isn't possible anymore*/
BM_ITER(ef, &iter, em->bm, BM_FACES_OF_MESH, NULL) {
- if(BM_elem_flag_test(ef, BM_ELEM_SELECT)) {
+ if (BM_elem_flag_test(ef, BM_ELEM_SELECT)) {
int *recastDataBlock = (int*)CustomData_bmesh_get(&em->bm->pdata, ef->head.data, CD_RECAST);
*recastDataBlock = targetPolyIdx;
}
diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c
index 29face0efc2..ccc6fa01735 100644
--- a/source/blender/editors/mesh/mesh_ops.c
+++ b/source/blender/editors/mesh/mesh_ops.c
@@ -178,7 +178,7 @@ void ED_operatortypes_mesh(void)
static int ED_operator_editmesh_face_select(bContext *C)
{
Object *obedit= CTX_data_edit_object(C);
- if(obedit && obedit->type==OB_MESH) {
+ if (obedit && obedit->type==OB_MESH) {
BMEditMesh *em = BMEdit_FromObject(obedit);
if (em && em->selectmode & SCE_SELECT_FACE) {
return 1;
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 919e2b03583..7d0172b3c15 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -110,20 +110,20 @@ int join_mesh_exec(bContext *C, wmOperator *op)
MDeformVert *dvert;
CustomData vdata, edata, fdata, ldata, pdata;
- if(scene->obedit) {
+ if (scene->obedit) {
BKE_report(op->reports, RPT_WARNING, "Cant join while in editmode");
return OPERATOR_CANCELLED;
}
/* ob is the object we are adding geometry to */
- if(!ob || ob->type!=OB_MESH) {
+ if (!ob || ob->type!=OB_MESH) {
BKE_report(op->reports, RPT_WARNING, "Active object is not a mesh");
return OPERATOR_CANCELLED;
}
/* count & check */
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
- if(base->object->type==OB_MESH) {
+ if (base->object->type==OB_MESH) {
me= base->object->data;
totvert+= me->totvert;
@@ -132,18 +132,18 @@ int join_mesh_exec(bContext *C, wmOperator *op)
totpoly+= me->totpoly;
totmat+= base->object->totcol;
- if(base->object == ob)
+ if (base->object == ob)
ok= 1;
/* check for shapekeys */
- if(me->key)
+ if (me->key)
haskey++;
}
}
CTX_DATA_END;
/* that way the active object is always selected */
- if(ok==0) {
+ if (ok==0) {
BKE_report(op->reports, RPT_WARNING, "Active object is not a selected mesh");
return OPERATOR_CANCELLED;
}
@@ -152,12 +152,12 @@ int join_mesh_exec(bContext *C, wmOperator *op)
me= (Mesh *)ob->data;
key= me->key;
- if(totvert==0 || totvert==me->totvert) {
+ if (totvert==0 || totvert==me->totvert) {
BKE_report(op->reports, RPT_WARNING, "No mesh data to join");
return OPERATOR_CANCELLED;
}
- if(totvert > MESH_MAX_VERTS) {
+ if (totvert > MESH_MAX_VERTS) {
BKE_reportf(op->reports, RPT_WARNING, "Joining results in %d vertices, limit is " STRINGIFY(MESH_MAX_VERTS), totvert);
return OPERATOR_CANCELLED;
}
@@ -168,7 +168,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
totcol= ob->totcol;
/* obact materials in new main array, is nicer start! */
- for(a=0; a<ob->totcol; a++) {
+ for (a=0; a<ob->totcol; a++) {
matar[a]= give_current_material(ob, a+1);
id_us_plus((ID *)matar[a]);
/* increase id->us : will be lowered later */
@@ -179,19 +179,19 @@ int join_mesh_exec(bContext *C, wmOperator *op)
* - if destination mesh didn't have shapekeys, but we encountered some in the meshes we're
* joining, set up a new keyblock and assign to the mesh
*/
- if(key) {
+ if (key) {
/* make a duplicate copy that will only be used here... (must remember to free it!) */
nkey= copy_key(key);
/* for all keys in old block, clear data-arrays */
- for(kb= key->block.first; kb; kb= kb->next) {
- if(kb->data) MEM_freeN(kb->data);
+ for (kb= key->block.first; kb; kb= kb->next) {
+ if (kb->data) MEM_freeN(kb->data);
kb->data= MEM_callocN(sizeof(float)*3*totvert, "join_shapekey");
kb->totelem= totvert;
kb->weights= NULL;
}
}
- else if(haskey) {
+ else if (haskey) {
/* add a new key-block and add to the mesh */
key= me->key= add_key((ID *)me);
key->type = KEY_RELATIVE;
@@ -200,48 +200,48 @@ int join_mesh_exec(bContext *C, wmOperator *op)
/* first pass over objects - copying materials and vertexgroups across */
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
/* only act if a mesh, and not the one we're joining to */
- if((ob!=base->object) && (base->object->type==OB_MESH)) {
+ if ((ob!=base->object) && (base->object->type==OB_MESH)) {
me= base->object->data;
/* Join this object's vertex groups to the base one's */
- for(dg=base->object->defbase.first; dg; dg=dg->next) {
+ for (dg=base->object->defbase.first; dg; dg=dg->next) {
/* See if this group exists in the object (if it doesn't, add it to the end) */
- if(!defgroup_find_name(ob, dg->name)) {
+ if (!defgroup_find_name(ob, dg->name)) {
odg = MEM_callocN(sizeof(bDeformGroup), "join deformGroup");
memcpy(odg, dg, sizeof(bDeformGroup));
BLI_addtail(&ob->defbase, odg);
}
}
- if(ob->defbase.first && ob->actdef==0)
+ if (ob->defbase.first && ob->actdef==0)
ob->actdef=1;
- if(me->totvert) {
+ if (me->totvert) {
/* Add this object's materials to the base one's if they don't exist already (but only if limits not exceeded yet) */
- if(totcol < MAXMAT) {
- for(a=1; a<=base->object->totcol; a++) {
+ if (totcol < MAXMAT) {
+ for (a=1; a<=base->object->totcol; a++) {
ma= give_current_material(base->object, a);
- for(b=0; b<totcol; b++) {
- if(ma == matar[b]) break;
+ for (b=0; b<totcol; b++) {
+ if (ma == matar[b]) break;
}
- if(b==totcol) {
+ if (b==totcol) {
matar[b]= ma;
- if(ma) {
+ if (ma) {
id_us_plus(&ma->id);
}
totcol++;
}
- if(totcol >= MAXMAT)
+ if (totcol >= MAXMAT)
break;
}
}
/* if this mesh has shapekeys, check if destination mesh already has matching entries too */
- if(me->key && key) {
- for(kb= me->key->block.first; kb; kb= kb->next) {
+ if (me->key && key) {
+ for (kb= me->key->block.first; kb; kb= kb->next) {
/* if key doesn't exist in destination mesh, add it */
- if(key_get_named_keyblock(key, kb->name) == NULL) {
+ if (key_get_named_keyblock(key, kb->name) == NULL) {
/* copy this existing one over to the new shapekey block */
kbn= MEM_dupallocN(kb);
kbn->prev= kbn->next= NULL;
@@ -253,7 +253,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
okb= key->block.last;
curpos= (okb) ? okb->pos : -0.1f;
- if(key->type == KEY_RELATIVE)
+ if (key->type == KEY_RELATIVE)
kbn->pos= curpos + 0.1f;
else
kbn->pos= curpos;
@@ -261,12 +261,12 @@ int join_mesh_exec(bContext *C, wmOperator *op)
BLI_addtail(&key->block, kbn);
kbn->adrcode= key->totkey;
key->totkey++;
- if(key->totkey==1) key->refkey= kbn;
+ if (key->totkey==1) key->refkey= kbn;
// XXX 2.5 Animato
#if 0
/* also, copy corresponding ipo-curve to ipo-block if applicable */
- if(me->key->ipo && key->ipo) {
+ if (me->key->ipo && key->ipo) {
// FIXME... this is a luxury item!
puts("FIXME: ignoring IPO's when joining shapekeys on Meshes for now...");
}
@@ -301,10 +301,10 @@ int join_mesh_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
/* only join if this is a mesh */
- if(base->object->type==OB_MESH) {
+ if (base->object->type==OB_MESH) {
me= base->object->data;
- if(me->totvert) {
+ if (me->totvert) {
/* standard data */
CustomData_merge(&me->vdata, &vdata, CD_MASK_MESH, CD_DEFAULT, totvert);
CustomData_copy_data(&me->vdata, &vdata, 0, vertofs, me->totvert);
@@ -313,15 +313,15 @@ int join_mesh_exec(bContext *C, wmOperator *op)
dvert= CustomData_get(&vdata, vertofs, CD_MDEFORMVERT);
/* NB: vertex groups here are new version */
- if(dvert) {
- for(i=0; i<me->totvert; i++) {
- for(j=0; j<dvert[i].totweight; j++) {
+ if (dvert) {
+ for (i=0; i<me->totvert; i++) {
+ for (j=0; j<dvert[i].totweight; j++) {
/* Find the old vertex group */
odg = BLI_findlink(&base->object->defbase, dvert[i].dw[j].def_nr);
- if(odg) {
+ if (odg) {
/* Search for a match in the new object, and set new index */
- for(dg=ob->defbase.first, index=0; dg; dg=dg->next, index++) {
- if(!strcmp(dg->name, odg->name)) {
+ for (dg=ob->defbase.first, index=0; dg; dg=dg->next, index++) {
+ if (!strcmp(dg->name, odg->name)) {
dvert[i].dw[j].def_nr = index;
break;
}
@@ -332,12 +332,12 @@ int join_mesh_exec(bContext *C, wmOperator *op)
}
/* if this is the object we're merging into, no need to do anything */
- if(base->object != ob) {
+ if (base->object != ob) {
/* watch this: switch matmul order really goes wrong */
mult_m4_m4m4(cmat, imat, base->object->obmat);
/* transform vertex coordinates into new space */
- for(a=0, mv=mvert; a < me->totvert; a++, mv++) {
+ for (a=0, mv=mvert; a < me->totvert; a++, mv++) {
mul_m4_v3(cmat, mv->co);
}
@@ -345,18 +345,18 @@ int join_mesh_exec(bContext *C, wmOperator *op)
* - if there's a matching one, copy it across (will need to transform vertices into new space...)
* - otherwise, just copy own coordinates of mesh (no need to transform vertex coordinates into new space)
*/
- if(key) {
+ if (key) {
/* if this mesh has any shapekeys, check first, otherwise just copy coordinates */
- for(kb= key->block.first; kb; kb= kb->next) {
+ for (kb= key->block.first; kb; kb= kb->next) {
/* get pointer to where to write data for this mesh in shapekey's data array */
fp1= ((float *)kb->data) + (vertofs*3);
/* check if this mesh has such a shapekey */
okb= key_get_named_keyblock(me->key, kb->name);
- if(okb) {
+ if (okb) {
/* copy this mesh's shapekey to the destination shapekey (need to transform first) */
fp2= ((float *)(okb->data));
- for(a=0; a < me->totvert; a++, fp1+=3, fp2+=3) {
+ for (a=0; a < me->totvert; a++, fp1+=3, fp2+=3) {
copy_v3_v3(fp1, fp2);
mul_m4_v3(cmat, fp1);
}
@@ -364,7 +364,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
else {
/* copy this mesh's vertex coordinates to the destination shapekey */
mv= mvert;
- for(a=0; a < me->totvert; a++, fp1+=3, mv++) {
+ for (a=0; a < me->totvert; a++, fp1+=3, mv++) {
copy_v3_v3(fp1, mv->co);
}
}
@@ -376,24 +376,24 @@ int join_mesh_exec(bContext *C, wmOperator *op)
* - if it was an 'original', copy the appropriate data from nkey
* - otherwise, copy across plain coordinates (no need to transform coordinates)
*/
- if(key) {
- for(kb= key->block.first; kb; kb= kb->next) {
+ if (key) {
+ for (kb= key->block.first; kb; kb= kb->next) {
/* get pointer to where to write data for this mesh in shapekey's data array */
fp1= ((float *)kb->data) + (vertofs*3);
/* check if this was one of the original shapekeys */
okb= key_get_named_keyblock(nkey, kb->name);
- if(okb) {
+ if (okb) {
/* copy this mesh's shapekey to the destination shapekey */
fp2= ((float *)(okb->data));
- for(a=0; a < me->totvert; a++, fp1+=3, fp2+=3) {
+ for (a=0; a < me->totvert; a++, fp1+=3, fp2+=3) {
copy_v3_v3(fp1, fp2);
}
}
else {
/* copy base-coordinates to the destination shapekey */
mv= mvert;
- for(a=0; a < me->totvert; a++, fp1+=3, mv++) {
+ for (a=0; a < me->totvert; a++, fp1+=3, mv++) {
copy_v3_v3(fp1, mv->co);
}
}
@@ -405,36 +405,36 @@ int join_mesh_exec(bContext *C, wmOperator *op)
mvert+= me->totvert;
}
- if(me->totedge) {
+ if (me->totedge) {
CustomData_merge(&me->edata, &edata, CD_MASK_MESH, CD_DEFAULT, totedge);
CustomData_copy_data(&me->edata, &edata, 0, edgeofs, me->totedge);
- for(a=0; a<me->totedge; a++, medge++) {
+ for (a=0; a<me->totedge; a++, medge++) {
medge->v1+= vertofs;
medge->v2+= vertofs;
}
}
if (me->totloop) {
- if(base->object!=ob)
+ if (base->object!=ob)
multiresModifier_prepare_join(scene, base->object, ob);
CustomData_merge(&me->ldata, &ldata, CD_MASK_MESH, CD_DEFAULT, totloop);
CustomData_copy_data(&me->ldata, &ldata, 0, loopofs, me->totloop);
- for(a=0; a<me->totloop; a++, mloop++) {
+ for (a=0; a<me->totloop; a++, mloop++) {
mloop->v += vertofs;
mloop->e += edgeofs;
}
}
- if(me->totpoly) {
+ if (me->totpoly) {
/* make mapping for materials */
- for(a=1; a<=base->object->totcol; a++) {
+ for (a=1; a<=base->object->totcol; a++) {
ma= give_current_material(base->object, a);
- for(b=0; b<totcol; b++) {
- if(ma == matar[b]) {
+ for (b=0; b<totcol; b++) {
+ if (ma == matar[b]) {
matmap[a-1]= b;
break;
}
@@ -444,7 +444,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
CustomData_merge(&me->pdata, &pdata, CD_MASK_MESH, CD_DEFAULT, totpoly);
CustomData_copy_data(&me->pdata, &pdata, 0, polyofs, me->totpoly);
- for(a=0; a<me->totpoly; a++, mpoly++) {
+ for (a=0; a<me->totpoly; a++, mpoly++) {
mpoly->loopstart += loopofs;
mpoly->mat_nr= matmap ? matmap[(int)mpoly->mat_nr] : 0;
}
@@ -460,7 +460,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
loopofs += me->totloop;
/* free base, now that data is merged */
- if(base->object != ob)
+ if (base->object != ob)
ED_base_object_free_and_unlink(bmain, scene, base);
}
}
@@ -487,21 +487,21 @@ int join_mesh_exec(bContext *C, wmOperator *op)
mesh_update_customdata_pointers(me, TRUE); /* BMESH_TODO, check if this arg can be failse, non urgent - campbell */
/* old material array */
- for(a=1; a<=ob->totcol; a++) {
+ for (a=1; a<=ob->totcol; a++) {
ma= ob->mat[a-1];
- if(ma) ma->id.us--;
+ if (ma) ma->id.us--;
}
- for(a=1; a<=me->totcol; a++) {
+ for (a=1; a<=me->totcol; a++) {
ma= me->mat[a-1];
- if(ma) ma->id.us--;
+ if (ma) ma->id.us--;
}
- if(ob->mat) MEM_freeN(ob->mat);
- if(ob->matbits) MEM_freeN(ob->matbits);
- if(me->mat) MEM_freeN(me->mat);
+ if (ob->mat) MEM_freeN(ob->mat);
+ if (ob->matbits) MEM_freeN(ob->matbits);
+ if (me->mat) MEM_freeN(me->mat);
ob->mat= me->mat= NULL;
ob->matbits= NULL;
- if(totcol) {
+ if (totcol) {
me->mat= matar;
ob->mat= MEM_callocN(sizeof(void *)*totcol, "join obmatar");
ob->matbits= MEM_callocN(sizeof(char)*totcol, "join obmatbits");
@@ -517,11 +517,11 @@ int join_mesh_exec(bContext *C, wmOperator *op)
test_object_materials((ID *)me);
/* free temp copy of destination shapekeys (if applicable) */
- if(nkey) {
+ if (nkey) {
// XXX 2.5 Animato
#if 0
/* free it's ipo too - both are not actually freed from memory yet as ID-blocks */
- if(nkey->ipo) {
+ if (nkey->ipo) {
free_ipo(nkey->ipo);
BLI_remlink(&bmain->ipo, nkey->ipo);
MEM_freeN(nkey->ipo);
@@ -590,7 +590,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- if(key == NULL) {
+ if (key == NULL) {
key= me->key= add_key((ID *)me);
key->type= KEY_RELATIVE;
@@ -603,7 +603,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
CTX_DATA_BEGIN(C, Base*, base, selected_editable_bases) {
if (base->object == ob) continue;
- if(base->object->type==OB_MESH) {
+ if (base->object->type==OB_MESH) {
selme = (Mesh *)base->object->data;
if (selme->totvert==me->totvert) {
@@ -656,16 +656,16 @@ static int mesh_octree_get_base_offs(float *co, float *offs, float *div)
static void mesh_octree_add_node(MocNode **bt, intptr_t index)
{
- if(*bt==NULL) {
+ if (*bt==NULL) {
*bt= MEM_callocN(sizeof(MocNode), "MocNode");
(*bt)->index[0]= index;
}
else {
int a;
- for(a=0; a<MOC_NODE_RES; a++) {
- if((*bt)->index[a]==index)
+ for (a=0; a<MOC_NODE_RES; a++) {
+ if ((*bt)->index[a]==index)
return;
- else if((*bt)->index[a]==0) {
+ else if ((*bt)->index[a]==0) {
(*bt)->index[a]= index;
return;
}
@@ -676,7 +676,7 @@ static void mesh_octree_add_node(MocNode **bt, intptr_t index)
static void mesh_octree_free_node(MocNode **bt)
{
- if( (*bt)->next ) {
+ if ( (*bt)->next ) {
mesh_octree_free_node(&(*bt)->next);
}
MEM_freeN(*bt);
@@ -739,26 +739,26 @@ static intptr_t mesh_octree_find_index(MocNode **bt, MVert *mvert, float *co)
float *vec;
int a;
- if(*bt==NULL)
+ if (*bt==NULL)
return -1;
- for(a=0; a<MOC_NODE_RES; a++) {
- if((*bt)->index[a]) {
+ for (a=0; a<MOC_NODE_RES; a++) {
+ if ((*bt)->index[a]) {
/* does mesh verts and editmode, code looks potential dangerous, octree should really be filled OK! */
- if(mvert) {
+ if (mvert) {
vec= (mvert+(*bt)->index[a]-1)->co;
- if(compare_v3v3(vec, co, MOC_THRESH))
+ if (compare_v3v3(vec, co, MOC_THRESH))
return (*bt)->index[a]-1;
}
else {
BMVert *eve= (BMVert *)((*bt)->index[a]);
- if(compare_v3v3(eve->co, co, MOC_THRESH))
+ if (compare_v3v3(eve->co, co, MOC_THRESH))
return (*bt)->index[a];
}
}
else return -1;
}
- if( (*bt)->next)
+ if ( (*bt)->next)
return mesh_octree_find_index(&(*bt)->next, mvert, co);
return -1;
@@ -775,21 +775,21 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode)
{
MocNode **bt;
- if(mode=='u') { /* use table */
- if(MeshOctree.table==NULL)
+ if (mode=='u') { /* use table */
+ if (MeshOctree.table==NULL)
mesh_octree_table(ob, em, NULL, 's');
- if(MeshOctree.table) {
+ if (MeshOctree.table) {
Mesh *me= ob->data;
bt= MeshOctree.table + mesh_octree_get_base_offs(co, MeshOctree.offs, MeshOctree.div);
- if(em)
+ if (em)
return mesh_octree_find_index(bt, NULL, co);
else
return mesh_octree_find_index(bt, me->mvert, co);
}
return -1;
}
- else if(mode=='s') { /* start table */
+ else if (mode=='s') { /* start table */
Mesh *me= ob->data;
float min[3], max[3];
@@ -797,7 +797,7 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode)
* we are using the undeformed coordinates*/
INIT_MINMAX(min, max);
- if(em && me->edit_btmesh==em) {
+ if (em && me->edit_btmesh==em) {
BMIter iter;
BMVert *eve;
@@ -809,7 +809,7 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode)
MVert *mvert;
int a;
- for(a=0, mvert= me->mvert; a<me->totvert; a++, mvert++)
+ for (a=0, mvert= me->mvert; a<me->totvert; a++, mvert++)
DO_MINMAX(mvert->co, min, max);
}
@@ -825,16 +825,16 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode)
MeshOctree.div[2]+= 2*MOC_THRESH;
mul_v3_fl(MeshOctree.div, 1.0f/MOC_RES);
- if(MeshOctree.div[0]==0.0f) MeshOctree.div[0]= 1.0f;
- if(MeshOctree.div[1]==0.0f) MeshOctree.div[1]= 1.0f;
- if(MeshOctree.div[2]==0.0f) MeshOctree.div[2]= 1.0f;
+ if (MeshOctree.div[0]==0.0f) MeshOctree.div[0]= 1.0f;
+ if (MeshOctree.div[1]==0.0f) MeshOctree.div[1]= 1.0f;
+ if (MeshOctree.div[2]==0.0f) MeshOctree.div[2]= 1.0f;
- if(MeshOctree.table) /* happens when entering this call without ending it */
+ if (MeshOctree.table) /* happens when entering this call without ending it */
mesh_octree_table(ob, em, co, 'e');
MeshOctree.table= MEM_callocN(MOC_RES*MOC_RES*MOC_RES*sizeof(void *), "sym table");
- if(em && me->edit_btmesh==em) {
+ if (em && me->edit_btmesh==em) {
BMVert *eve;
BMIter iter;
@@ -846,16 +846,16 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode)
MVert *mvert;
int a;
- for(a=0, mvert= me->mvert; a<me->totvert; a++, mvert++)
+ for (a=0, mvert= me->mvert; a<me->totvert; a++, mvert++)
mesh_octree_add_nodes(MeshOctree.table, mvert->co, MeshOctree.offs, MeshOctree.div, a+1);
}
}
- else if(mode=='e') { /* end table */
- if(MeshOctree.table) {
+ else if (mode=='e') { /* end table */
+ if (MeshOctree.table) {
int a;
- for(a=0, bt=MeshOctree.table; a<MOC_RES*MOC_RES*MOC_RES; a++, bt++) {
- if(*bt) mesh_octree_free_node(bt);
+ for (a=0, bt=MeshOctree.table; a<MOC_RES*MOC_RES*MOC_RES; a++, bt++) {
+ if (*bt) mesh_octree_free_node(bt);
}
MEM_freeN(MeshOctree.table);
MeshOctree.table= NULL;
@@ -871,15 +871,15 @@ MirrTopoStore_t mesh_topo_store= {NULL, -1. -1, -1};
/* 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)
{
- if(mode=='u') { /* use table */
+ if (mode=='u') { /* use table */
if (ED_mesh_mirrtopo_recalc_check(ob->data, ob->mode, &mesh_topo_store)) {
mesh_mirrtopo_table(ob, 's');
}
}
- else if(mode=='s') { /* start table */
+ else if (mode=='s') { /* start table */
ED_mesh_mirrtopo_init(ob->data, ob->mode, &mesh_topo_store, FALSE);
}
- else if(mode=='e') { /* end table */
+ else if (mode=='e') { /* end table */
ED_mesh_mirrtopo_free(&mesh_topo_store);
}
return 0;
@@ -911,7 +911,8 @@ int mesh_get_x_mirror_vert(Object *ob, int index)
{
if (((Mesh *)ob->data)->editflag & ME_EDIT_MIRROR_TOPO) {
return mesh_get_x_mirror_vert_topo(ob, index);
- } else {
+ }
+ else {
return mesh_get_x_mirror_vert_spacial(ob, index);
}
return 0;
@@ -934,7 +935,7 @@ static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, f
vec[2]= co[2];
poinval= mesh_octree_table(ob, em, vec, 'u');
- if(poinval != -1)
+ if (poinval != -1)
return (BMVert *)(poinval);
return NULL;
}
@@ -963,7 +964,7 @@ static BMVert *editbmesh_get_x_mirror_vert_topo(Object *ob, struct BMEditMesh *e
poinval= mesh_topo_store.index_lookup[index];
- if(poinval != -1)
+ if (poinval != -1)
return (BMVert *)(poinval);
return NULL;
}
@@ -998,7 +999,8 @@ static float *editmesh_get_mirror_uv(BMEditMesh *em, int axis, float *uv, float
cent_vec[0] = face_cent[0];
cent_vec[1]= -((face_cent[1])-mirrCent[1]) + mirrCent[1];
- } else {
+ }
+ else {
vec[0]= -((uv[0])-mirrCent[0]) + mirrCent[0];
vec[1]= uv[1];
@@ -1039,7 +1041,7 @@ static unsigned int mirror_facehash(const void *ptr)
const MFace *mf= ptr;
int v0, v1;
- if(mf->v4) {
+ if (mf->v4) {
v0= MIN4(mf->v1, mf->v2, mf->v3, mf->v4);
v1= MAX4(mf->v1, mf->v2, mf->v3, mf->v4);
}
@@ -1053,22 +1055,22 @@ static unsigned int mirror_facehash(const void *ptr)
static int mirror_facerotation(MFace *a, MFace *b)
{
- if(b->v4) {
- if(a->v1==b->v1 && a->v2==b->v2 && a->v3==b->v3 && a->v4==b->v4)
+ if (b->v4) {
+ if (a->v1==b->v1 && a->v2==b->v2 && a->v3==b->v3 && a->v4==b->v4)
return 0;
- else if(a->v4==b->v1 && a->v1==b->v2 && a->v2==b->v3 && a->v3==b->v4)
+ else if (a->v4==b->v1 && a->v1==b->v2 && a->v2==b->v3 && a->v3==b->v4)
return 1;
- else if(a->v3==b->v1 && a->v4==b->v2 && a->v1==b->v3 && a->v2==b->v4)
+ else if (a->v3==b->v1 && a->v4==b->v2 && a->v1==b->v3 && a->v2==b->v4)
return 2;
- else if(a->v2==b->v1 && a->v3==b->v2 && a->v4==b->v3 && a->v1==b->v4)
+ else if (a->v2==b->v1 && a->v3==b->v2 && a->v4==b->v3 && a->v1==b->v4)
return 3;
}
else {
- if(a->v1==b->v1 && a->v2==b->v2 && a->v3==b->v3)
+ if (a->v1==b->v1 && a->v2==b->v2 && a->v3==b->v3)
return 0;
- else if(a->v3==b->v1 && a->v1==b->v2 && a->v2==b->v3)
+ else if (a->v3==b->v1 && a->v1==b->v2 && a->v2==b->v3)
return 1;
- else if(a->v2==b->v1 && a->v3==b->v2 && a->v1==b->v3)
+ else if (a->v2==b->v1 && a->v3==b->v2 && a->v1==b->v3)
return 2;
}
@@ -1095,29 +1097,29 @@ int *mesh_get_x_mirror_faces(Object *ob, BMEditMesh *em)
mesh_octree_table(ob, em, NULL, 's');
- for(a=0, mv=mvert; a<me->totvert; a++, mv++)
+ for (a=0, mv=mvert; a<me->totvert; a++, mv++)
mirrorverts[a]= mesh_get_x_mirror_vert(ob, a);
mesh_octree_table(ob, em, NULL, 'e');
fhash= BLI_ghash_new(mirror_facehash, mirror_facecmp, "mirror_facehash gh");
- for(a=0, mf=mface; a<me->totface; a++, mf++)
+ for (a=0, mf=mface; a<me->totface; a++, mf++)
BLI_ghash_insert(fhash, mf, mf);
- for(a=0, mf=mface; a<me->totface; a++, mf++) {
+ for (a=0, mf=mface; a<me->totface; a++, mf++) {
mirrormf.v1= mirrorverts[mf->v3];
mirrormf.v2= mirrorverts[mf->v2];
mirrormf.v3= mirrorverts[mf->v1];
mirrormf.v4= (mf->v4)? mirrorverts[mf->v4]: 0;
/* make sure v4 is not 0 if a quad */
- if(mf->v4 && mirrormf.v4==0) {
+ if (mf->v4 && mirrormf.v4==0) {
SWAP(unsigned int, mirrormf.v1, mirrormf.v3);
SWAP(unsigned int, mirrormf.v2, mirrormf.v4);
}
hashmf= BLI_ghash_lookup(fhash, &mirrormf);
- if(hashmf) {
+ if (hashmf) {
mirrorfaces[a*2]= hashmf - mface;
mirrorfaces[a*2+1]= mirror_facerotation(&mirrormf, hashmf);
}