From 33eabb82207e165de45fb6a0ea74dec962de7265 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sat, 23 Nov 2019 13:11:39 +0300 Subject: Action Constraint: introduce a mix mode setting. Currently the action channels are applied after the existing transformation, as if the action controlled a child of the bone. This is not very natural, but more importantly, the transform tools are not designed to work conveniently with an additional 'pseudo-child' transformation, resulting in effects like an unexpected pivot location. Implementing a Before mode that integrates the action channels as if applied to a parent allows using the special transform tool code intended for dealing with such constraints. Note that in either mode, Action constraints should be added in reverse order, putting a new constraint before the existing ones that the Action was keyframed to work together. In order to implement the option, extract a utility from the Copy Transform constraint code for combining transforms with special anti-shear scale handling that matches the Aligned Inherit Scale mode. The Before mode also requires switching the constraint to the Local owner space, while the After mode can still use the World space for efficiency as before. Since the constraint doesn't have an Owner space option in the UI, this has to be handled in an RNA setter. For full backward compatibility, the original simple matrix multiplication mode is preserved as the third option, but it is not recommended due to creating shear. Differential Revision: https://developer.blender.org/D6297 --- source/blender/makesdna/DNA_constraint_types.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source/blender/makesdna/DNA_constraint_types.h') diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index 0baa11c3059..f816041010b 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -336,6 +336,8 @@ typedef struct bActionConstraint { float min; float max; int flag; + char mix_mode; + char _pad[7]; struct bAction *act; /** MAX_ID_NAME-2. */ char subtarget[64]; @@ -865,6 +867,16 @@ typedef enum eActionConstraint_Flags { ACTCON_BONE_USE_OBJECT_ACTION = (1 << 0), } eActionConstraint_Flags; +/* bActionConstraint.mix_mode */ +typedef enum eActionConstraint_MixMode { + /* Multiply the action transformation on the right. */ + ACTCON_MIX_AFTER_FULL = 0, + /* Multiply the action transformation on the right, with anti-shear scale handling. */ + ACTCON_MIX_AFTER, + /* Multiply the action transformation on the left, with anti-shear scale handling. */ + ACTCON_MIX_BEFORE, +} eActionConstraint_MixMode; + /* Locked-Axis Values (Locked Track) */ typedef enum eLockAxis_Modes { LOCK_X = 0, -- cgit v1.2.3