[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45305] trunk/blender/source/blender/bmesh /operators/bmo_dupe.c: Minor code cleanups for bmo_dupe.c.

Campbell Barton ideasman42 at gmail.com
Sun Apr 1 08:59:32 CEST 2012


noticed this commit changes the style of multi-line if statement.

See the diff, lines under:   /* duplicate flagged vertices */

I much prefer the way it was, when the '{' doesnt get its own line,
the checks in the IF statement get aligned with the code after the if
statement (within the braces), and its harder to read the flow IMHO.


See: http://wiki.blender.org/index.php/Dev:Doc/CodeStyle#Indentation

Also notice this commit wraps lines that are well <120 wide, which isnt needed.

Other changes look fine.

On Sat, Mar 31, 2012 at 11:29 PM, Nicholas Bishop
<nicholasbishop at gmail.com> wrote:
> Revision: 45305
>          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45305
> Author:   nicholasbishop
> Date:     2012-03-31 12:29:17 +0000 (Sat, 31 Mar 2012)
> Log Message:
> -----------
> Minor code cleanups for bmo_dupe.c.
>
> Modified Paths:
> --------------
>    trunk/blender/source/blender/bmesh/operators/bmo_dupe.c
>
> Modified: trunk/blender/source/blender/bmesh/operators/bmo_dupe.c
> ===================================================================
> --- trunk/blender/source/blender/bmesh/operators/bmo_dupe.c     2012-03-31 10:17:05 UTC (rev 45304)
> +++ trunk/blender/source/blender/bmesh/operators/bmo_dupe.c     2012-03-31 12:29:17 UTC (rev 45305)
> @@ -191,22 +191,19 @@
>        BMVert **vtar = NULL;
>        BMEdge **edar = NULL;
>
> -       BMIter verts;
> -       BMIter edges;
> -       BMIter faces;
> -
> -       GHash *vhash;
> -       GHash *ehash;
> +       BMIter viter, eiter, fiter;
> +       GHash *vhash, *ehash;
>
>        /* initialize pointer hashes */
> -       vhash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh dupeops v");
> -       ehash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, "bmesh dupeops e");
> +       vhash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp,
> +                                                 "bmesh dupeops v");
> +       ehash = BLI_ghash_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp,
> +                                                 "bmesh dupeops e");
>
>        /* duplicate flagged vertices */
> -       for (v = BM_iter_new(&verts, source, BM_VERTS_OF_MESH, source); v; v = BM_iter_step(&verts)) {
> -               if ( BMO_elem_flag_test(source, v, DUPE_INPUT) &&
> -                   !BMO_elem_flag_test(source, v, DUPE_DONE))
> -               {
> +       BM_ITER(v, &viter, source, BM_VERTS_OF_MESH, source) {
> +               if (BMO_elem_flag_test(source, v, DUPE_INPUT) &&
> +                       !BMO_elem_flag_test(source, v, DUPE_DONE)) {
>                        BMIter iter;
>                        int isolated = 1;
>
> @@ -237,10 +234,9 @@
>        }
>
>        /* now we dupe all the edges */
> -       for (e = BM_iter_new(&edges, source, BM_EDGES_OF_MESH, source); e; e = BM_iter_step(&edges)) {
> -               if ( BMO_elem_flag_test(source, e, DUPE_INPUT) &&
> -                   !BMO_elem_flag_test(source, e, DUPE_DONE))
> -               {
> +       BM_ITER(e, &eiter, source, BM_EDGES_OF_MESH, source) {
> +               if (BMO_elem_flag_test(source, e, DUPE_INPUT) &&
> +                       !BMO_elem_flag_test(source, e, DUPE_DONE)) {
>                        /* make sure that verts are copied */
>                        if (!BMO_elem_flag_test(source, e->v1, DUPE_DONE)) {
>                                copy_vertex(source, e->v1, target, vhash);
> @@ -257,10 +253,10 @@
>        }
>
>        /* first we dupe all flagged faces and their elements from source */
> -       for (f = BM_iter_new(&faces, source, BM_FACES_OF_MESH, source); f; f = BM_iter_step(&faces)) {
> +       BM_ITER(f, &fiter, source, BM_FACES_OF_MESH, source) {
>                if (BMO_elem_flag_test(source, f, DUPE_INPUT)) {
>                        /* vertex pass */
> -                       for (v = BM_iter_new(&verts, source, BM_VERTS_OF_FACE, f); v; v = BM_iter_step(&verts)) {
> +                       BM_ITER(v, &viter, source, BM_VERTS_OF_FACE, f) {
>                                if (!BMO_elem_flag_test(source, v, DUPE_DONE)) {
>                                        copy_vertex(source, v, target, vhash);
>                                        BMO_elem_flag_enable(source, v, DUPE_DONE);
> @@ -268,7 +264,7 @@
>                        }
>
>                        /* edge pass */
> -                       for (e = BM_iter_new(&edges, source, BM_EDGES_OF_FACE, f); e; e = BM_iter_step(&edges)) {
> +                       BM_ITER(e, &eiter, source, BM_EDGES_OF_FACE, f) {
>                                if (!BMO_elem_flag_test(source, e, DUPE_DONE)) {
>                                        copy_edge(op, source, e, target,  vhash,  ehash);
>                                        BMO_elem_flag_enable(source, e, DUPE_DONE);
> @@ -325,7 +321,7 @@
>        if (!bm2)
>                bm2 = bm;
>
> -       /* flag inpu */
> +       /* flag input */
>        BMO_slot_buffer_flag_enable(bm, dupeop, "geom", BM_ALL, DUPE_INPUT);
>
>        /* use the internal copy function */
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs



-- 
- Campbell


More information about the Bf-committers mailing list