diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-02-27 02:38:49 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-02-27 02:38:49 +0400 |
commit | 3ba37b65a32541ac594183d45c0939ee95bb098d (patch) | |
tree | 7e9015c177d0e0d679c1dca3ad35c2ed230c6d37 /source/blender/bmesh | |
parent | 5df6869b379401874fb2cae0c1e33a58aaab8786 (diff) |
style cleanup
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r-- | source/blender/bmesh/bmesh.h | 10 | ||||
-rw-r--r-- | source/blender/bmesh/bmesh_iterators.h | 4 | ||||
-rw-r--r-- | source/blender/bmesh/bmesh_walkers.h | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_interp.c | 10 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mods.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_operator_api_inline.c | 14 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_operators.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_polygon.c | 7 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_queries.c | 10 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_create.c | 14 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_edgesplit.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_mesh_conv.c | 8 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_primitive.c | 12 | ||||
-rw-r--r-- | source/blender/bmesh/operators/bmo_subdivide.c | 2 | ||||
-rw-r--r-- | source/blender/bmesh/tools/BME_bevel.c | 22 |
15 files changed, 61 insertions, 60 deletions
diff --git a/source/blender/bmesh/bmesh.h b/source/blender/bmesh/bmesh.h index 168a8d913a0..bf939d3f1cb 100644 --- a/source/blender/bmesh/bmesh.h +++ b/source/blender/bmesh/bmesh.h @@ -106,12 +106,12 @@ struct EditMesh; /* we have 3 spare flags which is awesome but since we're limited to 8 * only add new flags with care! - campbell */ -/* #define BM_ELEM_SPARE (1<<5) */ -/* #define BM_ELEM_SPARE (1<<6) */ +/* #define BM_ELEM_SPARE (1 << 5) */ +/* #define BM_ELEM_SPARE (1 << 6) */ -#define BM_ELEM_INTERNAL_TAG (1<<7) /* for low level internal API tagging, - * since tools may want to tag verts and - * not have functions clobber them */ +#define BM_ELEM_INTERNAL_TAG (1 << 7) /* for low level internal API tagging, + * since tools may want to tag verts and + * not have functions clobber them */ /* Mesh Level Ops */ extern int bm_mesh_allocsize_default[4]; diff --git a/source/blender/bmesh/bmesh_iterators.h b/source/blender/bmesh/bmesh_iterators.h index ccbed3ecd01..fc914a8c87d 100644 --- a/source/blender/bmesh/bmesh_iterators.h +++ b/source/blender/bmesh/bmesh_iterators.h @@ -84,11 +84,11 @@ extern const char bm_iter_itype_htype_map[BM_ITYPE_MAX]; #define BM_ITER(ele, iter, bm, itype, data) \ ele = BM_iter_new(iter, bm, itype, data); \ - for ( ; ele; ele=BM_iter_step(iter)) + for ( ; ele; ele = BM_iter_step(iter)) #define BM_ITER_INDEX(ele, iter, bm, itype, data, indexvar) \ ele = BM_iter_new(iter, bm, itype, data); \ - for (indexvar=0; ele; indexvar++, ele=BM_iter_step(iter)) + for (indexvar = 0; ele; indexvar++, ele = BM_iter_step(iter)) /*Iterator Structure*/ typedef struct BMIter { diff --git a/source/blender/bmesh/bmesh_walkers.h b/source/blender/bmesh/bmesh_walkers.h index d926ab6d066..9dff8cd98fb 100644 --- a/source/blender/bmesh/bmesh_walkers.h +++ b/source/blender/bmesh/bmesh_walkers.h @@ -91,7 +91,7 @@ BMFace *f; BMW_init(&walker, bm, BMW_ISLAND, SOME_OP_FLAG); f = BMW_begin(&walker, some_start_face); -for (; f; f=BMW_step(&walker)) +for (; f; f = BMW_step(&walker)) { //do something with f } diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index 7d94fac2414..406da71ce4d 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -288,14 +288,14 @@ static float quad_coord(float aa[3], float bb[3], float cc[3], float dd[3], int y = aa[a1] * dd[a2] + bb[a1] * cc[a2] - cc[a1] * bb[a2] - dd[a1] * aa[a2]; z = bb[a1] * dd[a2] - dd[a1] * bb[a2]; - if (fabs(2 * (x - y + z)) > FLT_EPSILON * 10.0f) { + if (fabsf(2.0f * (x - y + z)) > FLT_EPSILON * 10.0f) { float f2; f1 = (sqrt(y * y - 4.0 * x * z) - y + 2.0 * z) / (2.0 * (x - y + z)); f2 = (-sqrt(y * y - 4.0 * x * z) - y + 2.0 * z) / (2.0 * (x - y + z)); - f1 = fabs(f1); - f2 = fabs(f2); + f1 = fabsf(f1); + f2 = fabsf(f2); f1 = MIN2(f1, f2); CLAMP(f1, 0.0f, 1.0f + FLT_EPSILON); } @@ -308,9 +308,9 @@ static float quad_coord(float aa[3], float bb[3], float cc[3], float dd[3], int for (i = 0; i < 2; i++) { if (fabsf(aa[i]) < FLT_EPSILON * 100.0f) - return aa[(i + 1) % 2] / fabs(bb[(i + 1) % 2] - aa[(i + 1) % 2]); + return aa[(i + 1) % 2] / fabsf(bb[(i + 1) % 2] - aa[(i + 1) % 2]); if (fabsf(cc[i]) < FLT_EPSILON * 100.0f) - return cc[(i + 1) % 2] / fabs(dd[(i + 1) % 2] - cc[(i + 1) % 2]); + return cc[(i + 1) % 2] / fabsf(dd[(i + 1) % 2] - cc[(i + 1) % 2]); } } } diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index 4543eaf4109..c8423afc4d9 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -782,7 +782,7 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, int ccw) return nl->e; } -BMVert *BM_vert_rip ( BMesh *bm, BMFace *sf, BMVert *sv) +BMVert *BM_vert_rip(BMesh *bm, BMFace *sf, BMVert *sv) { return bmesh_urmv(bm, sf, sv); } diff --git a/source/blender/bmesh/intern/bmesh_operator_api_inline.c b/source/blender/bmesh/intern/bmesh_operator_api_inline.c index 733dcc36458..88789fc24b0 100644 --- a/source/blender/bmesh/intern/bmesh_operator_api_inline.c +++ b/source/blender/bmesh/intern/bmesh_operator_api_inline.c @@ -40,31 +40,31 @@ * if you need to store a value per element, use a * ghash or a mapping slot to do it. */ -/* flags 15 and 16 (1<<14 and 1<<15) are reserved for bmesh api use */ +/* flags 15 and 16 (1 << 14 and 1 << 15) are reserved for bmesh api use */ BM_INLINE short _bmo_elem_flag_test(BMesh *bm, BMFlagLayer *oflags, const short oflag) { - return oflags[bm->stackdepth-1].f & oflag; + return oflags[bm->stackdepth - 1].f & oflag; } BM_INLINE void _bmo_elem_flag_enable(BMesh *bm, BMFlagLayer *oflags, const short oflag) { - oflags[bm->stackdepth-1].f |= oflag; + oflags[bm->stackdepth - 1].f |= oflag; } BM_INLINE void _bmo_elem_flag_disable(BMesh *bm, BMFlagLayer *oflags, const short oflag) { - oflags[bm->stackdepth-1].f &= ~oflag; + oflags[bm->stackdepth - 1].f &= ~oflag; } BM_INLINE void _bmo_elem_flag_set(BMesh *bm, BMFlagLayer *oflags, const short oflag, int val) { - if (val) oflags[bm->stackdepth-1].f |= oflag; - else oflags[bm->stackdepth-1].f &= ~oflag; + if (val) oflags[bm->stackdepth - 1].f |= oflag; + else oflags[bm->stackdepth - 1].f &= ~oflag; } BM_INLINE void _bmo_elem_flag_toggle(BMesh *bm, BMFlagLayer *oflags, const short oflag) { - oflags[bm->stackdepth-1].f ^= oflag; + oflags[bm->stackdepth - 1].f ^= oflag; } BM_INLINE void BMO_slot_map_int_insert(BMesh *bm, BMOperator *op, const char *slotname, diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index af291eca072..5e9f9c1a332 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -943,7 +943,7 @@ static void bmo_flag_layer_alloc(BMesh *bm) bm->totflags++; /* allocate new flag poo */ - bm->toolflagpool = newpool = BLI_mempool_create(sizeof(BMFlagLayer)*bm->totflags, 512, 512, FALSE, FALSE); + bm->toolflagpool = newpool = BLI_mempool_create(sizeof(BMFlagLayer) * bm->totflags, 512, 512, FALSE, FALSE); /* now go through and memcpy all the flags. Loops don't get a flag layer at this time.. */ for (ele = BM_iter_new(&iter, bm, BM_VERTS_OF_MESH, bm), i = 0; ele; ele = BM_iter_step(&iter), i++) { diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index c511193209e..8188413bb8c 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -740,8 +740,8 @@ static int goodline(float (*projectverts)[3], BMFace *f, int v1i, //if (linecrosses(pv1, pv2, v1, v3)) return FALSE; - if ( point_in_triangle(v1, v2, v3, pv1) || - point_in_triangle(v3, v2, v1, pv1)) + if (point_in_triangle(v1, v2, v3, pv1) || + point_in_triangle(v3, v2, v1, pv1)) { return FALSE; } @@ -784,8 +784,9 @@ static BMLoop *find_ear(BMesh *UNUSED(bm), BMFace *f, float (*verts)[3], const i if (isear) { #if 0 + /* if this code comes back, it needs to be converted to radians */ angle = angle_v3v3v3(verts[v1->head.eflag2], verts[v2->head.eflag2], verts[v3->head.eflag2]); - if (!bestear || ABS(angle-45.0f) < bestangle) { + if (!bestear || ABS(angle - 45.0f) < bestangle) { bestear = l; bestangle = ABS(45.0f - angle); } diff --git a/source/blender/bmesh/intern/bmesh_queries.c b/source/blender/bmesh/intern/bmesh_queries.c index f7543b151fc..6ea6aba821a 100644 --- a/source/blender/bmesh/intern/bmesh_queries.c +++ b/source/blender/bmesh/intern/bmesh_queries.c @@ -547,10 +547,10 @@ BMVert *BM_edge_share_vert(struct BMEdge *e1, struct BMEdge *e2) void BM_edge_ordered_verts(BMEdge *edge, BMVert **r_v1, BMVert **r_v2) { - if ( (edge->l == NULL) || - ( ((edge->l->prev->v == edge->v1) && (edge->l->v == edge->v2)) || - ((edge->l->v == edge->v1) && (edge->l->next->v == edge->v2)) ) - ) + if ((edge->l == NULL) || + (((edge->l->prev->v == edge->v1) && (edge->l->v == edge->v2)) || + ((edge->l->v == edge->v1) && (edge->l->next->v == edge->v2))) + ) { *r_v1 = edge->v1; *r_v2 = edge->v2; @@ -801,7 +801,7 @@ int BM_face_exists_multi_edge(BMesh *bm, BMEdge **earr, int len) /* first check if verts have edges, if not we can bail out early */ ok = TRUE; - for (i = len - 1, i_next = 0; i_next < len; (i=i_next++)) { + for (i = len - 1, i_next = 0; i_next < len; (i = i_next++)) { if (!(varr[i] = BM_edge_share_vert(earr[i], earr[i_next]))) { ok = FALSE; break; diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index 3da95230c76..2b9f530e77d 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -880,8 +880,8 @@ void bmesh_edgenet_fill_exec(BMesh *bm, BMOperator *op) if (!bm->totvert || !bm->totedge) return; - edata = MEM_callocN(sizeof(EdgeData)*bm->totedge, "EdgeData"); - vdata = MEM_callocN(sizeof(VertData)*bm->totvert, "VertData"); + edata = MEM_callocN(sizeof(EdgeData) * bm->totedge, "EdgeData"); + vdata = MEM_callocN(sizeof(VertData) * bm->totvert, "VertData"); BMO_slot_buffer_flag_enable(bm, op, "edges", EDGE_MARK, BM_EDGE); BMO_slot_buffer_flag_enable(bm, op, "excludefaces", FACE_IGNORE, BM_FACE); @@ -1050,9 +1050,9 @@ static BMEdge *edge_next(BMesh *bm, BMEdge *e) for (i = 0; i < 2; i++) { BM_ITER(e2, &iter, bm, BM_EDGES_OF_VERT, i ? e->v2 : e->v1) { - if ( (BMO_elem_flag_test(bm, e2, EDGE_MARK)) && - (!BMO_elem_flag_test(bm, e2, EDGE_VIS)) && - (e2 != e)) + if ((BMO_elem_flag_test(bm, e2, EDGE_MARK)) && + (!BMO_elem_flag_test(bm, e2, EDGE_VIS)) && + (e2 != e)) { return e2; } @@ -1101,8 +1101,8 @@ void bmesh_edgenet_prepare(BMesh *bm, BMOperator *op) while (1) { BMO_ITER(e, &siter, bm, op, "edges", BM_EDGE) { if (!BMO_elem_flag_test(bm, e, EDGE_VIS)) { - if ( BMO_vert_edge_flags_count(bm, e->v1, EDGE_MARK) == 1 || - BMO_vert_edge_flags_count(bm, e->v2, EDGE_MARK) == 1) + if (BMO_vert_edge_flags_count(bm, e->v1, EDGE_MARK) == 1 || + BMO_vert_edge_flags_count(bm, e->v2, EDGE_MARK) == 1) { break; } diff --git a/source/blender/bmesh/operators/bmo_edgesplit.c b/source/blender/bmesh/operators/bmo_edgesplit.c index 7d719e1ddc9..f8c41d71558 100644 --- a/source/blender/bmesh/operators/bmo_edgesplit.c +++ b/source/blender/bmesh/operators/bmo_edgesplit.c @@ -230,7 +230,7 @@ void bmesh_edgesplitop_exec(BMesh *bm, BMOperator *op) } } - etags = MEM_callocN(sizeof(EdgeTag)*bm->totedge, "EdgeTag"); + etags = MEM_callocN(sizeof(EdgeTag) * bm->totedge, "EdgeTag"); BM_mesh_elem_index_ensure(bm, BM_EDGE); diff --git a/source/blender/bmesh/operators/bmo_mesh_conv.c b/source/blender/bmesh/operators/bmo_mesh_conv.c index b5807f9ba8d..b41a6f823b0 100644 --- a/source/blender/bmesh/operators/bmo_mesh_conv.c +++ b/source/blender/bmesh/operators/bmo_mesh_conv.c @@ -134,7 +134,7 @@ void mesh_to_bmesh_exec(BMesh *bm, BMOperator *op) } } else if (actkey) { - printf("shapekey<->mesh mismatch!\n"); + printf("shapekey <-> mesh mismatch!\n"); } CustomData_bmesh_init_pool(&bm->vdata, bm_mesh_allocsize_default[0]); @@ -897,9 +897,9 @@ void bmesh_to_mesh_exec(BMesh *bm, BMOperator *op) add_v3_v3(fp, ofs[i]); } - fp+= 3; - ++i; - ++mvert; + fp += 3; + i++; + mvert++; eve = BM_iter_step(&iter); } currkey->totelem = bm->totvert; diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index 9cf17490d58..a050f04078e 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -317,7 +317,7 @@ void bmesh_create_uvsphere_exec(BMesh *bm, BMOperator *op) BMO_elem_flag_enable(bm, e, EDGE_ORIG); } - phi+= phid; + phi += phid; preveve = eve; } @@ -351,15 +351,15 @@ void bmesh_create_uvsphere_exec(BMesh *bm, BMOperator *op) { float len, len2, vec2[3]; - len= 2*dia*sinf(phid / 2.0f); + len = 2 * dia * sinf(phid / 2.0f); /* length of one segment in shortest parallen */ - vec[0]= dia*sinf(phid); - vec[1]= 0.0; - vec[2]= dia*cosf(phid); + vec[0] = dia * sinf(phid); + vec[1] = 0.0f; + vec[2] = dia * cosf(phid); mul_v3_m3v3(vec2, cmat, vec); - len2= len_v3v3(vec, vec2); + len2 = len_v3v3(vec, vec2); /* use shortest segment length divided by 3 as merge threshold */ BMO_op_callf(bm, "removedoubles verts=%fv dist=%f", VERT_MARK, MIN2(len, len2) / 3.0f); diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index a983851891c..9967764200e 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -117,7 +117,7 @@ static void alter_co(BMesh *bm, BMVert *v, BMEdge *UNUSED(origed), const subdpar copy_v3_v3(nor2, vend->no); /* cosine angle */ - fac= dot_v3v3(nor, nor1); + fac = dot_v3v3(nor, nor1); mul_v3_v3fl(tvec, nor1, fac); /* cosine angle */ diff --git a/source/blender/bmesh/tools/BME_bevel.c b/source/blender/bmesh/tools/BME_bevel.c index 758e2479dd3..da360d602e4 100644 --- a/source/blender/bmesh/tools/BME_bevel.c +++ b/source/blender/bmesh/tools/BME_bevel.c @@ -172,7 +172,7 @@ static int BME_bevel_is_split_vert(BMesh *bm, BMLoop *l) * beveling other polys; this can be determined by testing the * vert and the edges around it for originality */ - if ( !BMO_elem_flag_test(bm, l->v, BME_BEVEL_ORIG) && + if (!BMO_elem_flag_test(bm, l->v, BME_BEVEL_ORIG) && BMO_elem_flag_test(bm, l->e, BME_BEVEL_ORIG) && BMO_elem_flag_test(bm, l->prev->e, BME_BEVEL_ORIG)) { @@ -496,16 +496,16 @@ static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(opti e = l->e; /* sanity check */ - if ( !BMO_elem_flag_test(bm, l->e, BME_BEVEL_BEVEL) && - (BMO_elem_flag_test(bm, l->v, BME_BEVEL_BEVEL) || BMO_elem_flag_test(bm, l->next->v, BME_BEVEL_BEVEL))) + if (!BMO_elem_flag_test(bm, l->e, BME_BEVEL_BEVEL) && + (BMO_elem_flag_test(bm, l->v, BME_BEVEL_BEVEL) || BMO_elem_flag_test(bm, l->next->v, BME_BEVEL_BEVEL))) { return l; } /* checks and operations for prev edge */ /* first, check to see if this edge was inset previously */ - if ( !BMO_elem_flag_test(bm, l->prev->e, BME_BEVEL_ORIG) && - !BMO_elem_flag_test(bm, l->v, BME_BEVEL_NONMAN)) + if (!BMO_elem_flag_test(bm, l->prev->e, BME_BEVEL_ORIG) && + !BMO_elem_flag_test(bm, l->v, BME_BEVEL_NONMAN)) { kl = l->prev->radial_next; kl = (kl->v == l->v) ? kl->prev : kl->next; @@ -550,8 +550,8 @@ static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(opti /* checks and operations for the next edge */ /* first, check to see if this edge was inset previously */ - if ( !BMO_elem_flag_test(bm, l->next->e, BME_BEVEL_ORIG) && - !BMO_elem_flag_test(bm, l->next->v, BME_BEVEL_NONMAN)) + if (!BMO_elem_flag_test(bm, l->next->e, BME_BEVEL_ORIG) && + !BMO_elem_flag_test(bm, l->next->v, BME_BEVEL_NONMAN)) { kl = l->next->radial_next; kl = (kl->v == l->next->v) ? kl->prev : kl->next; @@ -666,9 +666,9 @@ static BMFace *BME_bevel_poly(BMesh *bm, BMFace *f, float value, int options, BM max = 1.0f; l = BME_bevel_edge(bm, l, value, options, up_vec, td); } - else if ( BMO_elem_flag_test(bm, l->v, BME_BEVEL_BEVEL) && - BMO_elem_flag_test(bm, l->v, BME_BEVEL_ORIG) && - !BMO_elem_flag_test(bm, l->prev->e, BME_BEVEL_BEVEL)) + else if (BMO_elem_flag_test(bm, l->v, BME_BEVEL_BEVEL) && + BMO_elem_flag_test(bm, l->v, BME_BEVEL_ORIG) && + !BMO_elem_flag_test(bm, l->prev->e, BME_BEVEL_BEVEL)) { max = 1.0f; l = BME_bevel_vert(bm, l, value, options, up_vec, td); @@ -1019,7 +1019,7 @@ BMesh *BME_bevel(BMEditMesh *em, float value, int res, int options, int defgrp_i /* otherwise apply transforms */ BM_ITER(v, &iter, bm, BM_VERTS_OF_MESH, NULL) { - if ( (vtd = BME_get_transdata(td, v)) ) { + if ((vtd = BME_get_transdata(td, v))) { if (vtd->max && (*vtd->max > 0 && value > *vtd->max)) { d = *vtd->max; } |