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:
authorAlexander Gavrilov <angavrilov@gmail.com>2018-10-05 20:00:32 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2018-10-05 20:19:58 +0300
commit25bd9feadb36053bdef938b52f77caf0a34016ad (patch)
tree02bcc662aa524ad8c544dab14f18329d0ff61727 /source/blender/blenkernel/intern/armature.c
parent6723e173a52769602846ed485f6f3341077eaa02 (diff)
Add a new B-Bone Custom Handle type that uses the handle bone direction.
Both original handle types are based on location, and Absolute uses it in a weird way: the Start handle uses the head, while End uses the tail. This makes controlling the shape of the B-Bone via control bone rotation really non-intuitive, especially if trying to add a single control for the tangent in the middle of a B-Bone chain. To remedy this, add a new custom handle type that uses the orientation of the control bone, while completely ignoring location. It is even possible to control both ends of one B-Bone with the same handle bone, resulting in an S shape. Reviewers: brecht Differential Revision: https://developer.blender.org/D3769
Diffstat (limited to 'source/blender/blenkernel/intern/armature.c')
-rw-r--r--source/blender/blenkernel/intern/armature.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 91661f0a4e3..198cc526865 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -468,6 +468,7 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB
Bone *bone = pchan->bone;
BBoneSplineParameters param;
float imat[4][4], posemat[4][4];
+ float delta[3];
memset(&param, 0, sizeof(param));
@@ -518,11 +519,21 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB
done = true;
}
else {
- float delta[3];
sub_v3_v3v3(delta, prev->pose_head, prev->bone->arm_head);
sub_v3_v3v3(h1, pchan->pose_head, delta);
}
}
+ else if (bone->bbone_prev_type == BBONE_HANDLE_TANGENT) {
+ /* Use bone direction by offsetting so that its tail meets current bone's head */
+ if (rest) {
+ sub_v3_v3v3(delta, prev->bone->arm_tail, prev->bone->arm_head);
+ sub_v3_v3v3(h1, bone->arm_head, delta);
+ }
+ else {
+ sub_v3_v3v3(delta, prev->pose_tail, prev->pose_head);
+ sub_v3_v3v3(h1, pchan->pose_head, delta);
+ }
+ }
else {
/* Apply special handling for smoothly joining B-Bone chains */
param.prev_bbone = (prev->bone->segments > 1);
@@ -556,11 +567,21 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB
done = true;
}
else {
- float delta[3];
sub_v3_v3v3(delta, next->pose_head, next->bone->arm_head);
add_v3_v3v3(h2, pchan->pose_tail, delta);
}
}
+ else if (bone->bbone_next_type == BBONE_HANDLE_TANGENT) {
+ /* Use bone direction by offsetting so that its head meets current bone's tail */
+ if (rest) {
+ sub_v3_v3v3(delta, next->bone->arm_tail, next->bone->arm_head);
+ add_v3_v3v3(h2, bone->arm_tail, delta);
+ }
+ else {
+ sub_v3_v3v3(delta, next->pose_tail, next->pose_head);
+ add_v3_v3v3(h2, pchan->pose_tail, delta);
+ }
+ }
else {
/* Apply special handling for smoothly joining B-Bone chains */
param.next_bbone = (next->bone->segments > 1);