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-06-14 15:01:36 +0400
committerJoshua Leung <aligorith@gmail.com>2011-06-14 15:01:36 +0400
commit7272bb643c379986c7332a994ce9e576d3b8a748 (patch)
tree0cb1a50bfe4bd0e1bda7b7cf2caec4c6fde99f75 /source/blender/blenkernel/intern/fcurve.c
parenta4216cb1d4336bd2244f4519398db0b9f19833ad (diff)
Bugfix: Distance DVar doesn't work with new Local Space
Fixed references in UI to the old property, and adapted the backend code to work for the new options too.
Diffstat (limited to 'source/blender/blenkernel/intern/fcurve.c')
-rw-r--r--source/blender/blenkernel/intern/fcurve.c45
1 files changed, 35 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index be2a6a762ee..1f45cc56117 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -1153,25 +1153,50 @@ static float dvar_eval_locDiff (ChannelDriver *driver, DriverVar *dvar)
/* check if object or bone */
if (pchan) {
/* bone */
- if ((dtar->flag & DTAR_FLAG_LOCALSPACE) == 0) {
+ if (dtar->flag & DTAR_FLAG_LOCALSPACE) {
+ if (dtar->flag & DTAR_FLAG_LOCAL_CONSTS) {
+ float mat[4][4];
+
+ /* extract transform just like how the constraints do it! */
+ copy_m4_m4(mat, pchan->pose_mat);
+ constraint_mat_convertspace(ob, pchan, mat, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_LOCAL);
+
+ /* ... and from that, we get our transform */
+ VECCOPY(tmp_loc, mat[3]);
+ }
+ else {
+ /* transform space (use transform values directly) */
+ VECCOPY(tmp_loc, pchan->loc);
+ }
+ }
+ else {
/* convert to worldspace */
VECCOPY(tmp_loc, pchan->pose_head);
mul_m4_v3(ob->obmat, tmp_loc);
}
- else {
- /* local (use transform values directly) */
- VECCOPY(tmp_loc, pchan->loc);
- }
}
else {
/* object */
- if ((dtar->flag & DTAR_FLAG_LOCALSPACE) == 0) {
- /* worldspace */
- VECCOPY(tmp_loc, ob->obmat[3]);
+ if (dtar->flag & DTAR_FLAG_LOCALSPACE) {
+ if (dtar->flag & DTAR_FLAG_LOCAL_CONSTS) {
+ // XXX: this should practically be the same as transform space...
+ float mat[4][4];
+
+ /* extract transform just like how the constraints do it! */
+ copy_m4_m4(mat, ob->obmat);
+ constraint_mat_convertspace(ob, NULL, mat, CONSTRAINT_SPACE_WORLD, CONSTRAINT_SPACE_LOCAL);
+
+ /* ... and from that, we get our transform */
+ VECCOPY(tmp_loc, mat[3]);
+ }
+ else {
+ /* transform space (use transform values directly) */
+ VECCOPY(tmp_loc, ob->loc);
+ }
}
else {
- /* local (use transform values directly) */
- VECCOPY(tmp_loc, ob->loc);
+ /* worldspace */
+ VECCOPY(tmp_loc, ob->obmat[3]);
}
}