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/draw/intern/draw_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/draw/intern/draw_armature.c')
-rw-r--r--source/blender/draw/intern/draw_armature.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c
index a73bddf880f..5f8a2d00188 100644
--- a/source/blender/draw/intern/draw_armature.c
+++ b/source/blender/draw/intern/draw_armature.c
@@ -940,6 +940,7 @@ static void ebone_spline_preview(EditBone *ebone, float result_array[MAX_BBONE_S
BBoneSplineParameters param;
EditBone *prev, *next;
float imat[4][4], bonemat[4][4];
+ float tmp[3];
memset(&param, 0, sizeof(param));
@@ -979,6 +980,11 @@ static void ebone_spline_preview(EditBone *ebone, float result_array[MAX_BBONE_S
if (ebone->bbone_prev_type == BBONE_HANDLE_RELATIVE) {
zero_v3(param.prev_h);
}
+ else if (ebone->bbone_prev_type == BBONE_HANDLE_TANGENT) {
+ sub_v3_v3v3(tmp, prev->tail, prev->head);
+ sub_v3_v3v3(tmp, ebone->head, tmp);
+ mul_v3_m4v3(param.prev_h, imat, tmp);
+ }
else {
param.prev_bbone = (prev->segments > 1);
@@ -997,6 +1003,11 @@ static void ebone_spline_preview(EditBone *ebone, float result_array[MAX_BBONE_S
if (ebone->bbone_next_type == BBONE_HANDLE_RELATIVE) {
copy_v3_fl3(param.next_h, 0.0f, param.length, 0.0);
}
+ else if (ebone->bbone_next_type == BBONE_HANDLE_TANGENT) {
+ sub_v3_v3v3(tmp, next->tail, next->head);
+ add_v3_v3v3(tmp, ebone->tail, tmp);
+ mul_v3_m4v3(param.next_h, imat, tmp);
+ }
else {
param.next_bbone = (next->segments > 1);