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>2009-08-02 10:10:24 +0400
committerJoshua Leung <aligorith@gmail.com>2009-08-02 10:10:24 +0400
commit24d1cf7d5493c2fe8fbf72e0fb5d8ec77346d4aa (patch)
tree268c0967d2f02f0d618d757f56afa029f6aa8bcc /source/blender/blenkernel/intern/ipo.c
parentde36dd1e99476f311055a4ac62aacc3cdbda193b (diff)
Animato - Bugfixes for ShapeKeys + ShapeKey Drivers
* Animated ShapeKey F-Curves/Drivers are now visible in the Animation Editors. * As a result of this, the old 'ShapeKeys' mode (which would display all the shapekey channels, even if they had no keyframes yet) in the DopeSheet, no longer works for now. However, it would have been of no use as no sliders were shown anyway. * Drivers which depended on the rotation of bones now work again. These now point to the right RNA properties, and get some extra 'time' corrections (for degrees -> radians change).
Diffstat (limited to 'source/blender/blenkernel/intern/ipo.c')
-rw-r--r--source/blender/blenkernel/intern/ipo.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index cf7e486613b..a72f26f6157 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -296,8 +296,8 @@ static char *pchan_adrcodes_to_paths (int adrcode, int *array_index)
case AC_EUL_Z:
*array_index= 2; return "euler_rotation";
- case -1: // XXX special case for rotation drivers... until eulers are added...
- *array_index= 0; return "rotation";
+ case -1: /* special case for euler-rotations used by old drivers */
+ *array_index= 0; return "euler_rotation";
case AC_LOC_X:
*array_index= 0; return "location";
@@ -1023,12 +1023,11 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
dtar->rna_path= get_rna_access(ID_PO, AC_SIZE_Z, idriver->name, NULL, &dtar->array_index);
break;
- case OB_ROT_X: /* rotation - we need to be careful with this... XXX (another reason why we need eulers) */
+ case OB_ROT_X: /* rotation - we need to be careful with this... */
case OB_ROT_Y:
case OB_ROT_Z:
{
- // XXX this is not yet a 1:1 map, since we'd need euler rotations to make this work nicely (unless we make some hacks)
- // XXX -1 here is a special hack...
+ /* -1 here, not rotation code, since old system didn't have eulers */
dtar->rna_path= get_rna_access(ID_PO, -1, idriver->name, NULL, NULL);
dtar->array_index= idriver->adrcode - OB_ROT_X;
}
@@ -1276,6 +1275,26 @@ static void icu_to_fcurves (ListBase *groups, ListBase *list, IpoCurve *icu, cha
dst->vec[1][1] *= fac;
dst->vec[2][1] *= fac;
}
+
+ /* correct times for rotation drivers
+ * - need to go from degrees to radians...
+ * - there's only really 1 target to worry about
+ */
+ if (fcu->driver && fcu->driver->targets.first) {
+ DriverTarget *dtar= fcu->driver->targets.first;
+
+ /* since drivers could only be for objects, we should just check for 'rotation' being
+ * in the name of the path given
+ * - WARNING: this will break if we encounter a bone or object explictly named in that way...
+ */
+ if ((dtar && dtar->rna_path) && strstr(dtar->rna_path, "rotation")) {
+ const float fac= (float)M_PI / 180.0f;
+
+ dst->vec[0][0] *= fac;
+ dst->vec[1][0] *= fac;
+ dst->vec[2][0] *= fac;
+ }
+ }
}
/* free this data now */