Style Cleanup: whitespace and some formatting.

This commit is contained in:
2012-02-07 08:50:24 +00:00
parent 04e0c16bb6
commit f552164c71
35 changed files with 308 additions and 299 deletions

View File

@@ -49,8 +49,8 @@ def main():
check_commands = [] check_commands = []
for c, inc_dirs, defs in source_info: for c, inc_dirs, defs in source_info:
if not 'bevel' in c: continue # if not 'bevel' in c: continue
if 'MOD' in c: continue # if 'MOD' in c: continue
cmd = ([CHECKER_BIN] + cmd = ([CHECKER_BIN] +
CHECKER_ARGS + CHECKER_ARGS +
[c] + [c] +

View File

@@ -73,7 +73,7 @@ struct GHashIterator;
/* slot type arrays are terminated by the last member /* slot type arrays are terminated by the last member
* having a slot type of 0.*/ * having a slot type of 0.*/
#define BMOP_OPSLOT_SENTINEL 0 #define BMOP_OPSLOT_SENTINEL 0
#define BMOP_OPSLOT_INT 1 #define BMOP_OPSLOT_INT 1
#define BMOP_OPSLOT_FLT 2 #define BMOP_OPSLOT_FLT 2
#define BMOP_OPSLOT_PNT 3 #define BMOP_OPSLOT_PNT 3
@@ -88,8 +88,8 @@ struct GHashIterator;
*/ */
//it's very important this remain a power of two //it's very important this remain a power of two
#define BMOP_OPSLOT_ELEMENT_BUF 8 #define BMOP_OPSLOT_ELEMENT_BUF 8
#define BMOP_OPSLOT_MAPPING 9 #define BMOP_OPSLOT_MAPPING 9
#define BMOP_OPSLOT_TYPES 10 #define BMOP_OPSLOT_TYPES 10
/* please ignore all these structures, don't touch them in tool code, except /* please ignore all these structures, don't touch them in tool code, except
* for when your defining an operator with BMOpDefine.*/ * for when your defining an operator with BMOpDefine.*/
@@ -109,7 +109,7 @@ typedef struct BMOpSlot{
} data; } data;
} BMOpSlot; } BMOpSlot;
#define BMOP_MAX_SLOTS 16 /* way more than probably needed */ #define BMOP_MAX_SLOTS 16 /* way more than probably needed */
#ifdef slots #ifdef slots
#undef slots #undef slots
@@ -339,7 +339,7 @@ int BMO_Vert_CountEdgeFlags(BMesh *bm, BMVert *v, int toolflag);
/* flags all elements in a mapping. note that the mapping must only have /* flags all elements in a mapping. note that the mapping must only have
* bmesh elements in it.*/ * bmesh elements in it.*/
void BMO_Mapping_To_Flag(struct BMesh *bm, struct BMOperator *op, void BMO_Mapping_To_Flag(struct BMesh *bm, struct BMOperator *op,
const char *slotname, int flag); const char *slotname, int flag);
/* pointer versoins of BMO_Get_MapFloat and BMO_Insert_MapFloat. /* pointer versoins of BMO_Get_MapFloat and BMO_Insert_MapFloat.
* *

View File

@@ -104,8 +104,8 @@ struct EditMesh;
void BMOP_DupeFromFlag(struct BMesh *bm, int etypeflag, const char hflag); void BMOP_DupeFromFlag(struct BMesh *bm, int etypeflag, const char hflag);
void BM_esubdivideflag(struct Object *obedit, BMesh *bm, int flag, float smooth, void BM_esubdivideflag(struct Object *obedit, BMesh *bm, int flag, float smooth,
float fractal, int beauty, int numcuts, int seltype, float fractal, int beauty, int numcuts, int seltype,
int cornertype, int singleedge, int gridfill, int seed); int cornertype, int singleedge, int gridfill, int seed);
void BM_extrudefaceflag(BMesh *bm, int flag); void BM_extrudefaceflag(BMesh *bm, int flag);
/* this next one return 1 if they did anything, or zero otherwise. /* this next one return 1 if they did anything, or zero otherwise.

View File

@@ -279,24 +279,21 @@ void BMO_CopySlot(BMOperator *source_op, BMOperator *dest_op, const char *src, c
if (!source_slot->data.ghash) return; if (!source_slot->data.ghash) return;
if (!dest_slot->data.ghash) { if (!dest_slot->data.ghash) {
dest_slot->data.ghash = dest_slot->data.ghash = BLI_ghash_new(BLI_ghashutil_ptrhash,
BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh operator 2");
BLI_ghashutil_ptrcmp, "bmesh operator 2");
} }
BLI_ghashIterator_init(&it, source_slot->data.ghash); BLI_ghashIterator_init(&it, source_slot->data.ghash);
for ( ; (srcmap = BLI_ghashIterator_getValue(&it)); for ( ; (srcmap = BLI_ghashIterator_getValue(&it));
BLI_ghashIterator_step(&it)) BLI_ghashIterator_step(&it))
{ {
dstmap = BLI_memarena_alloc(dest_op->arena, dstmap = BLI_memarena_alloc(dest_op->arena, sizeof(*dstmap) + srcmap->len);
sizeof(*dstmap) + srcmap->len);
dstmap->element = srcmap->element; dstmap->element = srcmap->element;
dstmap->len = srcmap->len; dstmap->len = srcmap->len;
memcpy(dstmap + 1, srcmap + 1, srcmap->len); memcpy(dstmap + 1, srcmap + 1, srcmap->len);
BLI_ghash_insert(dest_slot->data.ghash, BLI_ghash_insert(dest_slot->data.ghash, dstmap->element, dstmap);
dstmap->element, dstmap);
} }
} }
} }
@@ -1101,7 +1098,7 @@ typedef struct BMOFlag {
int flag; int flag;
} BMOFlag; } BMOFlag;
#define PAIR(f) {#f, f}, #define PAIR(f) {#f, f},fv
static const char *bmesh_flags = { static const char *bmesh_flags = {
PAIR(BM_SELECT); PAIR(BM_SELECT);
PAIR(BM_SEAM); PAIR(BM_SEAM);
@@ -1309,26 +1306,30 @@ int BMO_VInitOpf(BMesh *bm, BMOperator *op, const char *_fmt, va_list vlist)
ret = 0; ret = 0;
stop = 0; stop = 0;
while (1) { while (1) {
switch (NEXT_CHAR(fmt)) { switch (NEXT_CHAR(fmt)) {
case 'f': ret |= BM_FACE; break; case 'f': ret |= BM_FACE; break;
case 'e': ret |= BM_EDGE; break; case 'e': ret |= BM_EDGE; break;
case 'v': ret |= BM_VERT; break; case 'v': ret |= BM_VERT; break;
default: default:
stop = 1; stop = 1;
break;
}
if (stop) {
break; break;
} }
if (stop) break;
fmt++; fmt++;
} }
if (type == 'h') if (type == 'h') {
BMO_HeaderFlag_To_Slot(bm, op, BMO_HeaderFlag_To_Slot(bm, op, slotname, va_arg(vlist, int), ret);
slotname, va_arg(vlist, int), ret); }
else if (type == 'a') else if (type == 'a') {
BMO_All_To_Slot(bm, op, slotname, ret); BMO_All_To_Slot(bm, op, slotname, ret);
else }
BMO_Flag_To_Slot(bm, op, slotname, else {
va_arg(vlist, int), ret); BMO_Flag_To_Slot(bm, op, slotname, va_arg(vlist, int), ret);
}
} }
state = 1; state = 1;

View File

@@ -453,8 +453,9 @@ void bmesh_bevel_exec(BMesh *bm, BMOperator *op)
} }
e = BM_Make_Edge(bm, firstv, lastv, BM_FACE_FIRST_LOOP(faces[i])->e, 1); e = BM_Make_Edge(bm, firstv, lastv, BM_FACE_FIRST_LOOP(faces[i])->e, 1);
if (BM_FACE_FIRST_LOOP(faces[i])->prev->e != e) if (BM_FACE_FIRST_LOOP(faces[i])->prev->e != e) {
BM_Copy_Attributes(bm, bm, BM_FACE_FIRST_LOOP(faces[i])->prev->e, e); BM_Copy_Attributes(bm, bm, BM_FACE_FIRST_LOOP(faces[i])->prev->e, e);
}
BLI_array_append(edges, e); BLI_array_append(edges, e);
f = BM_Make_Ngon(bm, verts[0], verts[1], edges, BLI_array_count(edges), 0); f = BM_Make_Ngon(bm, verts[0], verts[1], edges, BLI_array_count(edges), 0);

View File

@@ -227,8 +227,9 @@ static void copy_mesh(BMOperator *op, BMesh *source, BMesh *target)
} }
} }
if (iso) if (iso) {
BMO_Insert_MapPointer(source, op, "isovertmap", v, v2); BMO_Insert_MapPointer(source, op, "isovertmap", v, v2);
}
BMO_SetFlag(source, (BMHeader *)v, DUPE_DONE); BMO_SetFlag(source, (BMHeader *)v, DUPE_DONE);
} }

View File

@@ -400,11 +400,11 @@ void bmesh_bridge_loops_exec(BMesh *bm, BMOperator *op)
} }
f = BM_Make_Face_QuadTri(bm, f = BM_Make_Face_QuadTri(bm,
vv1[i1], vv1[i1],
vv2[i2], vv2[i2],
vv2[i2next], vv2[i2next],
vv1[i1next], vv1[i1next],
NULL, 1); NULL, 1);
if (!f || f->len != 4) { if (!f || f->len != 4) {
fprintf(stderr, "%s: in bridge! (bmesh internal error)\n", __func__); fprintf(stderr, "%s: in bridge! (bmesh internal error)\n", __func__);
} }

View File

@@ -150,7 +150,7 @@ static void UNUSED_FUNCTION(rotsys_remove_edge)(struct BMEdge *e, struct BMVert
} }
static struct BMEdge *rotsys_nextedge(struct BMEdge *e, struct BMVert *v, static struct BMEdge *rotsys_nextedge(struct BMEdge *e, struct BMVert *v,
EdgeData *edata, VertData *UNUSED(vdata)) EdgeData *edata, VertData *UNUSED(vdata))
{ {
if (v == e->v1) if (v == e->v1)
return edata[BM_GetIndex(e)].dlink1.next; return edata[BM_GetIndex(e)].dlink1.next;
@@ -160,7 +160,7 @@ static struct BMEdge *rotsys_nextedge(struct BMEdge *e, struct BMVert *v,
} }
static BMEdge *rotsys_prevedge(BMEdge *e, BMVert *v, static BMEdge *rotsys_prevedge(BMEdge *e, BMVert *v,
EdgeData *edata, VertData *UNUSED(vdata)) EdgeData *edata, VertData *UNUSED(vdata))
{ {
if (v == e->v1) if (v == e->v1)
return edata[BM_GetIndex(e)].dlink1.prev; return edata[BM_GetIndex(e)].dlink1.prev;
@@ -727,7 +727,7 @@ static void edge_free_path(PathBase *pathbase, EPath *path)
} }
static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, EdgeData *edata, static EPath *edge_find_shortest_path(BMesh *bm, BMOperator *op, BMEdge *edge, EdgeData *edata,
VertData *vdata, PathBase *pathbase, int group) VertData *vdata, PathBase *pathbase, int group)
{ {
BMEdge *e; BMEdge *e;
GHash *gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "createops find shortest path"); GHash *gh = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "createops find shortest path");

View File

@@ -140,7 +140,7 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
bm->shapenr = ob->shapenr; bm->shapenr = ob->shapenr;
for (i = 0, block = me->key->block.first; block; block = block->next, i++) { for (i = 0, block = me->key->block.first; block; block = block->next, i++) {
CustomData_add_layer_named(&bm->vdata, CD_SHAPEKEY, CustomData_add_layer_named(&bm->vdata, CD_SHAPEKEY,
CD_ASSIGN, NULL, 0, block->name); CD_ASSIGN, NULL, 0, block->name);
j = CustomData_get_layer_index_n(&bm->vdata, CD_SHAPEKEY, i); j = CustomData_get_layer_index_n(&bm->vdata, CD_SHAPEKEY, i);
bm->vdata.layers[j].uid = block->uid; bm->vdata.layers[j].uid = block->uid;
@@ -182,8 +182,8 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op)
} }
for (block = me->key->block.first, j = 0; block; block = block->next, j++) { for (block = me->key->block.first, j = 0; block; block = block->next, j++) {
float *co = CustomData_bmesh_get_n(&bm->vdata, v->head.data, float *co = CustomData_bmesh_get_n(&bm->vdata, v->head.data, CD_SHAPEKEY, j);
CD_SHAPEKEY, j);
if (co) { if (co) {
copy_v3_v3(co, ((float *)block->data) + 3 * i); copy_v3_v3(co, ((float *)block->data) + 3 * i);
} }

View File

@@ -75,8 +75,8 @@ static void remdoubles_splitface(BMFace *f, BMesh *bm, BMOperator *op)
#if 0 #if 0
int remdoubles_face_overlaps(BMesh *bm, BMVert **varr, int remdoubles_face_overlaps(BMesh *bm, BMVert **varr,
int len, BMFace *exclude, int len, BMFace *exclude,
BMFace **overlapface) BMFace **overlapface)
{ {
BMIter vertfaces; BMIter vertfaces;
BMFace *f; BMFace *f;
@@ -144,10 +144,12 @@ void bmesh_weldverts_exec(BMesh *bm, BMOperator *op)
BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) { BM_ITER(f, &iter, bm, BM_FACES_OF_MESH, NULL) {
BM_SetIndex(f, 0); /* set_dirty! */ BM_SetIndex(f, 0); /* set_dirty! */
BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) { BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) {
if (BMO_TestFlag(bm, l->v, ELE_DEL)) if (BMO_TestFlag(bm, l->v, ELE_DEL)) {
BMO_SetFlag(bm, f, FACE_MARK|ELE_DEL); BMO_SetFlag(bm, f, FACE_MARK|ELE_DEL);
if (BMO_TestFlag(bm, l->e, EDGE_COL)) }
if (BMO_TestFlag(bm, l->e, EDGE_COL)) {
BM_SetIndex(f, BM_GetIndex(f) + 1); /* set_dirty! */ BM_SetIndex(f, BM_GetIndex(f) + 1); /* set_dirty! */
}
} }
} }
bm->elem_index_dirty |= BM_FACE; bm->elem_index_dirty |= BM_FACE;
@@ -167,10 +169,12 @@ void bmesh_weldverts_exec(BMesh *bm, BMOperator *op)
BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) { BM_ITER(l, &liter, bm, BM_LOOPS_OF_FACE, f) {
v = l->v; v = l->v;
v2 = ((BMLoop *)l->next)->v; v2 = ((BMLoop *)l->next)->v;
if (BMO_TestFlag(bm, v, ELE_DEL)) if (BMO_TestFlag(bm, v, ELE_DEL)) {
v = BMO_Get_MapPointer(bm, op, "targetmap", v); v = BMO_Get_MapPointer(bm, op, "targetmap", v);
if (BMO_TestFlag(bm, v2, ELE_DEL)) }
if (BMO_TestFlag(bm, v2, ELE_DEL)) {
v2 = BMO_Get_MapPointer(bm, op, "targetmap", v2); v2 = BMO_Get_MapPointer(bm, op, "targetmap", v2);
}
e2 = v != v2 ? BM_Edge_Exist(v, v2) : NULL; e2 = v != v2 ? BM_Edge_Exist(v, v2) : NULL;
if (e2) { if (e2) {
@@ -198,10 +202,12 @@ void bmesh_weldverts_exec(BMesh *bm, BMOperator *op)
v = loops[0]->v; v = loops[0]->v;
v2 = loops[1]->v; v2 = loops[1]->v;
if (BMO_TestFlag(bm, v, ELE_DEL)) if (BMO_TestFlag(bm, v, ELE_DEL)) {
v = BMO_Get_MapPointer(bm, op, "targetmap", v); v = BMO_Get_MapPointer(bm, op, "targetmap", v);
if (BMO_TestFlag(bm, v2, ELE_DEL)) }
if (BMO_TestFlag(bm, v2, ELE_DEL)) {
v2 = BMO_Get_MapPointer(bm, op, "targetmap", v2); v2 = BMO_Get_MapPointer(bm, op, "targetmap", v2);
}
f2 = BM_Make_Ngon(bm, v, v2, edges, a, 1); f2 = BM_Make_Ngon(bm, v, v2, edges, a, 1);
if (f2 && (f2 != f)) { if (f2 && (f2 != f)) {
@@ -282,8 +288,9 @@ void bmesh_pointmerge_facedata_exec(BMesh *bm, BMOperator *op)
BMO_ITER(v, &siter, bm, op, "verts", BM_VERT) { BMO_ITER(v, &siter, bm, op, "verts", BM_VERT) {
BM_ITER(l, &iter, bm, BM_LOOPS_OF_VERT, v) { BM_ITER(l, &iter, bm, BM_LOOPS_OF_VERT, v) {
if (l == firstl) if (l == firstl) {
continue; continue;
}
CustomData_bmesh_copy_data(&bm->ldata, &bm->ldata, firstl->head.data, &l->head.data); CustomData_bmesh_copy_data(&bm->ldata, &bm->ldata, firstl->head.data, &l->head.data);
} }

View File

@@ -288,8 +288,7 @@ static BMVert *subdivideedgenum(BMesh *bm, BMEdge *edge, BMEdge *oedge,
float percent, percent2 = 0.0f; float percent, percent2 = 0.0f;
if (BMO_TestFlag(bm, edge, EDGE_PERCENT) && totpoint == 1) if (BMO_TestFlag(bm, edge, EDGE_PERCENT) && totpoint == 1)
percent = BMO_Get_MapFloat(bm, params->op, percent = BMO_Get_MapFloat(bm, params->op, "edgepercents", edge);
"edgepercents", edge);
else { else {
percent = 1.0f / (float)(totpoint + 1-curpoint); percent = 1.0f / (float)(totpoint + 1-curpoint);
percent2 = (float)(curpoint + 1) / (float)(totpoint + 1); percent2 = (float)(curpoint + 1) / (float)(totpoint + 1);
@@ -312,8 +311,7 @@ static void bm_subdivide_multicut(BMesh *bm, BMEdge *edge, const subdparams *par
temp.v2 = &ov2; temp.v2 = &ov2;
for (i = 0; i < numcuts; i++) { for (i = 0; i < numcuts; i++) {
v = subdivideedgenum(bm, eed, &temp, i, params->numcuts, params, v = subdivideedgenum(bm, eed, &temp, i, params->numcuts, params, &newe, vsta, vend);
&newe, vsta, vend);
BMO_SetFlag(bm, v, SUBD_SPLIT); BMO_SetFlag(bm, v, SUBD_SPLIT);
BMO_SetFlag(bm, eed, SUBD_SPLIT); BMO_SetFlag(bm, eed, SUBD_SPLIT);
@@ -1037,7 +1035,9 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op)
j = a = 0; j = a = 0;
for (nl = BMIter_New(&liter, bmesh, BM_LOOPS_OF_FACE, face); for (nl = BMIter_New(&liter, bmesh, BM_LOOPS_OF_FACE, face);
nl; nl = BMIter_Step(&liter)) { nl;
nl = BMIter_Step(&liter))
{
if (nl->v == facedata[i].start) { if (nl->v == facedata[i].start) {
a = j + 1; a = j + 1;
break; break;
@@ -1085,9 +1085,9 @@ void esubdivide_exec(BMesh *bmesh, BMOperator *op)
/* editmesh-emulating functio */ /* editmesh-emulating functio */
void BM_esubdivideflag(Object *UNUSED(obedit), BMesh *bm, int flag, float smooth, void BM_esubdivideflag(Object *UNUSED(obedit), BMesh *bm, int flag, float smooth,
float fractal, int beauty, int numcuts, float fractal, int beauty, int numcuts,
int seltype, int cornertype, int singleedge, int seltype, int cornertype, int singleedge,
int gridfill, int seed) int gridfill, int seed)
{ {
BMOperator op; BMOperator op;

View File

@@ -66,11 +66,9 @@ void triangulate_exec(BMesh *bm, BMOperator *op)
} }
} }
BM_Triangulate_Face(bm, face, projectverts, EDGE_NEW, BM_Triangulate_Face(bm, face, projectverts, EDGE_NEW, FACE_NEW, newfaces);
FACE_NEW, newfaces);
BMO_Insert_MapPointer(bm, op, "facemap", BMO_Insert_MapPointer(bm, op, "facemap", face, face);
face, face);
for (i = 0; newfaces[i]; i++) { for (i = 0; newfaces[i]; i++) {
BMO_Insert_MapPointer(bm, op, "facemap", BMO_Insert_MapPointer(bm, op, "facemap",
newfaces[i], face); newfaces[i], face);

View File

@@ -1256,8 +1256,9 @@ void bmesh_vertexshortestpath_exec(BMesh *bm, BMOperator *op)
h = BLI_heap_new(); h = BLI_heap_new();
for (i = 0; i < num_total; i++ ) for (i = 0; i < num_total; i++) {
vert_list[i].hn = BLI_heap_insert(h, vert_list[i].weight, vert_list[i].v); vert_list[i].hn = BLI_heap_insert(h, vert_list[i].weight, vert_list[i].v);
}
while (!BLI_heap_empty(h)) { while (!BLI_heap_empty(h)) {
BMEdge *e; BMEdge *e;
@@ -1280,7 +1281,7 @@ void bmesh_vertexshortestpath_exec(BMesh *bm, BMOperator *op)
e_weight += len_v3v3(e->v1->co, e->v2->co); e_weight += len_v3v3(e->v1->co, e->v2->co);
else e_weight += 1.0f; else e_weight += 1.0f;
u = ( e->v1 == v ) ? e->v2 : e->v1; u = (e->v1 == v) ? e->v2 : e->v1;
if (e_weight < vert_list[BM_GetIndex(u)].weight) { /* is this path shorter ? */ if (e_weight < vert_list[BM_GetIndex(u)].weight) { /* is this path shorter ? */
/* add it if so */ /* add it if so */

View File

@@ -737,7 +737,7 @@ static void BME_bevel_add_vweight(BME_TransData_Head *td, BMesh *bm, BMVert *v,
if (BMO_TestFlag(bm, v, BME_BEVEL_NONMAN)) return; if (BMO_TestFlag(bm, v, BME_BEVEL_NONMAN)) return;
BMO_SetFlag(bm, v, BME_BEVEL_BEVEL); BMO_SetFlag(bm, v, BME_BEVEL_BEVEL);
if ( (vtd = BME_get_transdata(td, v)) ) { if ((vtd = BME_get_transdata(td, v))) {
if (options & BME_BEVEL_EMIN) { if (options & BME_BEVEL_EMIN) {
vtd->factor = 1.0; vtd->factor = 1.0;
if (vtd->weight < 0 || weight < vtd->weight) { if (vtd->weight < 0 || weight < vtd->weight) {