diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2021-06-27 23:15:57 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2021-07-02 15:15:05 +0300 |
commit | 5a693ce9e396f04d88140d8e015fcace7eddc6c2 (patch) | |
tree | fec38890821b4b256aa5b531b5e2f12a8d804c25 /source/blender/editors/armature/armature_add.c | |
parent | bc8ae58727bf078df1fc5803a9de5c9eb984aeb7 (diff) |
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
Diffstat (limited to 'source/blender/editors/armature/armature_add.c')
-rw-r--r-- | source/blender/editors/armature/armature_add.c | 10 |
1 files changed, 4 insertions, 6 deletions
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); |