Revision: 14971
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14971
Author:   theeth
Date:     2008-05-25 23:05:13 +0200 (Sun, 25 May 2008)

Log Message:
-----------
Bug fix in X-Mirror for armatures

When a bone in a mirrored chain wasn't named properly, it would leave the head 
or tail in an invalid state.

Now it applies the mirror to connected joints that are mirrored.

Modified Paths:
--------------
    trunk/blender/source/blender/src/editarmature.c

Modified: trunk/blender/source/blender/src/editarmature.c
===================================================================
--- trunk/blender/source/blender/src/editarmature.c     2008-05-25 19:24:46 UTC 
(rev 14970)
+++ trunk/blender/source/blender/src/editarmature.c     2008-05-25 21:05:13 UTC 
(rev 14971)
@@ -4097,16 +4097,34 @@
                        if (eboflip) {
                                /* we assume X-axis flipping for now */
                                if (ebo->flag & BONE_TIPSEL) {
+                                       EditBone *children;
+                                       
                                        eboflip->tail[0]= -ebo->tail[0];
                                        eboflip->tail[1]= ebo->tail[1];
                                        eboflip->tail[2]= ebo->tail[2];
                                        eboflip->rad_tail= ebo->rad_tail;
+
+                                       /* Also move connected children, in 
case children's name aren't mirrored properly */
+                                       for (children=G.edbo.first; children; 
children=children->next) {
+                                               if (children->parent == eboflip 
&& children->flag & BONE_CONNECTED) {
+                                                       VECCOPY(children->head, 
eboflip->tail);
+                                                       children->rad_head = 
ebo->rad_tail;
+                                               }
+                                       }
                                }
                                if (ebo->flag & BONE_ROOTSEL) {
                                        eboflip->head[0]= -ebo->head[0];
                                        eboflip->head[1]= ebo->head[1];
                                        eboflip->head[2]= ebo->head[2];
                                        eboflip->rad_head= ebo->rad_head;
+                                       
+                                       /* Also move connected parent, in case 
parent's name isn't mirrored properly */
+                                       if (eboflip->parent && eboflip->flag & 
BONE_CONNECTED)
+                                       {
+                                               EditBone *parent = 
eboflip->parent;
+                                               VECCOPY(parent->tail, 
eboflip->head);
+                                               parent->rad_tail = 
ebo->rad_head;
+                                       }
                                }
                                if (ebo->flag & BONE_SELECTED) {
                                        eboflip->dist= ebo->dist;


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to