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>2019-09-01 17:21:22 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2019-09-03 19:35:36 +0300
commite91ea20ebee800600ec073f9738b448778372453 (patch)
tree5ba45f03fc6fa53b45ae085cd561afb60dea0a26 /source/blender/makesrna/intern/rna_fcurve.c
parentb3b59e3b5657ad95ecca4b8c47c3b20c7e55da35 (diff)
Drivers: support decomposing rotation into swing followed by twist.
In order to correctly drive corrective shape keys from a freely rotating organic joint it is very often found necessary to decompose the rotation into separate bending and twisting motions. This type of decomposition cannot be reproduced by any Euler order or a single quaternion. Instead this is done by using a helper bone with a Damped Track constraint aimed at the tail of the control to pick up the bending, and its helper child with Copy Transforms to separate the twist. Requiring two additional bones to drive a shape key or a correction bone seems inconvenient, so this implements the necessary math as new options in the recently introduced Rotation Mode dropdown of the Transform Channel driver variable type. The data is also accessible as a Transformation constraint input. The output is in the form of Quaternion-derived 'pseudo-angles', which for `Swing and Y Twist` would represent the following: * W: true bend angle, independent of bend direction. * Y: true twist angle. * X, Z: pseudo-angles representing the proportion of bending around X/Z. Reviewers: brecht Differential Revision: https://developer.blender.org/D5651
Diffstat (limited to 'source/blender/makesrna/intern/rna_fcurve.c')
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 4f8e63e975f..254f3bc3710 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -141,6 +141,21 @@ const EnumPropertyItem rna_enum_driver_target_rotation_mode_items[] = {
{DTAR_ROTMODE_EULER_ZXY, "ZXY", 0, "ZXY Euler", "Euler using the ZXY rotation order"},
{DTAR_ROTMODE_EULER_ZYX, "ZYX", 0, "ZYX Euler", "Euler using the ZYX rotation order"},
{DTAR_ROTMODE_QUATERNION, "QUATERNION", 0, "Quaternion", "Quaternion rotation"},
+ {DTAR_ROTMODE_SWING_TWIST_X,
+ "SWING_TWIST_X",
+ 0,
+ "Swing and X Twist",
+ "Decompose into a swing rotation to aim the X axis, followed by twist around it"},
+ {DTAR_ROTMODE_SWING_TWIST_Y,
+ "SWING_TWIST_Y",
+ 0,
+ "Swing and Y Twist",
+ "Decompose into a swing rotation to aim the Y axis, followed by twist around it"},
+ {DTAR_ROTMODE_SWING_TWIST_Z,
+ "SWING_TWIST_Z",
+ 0,
+ "Swing and Z Twist",
+ "Decompose into a swing rotation to aim the Z axis, followed by twist around it"},
{0, NULL, 0, NULL, NULL},
};