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.
This commit is contained in:
Martin Poirier
2008-05-25 21:05:13 +00:00
parent b306aaccb9
commit 7f6fc12d8c

View File

@@ -4097,16 +4097,34 @@ void transform_armature_mirror_update(void)
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;