From 5a693ce9e396f04d88140d8e015fcace7eddc6c2 Mon Sep 17 00:00:00 2001 From: Alexander Gavrilov Date: Sun, 27 Jun 2021 23:15:57 +0300 Subject: Constraints: support a new Local Space (Owner Orientation) for targets. Add a new transformation space choice for bone constraints, which represent the local transformation of the target bone in the constraint owner's local space. The use case for this is transferring the local (i.e. excluding the effect of parents) motion of one bone to another one, while ignoring the difference between their rest pose orientations. The new option replaces the following setup: * A `child` bone of the `target`, rotated the same as `owner` in rest pose. * A `sibling` bone of the `target`, positioned same as `child` in rest pose and using Copy Transforms in World Space from `child`. * The `owner` bone constraint uses Local Space of `sibling`. (This analogy applies provided both bones use Local Location) Differential Revision: https://developer.blender.org/D9493 --- source/blender/editors/armature/armature_add.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'source/blender/editors/armature/armature_add.c') diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c index 0ee11a6ef55..baa279dea11 100644 --- a/source/blender/editors/armature/armature_add.c +++ b/source/blender/editors/armature/armature_add.c @@ -438,17 +438,15 @@ static void updateDuplicateSubtarget(EditBone *dup_bone, } } -static void updateDuplicateActionConstraintSettings(EditBone *dup_bone, - EditBone *orig_bone, - Object *ob, - bConstraint *curcon) +static void updateDuplicateActionConstraintSettings( + EditBone *dup_bone, EditBone *orig_bone, Object *ob, bPoseChannel *pchan, bConstraint *curcon) { bActionConstraint *act_con = (bActionConstraint *)curcon->data; bAction *act = (bAction *)act_con->act; float mat[4][4]; - bConstraintOb cob = {.depsgraph = NULL, .scene = NULL, .ob = ob, .pchan = NULL}; + bConstraintOb cob = {.depsgraph = NULL, .scene = NULL, .ob = ob, .pchan = pchan}; BKE_constraint_custom_object_space_get(cob.space_obj_world_matrix, curcon); unit_m4(mat); @@ -832,7 +830,7 @@ static void updateDuplicateConstraintSettings(EditBone *dup_bone, EditBone *orig for (curcon = conlist->first; curcon; curcon = curcon->next) { switch (curcon->type) { case CONSTRAINT_TYPE_ACTION: - updateDuplicateActionConstraintSettings(dup_bone, orig_bone, ob, curcon); + updateDuplicateActionConstraintSettings(dup_bone, orig_bone, ob, pchan, curcon); break; case CONSTRAINT_TYPE_KINEMATIC: updateDuplicateKinematicConstraintSettings(curcon); -- cgit v1.2.3