diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-11-24 15:12:24 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2018-11-27 09:31:34 +0300 |
commit | a58f0eea4f1e9b04e519e123eb656009cf718f9e (patch) | |
tree | d3459d3c43d9602fe1f0c2e1678bb565601144d6 /source/blender/blenkernel/intern/armature_update.c | |
parent | fe65867c3dd99f33c1b2a8f509027021d43063bf (diff) |
RNA: expose access to B-Bone shape data from Python.
B-Bone shape is a non-trivial computation, so access to
the results would be useful for Python scripts working with
B-Bones, e.g. rig generation.
This exposes both final segment matrices, and the tangent
vectors computed from the custom handle bones.
Since the handle tangents use the axis+roll orientation math
of edit bones, add matrix conversion static methods to Bone.
Reviewers: campbellbarton
Differential Revision: https://developer.blender.org/D3983
Diffstat (limited to 'source/blender/blenkernel/intern/armature_update.c')
-rw-r--r-- | source/blender/blenkernel/intern/armature_update.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c index b917aae08de..f5519966ac2 100644 --- a/source/blender/blenkernel/intern/armature_update.c +++ b/source/blender/blenkernel/intern/armature_update.c @@ -715,17 +715,24 @@ void BKE_pose_bone_done(struct Depsgraph *depsgraph, copy_v3_v3(pchan_orig->pose_head, pchan->pose_mat[3]); copy_m4_m4(pchan_orig->constinv, pchan->constinv); BKE_pose_where_is_bone_tail(pchan_orig); + if (pchan->bone == NULL || pchan->bone->segments <= 1) { + BKE_pose_channel_free_bbone_cache(pchan_orig); + } } } void BKE_pose_eval_bbone_segments(struct Depsgraph *depsgraph, - struct Object *ob, - int pchan_index) + struct Object *ob, + int pchan_index) { bPoseChannel *pchan = pose_pchan_get_indexed(ob, pchan_index); DEG_debug_print_eval(depsgraph, __func__, pchan->name, pchan); if (pchan->bone != NULL && pchan->bone->segments > 1) { BKE_pchan_cache_bbone_segments(pchan); + bArmature *arm = (bArmature *)ob->data; + if (DEG_is_active(depsgraph) && arm->edbo == NULL) { + BKE_pchan_copy_bbone_segments_cache(pchan->orig_pchan, pchan); + } } } |