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-06-27 23:15:57 +0300
committerAlexander Gavrilov <angavrilov@gmail.com>2021-07-02 15:15:05 +0300
commit5a693ce9e396f04d88140d8e015fcace7eddc6c2 (patch)
treefec38890821b4b256aa5b531b5e2f12a8d804c25 /source/blender/makesrna
parentbc8ae58727bf078df1fc5803a9de5c9eb984aeb7 (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/makesrna')
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c10
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c3
2 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index d34885e1a68..28aef635688 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -206,6 +206,7 @@ static const EnumPropertyItem target_space_pchan_items[] = {
"Custom Space",
"The transformation of the target is evaluated relative to a custom object/bone/vertex "
"group"},
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_SPACE_POSE,
"POSE",
0,
@@ -224,6 +225,14 @@ static const EnumPropertyItem target_space_pchan_items[] = {
"Local Space",
"The transformation of the target is evaluated relative to its local "
"coordinate system"},
+ {CONSTRAINT_SPACE_OWNLOCAL,
+ "LOCAL_OWNER_ORIENT",
+ 0,
+ "Local Space (Owner Orientation)",
+ "The transformation of the target bone is evaluated relative to its local coordinate "
+ "system, followed by a correction for the difference in target and owner rest pose "
+ "orientations. When applied as local transform to the owner produces the same global "
+ "motion as the target if the parents are still in rest pose"},
{0, NULL, 0, NULL, NULL},
};
@@ -238,6 +247,7 @@ static const EnumPropertyItem owner_space_pchan_items[] = {
0,
"Custom Space",
"The constraint is applied in local space of a custom object/bone/vertex group"},
+ {0, "", 0, NULL, NULL},
{CONSTRAINT_SPACE_POSE,
"POSE",
0,
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 4608b0c1bac..10ba2b9acb1 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -303,6 +303,9 @@ static void rna_Object_mat_convert_space(Object *ob,
{
copy_m4_m4((float(*)[4])mat_ret, (float(*)[4])mat);
+ BLI_assert(!ELEM(from, CONSTRAINT_SPACE_OWNLOCAL));
+ BLI_assert(!ELEM(to, CONSTRAINT_SPACE_OWNLOCAL));
+
/* Error in case of invalid from/to values when pchan is NULL */
if (pchan == NULL) {
if (ELEM(from, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_PARLOCAL)) {