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:
authorJoshua Leung <aligorith@gmail.com>2011-01-27 02:33:08 +0300
committerJoshua Leung <aligorith@gmail.com>2011-01-27 02:33:08 +0300
commit50e09b15a99333ed657f70a8a38bf28d5849506e (patch)
treed44458b43b379ec2e32b918cfe0e29de624849c1 /source/blender
parenteb0ddb7684782c6d72d06f5c8f88a39a1be6e693 (diff)
Bugfix [#25707] / Todo Item: "Local Space" for Object constraining
For Constraints, there's now a working "Local" Space for Objects without parents. This is defined as relative to the object's rotated set of axes which results from rotation that gets set via "rotation" transform properties. I'm not sure whether this different behaviour between parented and unparented objects will be too confusing (and thus require separate settings + a round of version patching), so I'll wait until we get proper testing from experienced riggers first.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/intern/constraint.c25
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c2
2 files changed, 25 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index c497132fa99..c61f3ba3683 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -372,7 +372,7 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
else {
/* objects */
if (from==CONSTRAINT_SPACE_WORLD && to==CONSTRAINT_SPACE_LOCAL) {
- /* check if object has a parent - otherwise this won't work */
+ /* check if object has a parent */
if (ob->parent) {
/* 'subtract' parent's effects from owner */
mul_m4_m4m4(diff_mat, ob->parentinv, ob->parent->obmat);
@@ -380,6 +380,18 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
copy_m4_m4(tempmat, mat);
mul_m4_m4m4(mat, tempmat, imat);
}
+ else {
+ /* Local space in this case will have to be defined as local to the owner's
+ * transform-property-rotated axes. So subtract this rotation component.
+ */
+ object_to_mat4(ob, diff_mat);
+ normalize_m4(diff_mat);
+ zero_v3(diff_mat[3]);
+
+ invert_m4_m4(imat, diff_mat);
+ copy_m4_m4(tempmat, mat);
+ mul_m4_m4m4(mat, tempmat, imat);
+ }
}
else if (from==CONSTRAINT_SPACE_LOCAL && to==CONSTRAINT_SPACE_WORLD) {
/* check that object has a parent - otherwise this won't work */
@@ -389,6 +401,17 @@ void constraint_mat_convertspace (Object *ob, bPoseChannel *pchan, float mat[][4
mul_m4_m4m4(diff_mat, ob->parentinv, ob->parent->obmat);
mul_m4_m4m4(mat, tempmat, diff_mat);
}
+ else {
+ /* Local space in this case will have to be defined as local to the owner's
+ * transform-property-rotated axes. So add back this rotation component.
+ */
+ object_to_mat4(ob, diff_mat);
+ normalize_m4(diff_mat);
+ zero_v3(diff_mat[3]);
+
+ copy_m4_m4(tempmat, mat);
+ mul_m4_m4m4(mat, tempmat, diff_mat);
+ }
}
}
}
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 112526cec46..692ebb59240 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -79,7 +79,7 @@ EnumPropertyItem space_pchan_items[] = {
EnumPropertyItem space_object_items[] = {
{0, "WORLD", 0, "World Space", ""},
- {1, "LOCAL", 0, "Local (Without Parent) Space", ""},
+ {1, "LOCAL", 0, "Local Space", ""},
{0, NULL, 0, NULL, NULL}};
EnumPropertyItem constraint_ik_type_items[] ={