[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45503] trunk/blender/source/blender/bmesh /intern/bmesh_core.c: Fix related to #30859: bmesh face splitting would set the first loop of the new

Brecht Van Lommel brechtvanlommel at pandora.be
Tue Apr 10 13:41:59 CEST 2012


Oops, accidentally committed this as Joe from a Blender Institute
computer, was actually my commit, so blame any breakage on me. :)

Brecht.

On Tue, Apr 10, 2012 at 1:07 PM, Joseph Eagar <joeedh at gmail.com> wrote:
> Revision: 45503
>          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45503
> Author:   joeedh
> Date:     2012-04-10 11:07:02 +0000 (Tue, 10 Apr 2012)
> Log Message:
> -----------
> Fix related to #30859: bmesh face splitting would set the first loop of the new
> faces to a loop quite different than the original first loop. This makes e.g.
> duplifaces give rotated results after subdivide or loopcut.
>
> Now it tries to find a first loop that is similar to the old one, to try to keep
> the rotations the same.
>
> Modified Paths:
> --------------
>    trunk/blender/source/blender/bmesh/intern/bmesh_core.c
>
> Modified: trunk/blender/source/blender/bmesh/intern/bmesh_core.c
> ===================================================================
> --- trunk/blender/source/blender/bmesh/intern/bmesh_core.c      2012-04-10 10:35:55 UTC (rev 45502)
> +++ trunk/blender/source/blender/bmesh/intern/bmesh_core.c      2012-04-10 11:07:02 UTC (rev 45503)
> @@ -1133,7 +1133,7 @@
>        BMLoop *l_iter, *l_first;
>        BMLoop *v1loop = NULL, *v2loop = NULL, *f1loop = NULL, *f2loop = NULL;
>        BMEdge *e;
> -       int i, len, f1len, f2len;
> +       int i, len, f1len, f2len, first_loop_f1;
>
>        /* verify that v1 and v2 are in face */
>        len = f->len;
> @@ -1170,8 +1170,36 @@
>        lst2->first = lst2->last = f2loop;
>        lst->first = lst->last = f1loop;
>  #else
> -       f2->l_first = f2loop;
> -       f->l_first = f1loop;
> +       /* find which of the faces the original first loop is in */
> +       l_iter = l_first = f1loop;
> +       first_loop_f1 = 0;
> +       do {
> +               if(l_iter == f->l_first)
> +                       first_loop_f1 = 1;
> +       } while ((l_iter = l_iter->next) != l_first);
> +
> +       if(first_loop_f1) {
> +               /* original first loop was in f1, find a suitable first loop for f2
> +                  which is as similar as possible to f1. the order matters for tools
> +                  such as duplifaces. */
> +               if(f->l_first->prev == f1loop)
> +                       f2->l_first = f2loop->prev;
> +               else if(f->l_first->next == f1loop)
> +                       f2->l_first = f2loop->next;
> +               else
> +                       f2->l_first = f2loop;
> +       }
> +       else {
> +               /* original first loop was in f2, further do same as above */
> +               f2->l_first = f->l_first;
> +
> +               if(f->l_first->prev == f2loop)
> +                       f->l_first = f1loop->prev;
> +               else if(f->l_first->next == f2loop)
> +                       f->l_first = f1loop->next;
> +               else
> +                       f->l_first = f1loop;
> +       }
>  #endif
>
>        /* validate both loop */
>
> _______________________________________________
> Bf-blender-cvs mailing list
> Bf-blender-cvs at blender.org
> http://lists.blender.org/mailman/listinfo/bf-blender-cvs



More information about the Bf-blender-cvs mailing list