diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2018-12-23 18:43:01 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2019-01-14 19:14:28 +0300 |
commit | de1d3e5f5f4029be03195227197de1c42720f958 (patch) | |
tree | d4b9f2e022af1c864bb6c82e143a6d28da423f01 /source/blender/blenkernel/nla_private.h | |
parent | 9c1a961dc423d2eb19b875564bb4bb3c0b297ca5 (diff) |
NLA: implement a new blending mode that intelligently combines actions.
The existing Add and Multiply blending modes have limited usability,
because the appropriate operation for meaningfully combining values
depends on the channel. This adds a new mode that chooses the operation
automatically based on property settings:
- Axis+Angle channels are summed, effectively averaging the
axis, but adding up the angle. Default is forced to 0.
- Quaternion channels use quaternion multiplication:
result = prev * value ^ influence
- Scale-like multiplicative channels use multiplication:
result = prev * (value / default) ^ influence
- Other channels use addition:
result = prev + (value - default) * influence
Inclusion of default in the computation ensures that combining
keyframed default values of properties keeps the default state,
even if the default isn't 0 or 1.
Strips with this mode can be keyframed normally in Tweak mode,
except that for quaternion rotation keyframing always inserts
all 4 channels, and the channel value sliders on the left side
of Graph/Action editors won't insert keys without Auto Key.
Quaternion keys are also automatically normalized.
Differential Revision: https://developer.blender.org/D4190
Diffstat (limited to 'source/blender/blenkernel/nla_private.h')
-rw-r--r-- | source/blender/blenkernel/nla_private.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenkernel/nla_private.h b/source/blender/blenkernel/nla_private.h index d995eb5dd39..310ff1e2dbf 100644 --- a/source/blender/blenkernel/nla_private.h +++ b/source/blender/blenkernel/nla_private.h @@ -92,6 +92,14 @@ typedef struct NlaEvalChannelSnapshot { /* Memory over-allocated to provide space for values. */ } NlaEvalChannelSnapshot; +/* NlaEvalChannel->mix_mode */ +enum eNlaEvalChannel_MixMode { + NEC_MIX_ADD, + NEC_MIX_MULTIPLY, + NEC_MIX_QUATERNION, + NEC_MIX_AXIS_ANGLE, +}; + /* Temp channel for accumulating data from NLA for a single property. * Handles array properties as a unit to allow intelligent blending. */ typedef struct NlaEvalChannel { @@ -104,6 +112,11 @@ typedef struct NlaEvalChannel { int index; bool is_array; + bool in_blend; + char mix_mode; + + struct NlaEvalChannel *next_blend; + NlaEvalChannelSnapshot *blend_snapshot; /* Mask of array items controlled by NLA. */ NlaValidMask valid; |