[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [33637] trunk/blender/source/blender/ editors/armature/editarmature.c: Bugfix #25178

Campbell Barton ideasman42 at gmail.com
Tue Dec 14 04:24:43 CET 2010


This should be kept consistent, at the moment subdivide, extrude don't do this.

On Mon, Dec 13, 2010 at 1:50 PM, Ton Roosendaal <ton at blender.org> wrote:
> Revision: 33637
>          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=33637
> Author:   ton
> Date:     2010-12-13 14:50:20 +0100 (Mon, 13 Dec 2010)
>
> Log Message:
> -----------
> Bugfix #25178
>
> Armature edit mode: x-mirror: "switch bone direction" now flips the
> mirror bone too. It leaves the mirrored bones selected too, so
> you get good visual feedback things happened there.
>
> Modified Paths:
> --------------
>    trunk/blender/source/blender/editors/armature/editarmature.c
>
> Modified: trunk/blender/source/blender/editors/armature/editarmature.c
> ===================================================================
> --- trunk/blender/source/blender/editors/armature/editarmature.c        2010-12-13 11:39:11 UTC (rev 33636)
> +++ trunk/blender/source/blender/editors/armature/editarmature.c        2010-12-13 13:50:20 UTC (rev 33637)
> @@ -152,7 +152,48 @@
>        bone_free(arm, exBone);
>  }
>
> +/* context: editmode armature */
> +EditBone *ED_armature_bone_get_mirrored(ListBase *edbo, EditBone *ebo)
> +{
> +       EditBone *eboflip= NULL;
> +       char name[32];
> +
> +       if (ebo == NULL)
> +               return NULL;
> +
> +       flip_side_name(name, ebo->name, FALSE);
> +
> +       for (eboflip= edbo->first; eboflip; eboflip=eboflip->next) {
> +               if (ebo != eboflip) {
> +                       if (!strcmp (name, eboflip->name))
> +                               break;
> +               }
> +       }
> +
> +       return eboflip;
> +}
>
> +/* helper function for tools to work on mirrored parts.
> +   it leaves mirrored bones selected then too, which is a good indication of what happened */
> +static void armature_select_mirrored(bArmature *arm)
> +{
> +       /* Select mirrored bones */
> +       if (arm->flag & ARM_MIRROR_EDIT) {
> +               EditBone *curBone, *ebone_mirr;
> +
> +               for (curBone=arm->edbo->first; curBone; curBone=curBone->next) {
> +                       if (arm->layer & curBone->layer) {
> +                               if (curBone->flag & BONE_SELECTED) {
> +                                       ebone_mirr= ED_armature_bone_get_mirrored(arm->edbo, curBone);
> +                                       if (ebone_mirr)
> +                                               ebone_mirr->flag |= BONE_SELECTED;
> +                               }
> +                       }
> +               }
> +       }
> +
> +}
> +
>  /* converts Bones to EditBone list, used for tools as well */
>  EditBone *make_boneList(ListBase *edbo, ListBase *bones, EditBone *parent, Bone *actBone)
>  {
> @@ -1749,28 +1790,6 @@
>        return NULL;
>  }
>
> -/* context: editmode armature */
> -EditBone *ED_armature_bone_get_mirrored(ListBase *edbo, EditBone *ebo)
> -{
> -       EditBone *eboflip= NULL;
> -       char name[32];
> -
> -       if (ebo == NULL)
> -               return NULL;
> -
> -       flip_side_name(name, ebo->name, FALSE);
> -
> -       for (eboflip= edbo->first; eboflip; eboflip=eboflip->next) {
> -               if (ebo != eboflip) {
> -                       if (!strcmp (name, eboflip->name))
> -                               break;
> -               }
> -       }
> -
> -       return eboflip;
> -}
> -
> -
>  /* previously delete_armature */
>  /* only editmode! */
>  static int armature_delete_selected_exec(bContext *C, wmOperator *UNUSED(op))
> @@ -1785,18 +1804,7 @@
>        if (CTX_DATA_COUNT(C, selected_bones) == 0)
>                return OPERATOR_CANCELLED;
>
> -       /* Select mirrored bones */
> -       if (arm->flag & ARM_MIRROR_EDIT) {
> -               for (curBone=arm->edbo->first; curBone; curBone=curBone->next) {
> -                       if (arm->layer & curBone->layer) {
> -                               if (curBone->flag & BONE_SELECTED) {
> -                                       ebone_next= ED_armature_bone_get_mirrored(arm->edbo, curBone);
> -                                       if (ebone_next)
> -                                               ebone_next->flag |= BONE_SELECTED;
> -                               }
> -                       }
> -               }
> -       }
> +       armature_select_mirrored(arm);
>
>        /*  First erase any associated pose channel */
>        if (obedit->pose) {
> @@ -3722,6 +3730,9 @@
>        chains_find_tips(arm->edbo, &chains);
>        if (chains.first == NULL) return OPERATOR_CANCELLED;
>
> +       /* leaves mirrored bones selected, as indication of operation */
> +       armature_select_mirrored(arm);
> +
>        /* loop over chains, only considering selected and visible bones */
>        for (chain= chains.first; chain; chain= chain->next) {
>                EditBone *ebo, *child=NULL, *parent=NULL;
>
>
> _______________________________________________
> 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