diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-08-09 17:17:40 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2018-08-13 19:02:49 +0300 |
commit | a5aeca4a64dfd2ec6d0d68acf2fd9e4a9498558d (patch) | |
tree | 22a4b37f06121e36ee35c14046835f08ba702d81 /source/blender/blenkernel/intern/armature.c | |
parent | ff6bd57873ec11f7748bc74bf3d628b3cbe38f70 (diff) |
Fix dependency graph for constraints depending on B-Bone shape.
Some constraints have an option to take the final bezier shape of
the target B-Bone into account. This shape usually depends on two
other bones in addition to the target itself, so the graph should
include the relevant dependencies.
Reviewers: sergey
Differential Revision: https://developer.blender.org/D3591
Diffstat (limited to 'source/blender/blenkernel/intern/armature.c')
-rw-r--r-- | source/blender/blenkernel/intern/armature.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index cea81a82f4b..9174038dfbb 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -433,6 +433,25 @@ void equalize_bbone_bezier(float *data, int desired) copy_qt_qt(fp, temp[MAX_BBONE_SUBDIV]); } +/* get "next" and "prev" bones - these are used for handle calculations */ +void BKE_pchan_get_bbone_handles(bPoseChannel *pchan, bPoseChannel **r_prev, bPoseChannel **r_next) +{ + if (pchan->bboneflag & PCHAN_BBONE_CUSTOM_HANDLES) { + /* use the provided bones as the next/prev - leave blank to eliminate this effect altogether */ + *r_prev = pchan->bbone_prev; + *r_next = pchan->bbone_next; + } + else { + /* evaluate next and prev bones */ + if (pchan->bone->flag & BONE_CONNECTED) + *r_prev = pchan->parent; + else + *r_prev = NULL; + + *r_next = pchan->child; + } +} + /* returns pointer to static array, filled with desired amount of bone->segments elements */ /* this calculation is done within unit bone space */ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BBONE_SUBDIV]) @@ -460,21 +479,7 @@ void b_bone_spline_setup(bPoseChannel *pchan, int rest, Mat4 result_array[MAX_BB } } - /* get "next" and "prev" bones - these are used for handle calculations */ - if (pchan->bboneflag & PCHAN_BBONE_CUSTOM_HANDLES) { - /* use the provided bones as the next/prev - leave blank to eliminate this effect altogether */ - prev = pchan->bbone_prev; - next = pchan->bbone_next; - } - else { - /* evaluate next and prev bones */ - if (bone->flag & BONE_CONNECTED) - prev = pchan->parent; - else - prev = NULL; - - next = pchan->child; - } + BKE_pchan_get_bbone_handles(pchan, &prev, &next); /* find the handle points, since this is inside bone space, the * first point = (0, 0, 0) |