Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2014-10-22 13:11:52 +0400
committerLukas Tönne <lukas.toenne@gmail.com>2014-10-22 13:11:52 +0400
commit769c0bee9fafec1ffce05af4e0d1f443dfb95ed7 (patch)
tree20dfc535347270425c7eb2871ff522281a85a7aa
parent33f388d7bf973fb95c0e48625267e2e85036d462 (diff)
Fix T42334: x-mirror fails in armature with a partially mirrored chain.
When resetting edit bones on cancel, they also have to reset connected parent and child bone tips and heads respectively, since these can be modified during the transform.
-rw-r--r--source/blender/editors/transform/transform_conversions.c21
-rw-r--r--source/blender/editors/transform/transform_generics.c15
2 files changed, 27 insertions, 9 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 3b92e018d49..6d6a1eace73 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -1056,11 +1056,13 @@ static void createTransPose(TransInfo *t, Object *ob)
void restoreBones(TransInfo *t)
{
+ bArmature *arm = t->obedit->data;
BoneInitData *bid = t->customData;
- EditBone *ebo;
+ EditBone *ebo, *children;
while (bid->bone) {
ebo = bid->bone;
+
ebo->dist = bid->dist;
ebo->rad_tail = bid->rad_tail;
ebo->roll = bid->roll;
@@ -1068,7 +1070,22 @@ void restoreBones(TransInfo *t)
ebo->zwidth = bid->zwidth;
copy_v3_v3(ebo->head, bid->head);
copy_v3_v3(ebo->tail, bid->tail);
-
+
+ /* Also move connected children, in case children's name aren't mirrored properly */
+ for (children = arm->edbo->first; children; children = children->next) {
+ if (children->parent == ebo && children->flag & BONE_CONNECTED) {
+ copy_v3_v3(children->head, ebo->tail);
+ children->rad_head = ebo->rad_tail;
+ }
+ }
+
+ /* Also move connected parent, in case parent's name isn't mirrored properly */
+ if (ebo->parent && ebo->flag & BONE_CONNECTED) {
+ EditBone *parent = ebo->parent;
+ copy_v3_v3(parent->tail, ebo->head);
+ parent->rad_tail = ebo->rad_head;
+ }
+
bid++;
}
}
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index b02671e18d8..2f035949edc 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -779,7 +779,7 @@ static void recalcData_objects(TransInfo *t)
else if (t->obedit->type == OB_ARMATURE) { /* no recalc flag, does pose */
bArmature *arm = t->obedit->data;
ListBase *edbo = arm->edbo;
- EditBone *ebo;
+ EditBone *ebo, *ebo_parent;
TransData *td = t->data;
int i;
@@ -789,17 +789,18 @@ static void recalcData_objects(TransInfo *t)
/* Ensure all bones are correctly adjusted */
for (ebo = edbo->first; ebo; ebo = ebo->next) {
+ ebo_parent = (ebo->flag & BONE_CONNECTED) ? ebo->parent : NULL;
- if ((ebo->flag & BONE_CONNECTED) && ebo->parent) {
+ if (ebo_parent) {
/* If this bone has a parent tip that has been moved */
- if (ebo->parent->flag & BONE_TIPSEL) {
- copy_v3_v3(ebo->head, ebo->parent->tail);
- if (t->mode == TFM_BONE_ENVELOPE) ebo->rad_head = ebo->parent->rad_tail;
+ if (ebo_parent->flag & BONE_TIPSEL) {
+ copy_v3_v3(ebo->head, ebo_parent->tail);
+ if (t->mode == TFM_BONE_ENVELOPE) ebo->rad_head = ebo_parent->rad_tail;
}
/* If this bone has a parent tip that has NOT been moved */
else {
- copy_v3_v3(ebo->parent->tail, ebo->head);
- if (t->mode == TFM_BONE_ENVELOPE) ebo->parent->rad_tail = ebo->rad_head;
+ copy_v3_v3(ebo_parent->tail, ebo->head);
+ if (t->mode == TFM_BONE_ENVELOPE) ebo_parent->rad_tail = ebo->rad_head;
}
}