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
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).
-rw-r--r--source/blender/blenkernel/intern/fcurve.c2
-rw-r--r--source/blender/blenkernel/intern/ipo.c29
-rw-r--r--source/blender/blenkernel/intern/key.c13
-rw-r--r--source/blender/editors/animation/anim_filter.c71
-rw-r--r--source/blender/editors/space_graph/space_graph.c10
5 files changed, 37 insertions, 88 deletions
diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c
index ebd94b94f8c..90bf08059d7 100644
--- a/source/blender/blenkernel/intern/fcurve.c
+++ b/source/blender/blenkernel/intern/fcurve.c
@@ -722,6 +722,8 @@ float driver_get_target_value (ChannelDriver *driver, DriverTarget *dtar)
break;
}
}
+ else if (G.f & G_DEBUG)
+ printf("Driver Evaluation Error: cannot resolve target for %s -> %s \n", id->name, path);
return value;
}
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 */
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 595ba37e09c..a2fa97cabc9 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -1382,18 +1382,11 @@ int do_ob_key(Scene *scene, Object *ob)
return 1;
}
else {
-#if 0 // XXX old animation system
- // NOTE: this stuff was NEVER reliable at all...
- if(ob->ipoflag & OB_ACTION_KEY)
- do_all_object_actions(scene, ob);
- else {
- calc_ipo(key->ipo, bsystem_time(scene, ob, scene->r.cfra, 0.0));
- execute_ipo((ID *)key, key->ipo);
- }
-#endif // XXX old animation system
/* do shapekey local drivers */
float ctime= (float)scene->r.cfra; // XXX this needs to be checked
- if (G.f & G_DEBUG) printf("ob %s - do shapekey (%s) drivers \n", ob->id.name+2, key->id.name+2);
+
+ if (G.f & G_DEBUG)
+ printf("ob %s - do shapekey (%s) drivers \n", ob->id.name+2, key->id.name+2);
BKE_animsys_evaluate_animdata(&key->id, key->adt, ctime, ADT_RECALC_DRIVERS);
if(ob->type==OB_MESH) return do_mesh_key(scene, ob, ob->data);
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 5970cf481ac..4e479bd75d0 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -856,71 +856,6 @@ static int animdata_filter_nla (ListBase *anim_data, AnimData *adt, int filter_m
/* return the number of items added to the list */
return items;
}
-
-static int animdata_filter_shapekey (ListBase *anim_data, Key *key, int filter_mode, void *owner, short ownertype, ID *owner_id)
-{
- bAnimListElem *ale;
- KeyBlock *kb;
- //FCurve *fcu;
- int i, items=0;
-
- /* are we filtering for display or editing */
- if (filter_mode & ANIMFILTER_CHANNELS) {
- /* for display - loop over shapekeys, adding ipo-curve references where needed */
- kb= key->block.first;
-
- /* loop through possible shapekeys, manually creating entries */
- for (i= 1; i < key->totkey; i++) {
- ale= MEM_callocN(sizeof(bAnimListElem), "bAnimListElem");
- kb = kb->next; /* do this even on the first try, as the first is 'Basis' (which doesn't get included) */
-
- ale->data= kb;
- ale->type= ANIMTYPE_SHAPEKEY; /* 'abused' usage of this type */
- ale->owner= key;
- ale->ownertype= ANIMTYPE_SHAPEKEY;
- ale->datatype= ALE_NONE;
- ale->index = i;
-
-#if 0 // XXX fixme... old system
- if (key->ipo) {
- for (icu= key->ipo->curve.first; icu; icu=icu->next) {
- if (icu->adrcode == i) {
- ale->key_data= icu;
- ale->datatype= ALE_ICU;
- break;
- }
- }
- }
-#endif // XXX fixme... old system
-
- ale->id= owner_id;
-
- BLI_addtail(anim_data, ale);
- items++;
- }
- }
- else {
-#if 0 // XXX fixme... old system
- /* loop over ipo curves if present - for editing */
- if (key->ipo) {
- if (filter_mode & ANIMFILTER_IPOKEYS) {
- ale= make_new_animlistelem(key->ipo, ANIMTYPE_IPO, key, ANIMTYPE_SHAPEKEY);
- if (ale) {
- if (owned) ale->id= owner;
- BLI_addtail(anim_data, ale);
- items++;
- }
- }
- else {
- items += animdata_filter_ipocurves(anim_data, key->ipo, filter_mode, key, ANIMTYPE_SHAPEKEY, (owned)?(owner):(NULL));
- }
- }
-#endif // XXX fixme... old system
- }
-
- /* return the number of items added to the list */
- return items;
-}
#if 0
// FIXME: switch this to use the bDopeSheet...
@@ -1272,7 +1207,7 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
/* add channels */
if (FILTER_SKE_OBJD(key) || (filter_mode & ANIMFILTER_CURVESONLY)) {
- items += animdata_filter_shapekey(anim_data, key, filter_mode, ob, ANIMTYPE_OBJECT, (ID *)ob);
+ items += animdata_filter_fcurves(anim_data, adt->drivers.first, NULL, key, ANIMTYPE_DSSKEY, filter_mode, (ID *)key);
}
},
{ /* action (keyframes) */
@@ -1287,7 +1222,7 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
/* add channels */
if (FILTER_SKE_OBJD(key) || (filter_mode & ANIMFILTER_CURVESONLY)) {
- items += animdata_filter_shapekey(anim_data, key, filter_mode, ob, ANIMTYPE_OBJECT, (ID *)ob);
+ items += animdata_filter_action(anim_data, adt->action, filter_mode, key, ANIMTYPE_DSSKEY, (ID *)key);
}
}
);
@@ -1792,7 +1727,7 @@ int ANIM_animdata_filter (bAnimContext *ac, ListBase *anim_data, int filter_mode
break;
case ANIMCONT_SHAPEKEY:
- items= animdata_filter_shapekey(anim_data, data, filter_mode, NULL, ANIMTYPE_NONE, (ID *)obact);
+ //items= animdata_filter_shapekey(anim_data, data, filter_mode, NULL, ANIMTYPE_NONE, (ID *)obact);
break;
case ANIMCONT_GPENCIL:
diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c
index 222f2142c38..0390586951b 100644
--- a/source/blender/editors/space_graph/space_graph.c
+++ b/source/blender/editors/space_graph/space_graph.c
@@ -69,20 +69,20 @@ ARegion *graph_has_buttons_region(ScrArea *sa)
ARegion *ar, *arnew;
for (ar= sa->regionbase.first; ar; ar= ar->next) {
- if(ar->regiontype==RGN_TYPE_UI)
+ if (ar->regiontype==RGN_TYPE_UI)
return ar;
}
- /* add subdiv level; after main window */
+ /* add subdiv level; after main */
for (ar= sa->regionbase.first; ar; ar= ar->next) {
- if(ar->regiontype==RGN_TYPE_WINDOW)
+ if (ar->regiontype==RGN_TYPE_WINDOW)
break;
}
/* is error! */
- if(ar==NULL) return NULL;
+ if (ar==NULL) return NULL;
- arnew= MEM_callocN(sizeof(ARegion), "buttons for nla");
+ arnew= MEM_callocN(sizeof(ARegion), "buttons for graph");
BLI_insertlinkafter(&sa->regionbase, ar, arnew);
arnew->regiontype= RGN_TYPE_UI;