diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-07-29 15:45:27 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-07-29 15:47:23 +0300 |
commit | 899947c89eaec5c87d079e2f4835501c9b8df014 (patch) | |
tree | 7c1a30e6ac169a60e32642789d2ef3e920bbe2ce /source/blender/editors/transform/transform_conversions.c | |
parent | 992257cfa0622dc71ecf03dc767e8bc24b75ad8f (diff) |
Fix T48679: Bone transform only alters between translation and rotation
There was some smart code in the transform which would alter between translation
and rotation based on whether bone is connected or not and whether translation is
locked or not.
It could be handy to also fallback to scale if both rotation and translation are
locked.
Diffstat (limited to 'source/blender/editors/transform/transform_conversions.c')
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index b7456facbdf..1376b6bf4da 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -701,7 +701,6 @@ int count_set_pose_transflags(int *out_mode, short around, Object *ob) bPoseChannel *pchan; Bone *bone; int mode = *out_mode; - int hastranslation = 0; int total = 0; for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { @@ -729,7 +728,7 @@ int count_set_pose_transflags(int *out_mode, short around, Object *ob) } } /* now count, and check if we have autoIK or have to switch from translate to rotate */ - hastranslation = 0; + bool has_translation = false, has_rotation = false; for (pchan = ob->pose->chanbase.first; pchan; pchan = pchan->next) { bone = pchan->bone; @@ -740,20 +739,29 @@ int count_set_pose_transflags(int *out_mode, short around, Object *ob) if (has_targetless_ik(pchan) == NULL) { if (pchan->parent && (pchan->bone->flag & BONE_CONNECTED)) { if (pchan->bone->flag & BONE_HINGE_CHILD_TRANSFORM) - hastranslation = 1; + has_translation = true; } - else if ((pchan->protectflag & OB_LOCK_LOC) != OB_LOCK_LOC) - hastranslation = 1; + else { + if ((pchan->protectflag & OB_LOCK_LOC) != OB_LOCK_LOC) + has_translation = true; + } + if ((pchan->protectflag & OB_LOCK_ROT) != OB_LOCK_ROT) + has_rotation = true; } else - hastranslation = 1; + has_translation = true; } } } /* if there are no translatable bones, do rotation */ - if (mode == TFM_TRANSLATION && !hastranslation) { - *out_mode = TFM_ROTATION; + if (mode == TFM_TRANSLATION && !has_translation) { + if (has_rotation) { + *out_mode = TFM_ROTATION; + } + else { + *out_mode = TFM_RESIZE; + } } return total; |