Revision: 22132
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=22132
Author:   aligorith
Date:     2009-08-02 08:10:24 +0200 (Sun, 02 Aug 2009)

Log Message:
-----------
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).

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c
    branches/blender2.5/blender/source/blender/blenkernel/intern/key.c
    branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
    branches/blender2.5/blender/source/blender/editors/space_graph/space_graph.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c       
2009-08-02 03:59:00 UTC (rev 22131)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/fcurve.c       
2009-08-02 06:10:24 UTC (rev 22132)
@@ -722,6 +722,8 @@
                                break;
                }
        }
+       else if (G.f & G_DEBUG)
+               printf("Driver Evaluation Error: cannot resolve target for %s 
-> %s \n", id->name, path);
        
        return value;
 }

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c  
2009-08-02 03:59:00 UTC (rev 22131)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/ipo.c  
2009-08-02 06:10:24 UTC (rev 22132)
@@ -296,8 +296,8 @@
                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 @@
                                                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 @@
                                        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 */

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/key.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/key.c  
2009-08-02 03:59:00 UTC (rev 22131)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/key.c  
2009-08-02 06:10:24 UTC (rev 22132)
@@ -1382,18 +1382,11 @@
                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);

Modified: 
branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c  
2009-08-02 03:59:00 UTC (rev 22131)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_filter.c  
2009-08-02 06:10:24 UTC (rev 22132)
@@ -856,71 +856,6 @@
        /* 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 @@
                                
                                /* 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 @@
                                
                                /* 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 @@
                                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:

Modified: 
branches/blender2.5/blender/source/blender/editors/space_graph/space_graph.c
===================================================================
--- 
branches/blender2.5/blender/source/blender/editors/space_graph/space_graph.c    
    2009-08-02 03:59:00 UTC (rev 22131)
+++ 
branches/blender2.5/blender/source/blender/editors/space_graph/space_graph.c    
    2009-08-02 06:10:24 UTC (rev 22132)
@@ -69,20 +69,20 @@
        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;


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to