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>2021-08-02 19:08:12 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2021-08-05 21:21:29 +0300
commitcf10eb54cc4bc89e763dc48644c402f7578fa6b2 (patch)
tree1d3773a26ba46ae7f240512fdaab8eee108730e2 /source/blender/blenkernel/intern/constraint.c
parentd01781129fab7846a6a03815b0c0b48b2a809c39 (diff)
Action Constraint: add Split Channels Mix choices from Copy Transforms
Practice shows that when combining actions and direct animation it is usually best to combine location, rotation and scale separately, which is implemented by the Split Channels modes recently introduced in D9469 for Copy Transforms. This completes the same set of 6 choices for the Action Constraint. The default for new constraints is changed to the newly added Before Original (Split Channels) mode. The original patch is motivated by Loic Pinsard, who created an addon that does the equivalent of this feature by splitting the action into two, separating location and rotation+scale. Differential Revision: https://developer.blender.org/D7547
Diffstat (limited to 'source/blender/blenkernel/intern/constraint.c')
-rw-r--r--source/blender/blenkernel/intern/constraint.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index b7e02f06571..0da29ded13d 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -2982,6 +2982,16 @@ static void actcon_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targ
if (VALID_CONS_TARGET(ct) || data->flag & ACTCON_USE_EVAL_TIME) {
switch (data->mix_mode) {
+ /* Simple matrix multiplication. */
+ case ACTCON_MIX_BEFORE_FULL:
+ mul_m4_m4m4(cob->matrix, ct->matrix, cob->matrix);
+ break;
+
+ case ACTCON_MIX_AFTER_FULL:
+ mul_m4_m4m4(cob->matrix, cob->matrix, ct->matrix);
+ break;
+
+ /* Aligned Inherit Scale emulation. */
case ACTCON_MIX_BEFORE:
mul_m4_m4m4_aligned_scale(cob->matrix, ct->matrix, cob->matrix);
break;
@@ -2990,8 +3000,13 @@ static void actcon_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *targ
mul_m4_m4m4_aligned_scale(cob->matrix, cob->matrix, ct->matrix);
break;
- case ACTCON_MIX_AFTER_FULL:
- mul_m4_m4m4(cob->matrix, cob->matrix, ct->matrix);
+ /* Fully separate handling of channels. */
+ case ACTCON_MIX_BEFORE_SPLIT:
+ mul_m4_m4m4_split_channels(cob->matrix, ct->matrix, cob->matrix);
+ break;
+
+ case ACTCON_MIX_AFTER_SPLIT:
+ mul_m4_m4m4_split_channels(cob->matrix, cob->matrix, ct->matrix);
break;
default:
@@ -5767,6 +5782,17 @@ static bConstraint *add_new_constraint(Object *ob,
}
break;
}
+ case CONSTRAINT_TYPE_ACTION: {
+ /* The Before or Split modes require computing in local space, but
+ * for objects the Local space doesn't make sense (T78462, D6095 etc).
+ * So only default to Before (Split) if the constraint is on a bone. */
+ if (pchan) {
+ bActionConstraint *data = con->data;
+ data->mix_mode = ACTCON_MIX_BEFORE_SPLIT;
+ con->ownspace = CONSTRAINT_SPACE_LOCAL;
+ }
+ break;
+ }
}
return con;