Merged changes in the trunk up to revision 34193.
[blender.git] / source / blender / editors / animation / anim_filter.c
index 641183db4c4d4a455607cea26419532a51f0b0f7..91af5534eaa35c55800a7f7a42c98c22da4a86b0 100644 (file)
@@ -70,6 +70,7 @@
 #include "MEM_guardedalloc.h"
 
 #include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
 #include "BLI_ghash.h"
 
 #include "BKE_animsys.h"
@@ -82,6 +83,7 @@
 #include "BKE_material.h"
 #include "BKE_node.h"
 #include "BKE_sequencer.h"
+#include "BKE_utildefines.h"
 
 #include "ED_anim_api.h"
 
@@ -106,23 +108,7 @@ static Key *actedit_get_shapekeys (bAnimContext *ac)
        //if (saction->pin) return NULL;
        
        /* shapekey data is stored with geometry data */
-       switch (ob->type) {
-               case OB_MESH:
-                       key= ((Mesh *)ob->data)->key;
-                       break;
-                       
-               case OB_LATTICE:
-                       key= ((Lattice *)ob->data)->key;
-                       break;
-                       
-               case OB_CURVE:
-               case OB_SURF:
-                       key= ((Curve *)ob->data)->key;
-                       break;
-                       
-               default:
-                       return NULL;
-       }
+       key= ob_get_key(ob);
        
        if (key) {
                if (key->type == KEY_RELATIVE)
@@ -643,6 +629,19 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
                                ale->adt= BKE_animdata_from_id(data);
                        }
                                break;
+                       case ANIMTYPE_DSLAT:
+                       {
+                               Lattice *lt= (Lattice *)data;
+                               AnimData *adt= lt->adt;
+                               
+                               ale->flag= FILTER_LATTICE_OBJD(lt);
+                               
+                               ale->key_data= (adt) ? adt->action : NULL;
+                               ale->datatype= ALE_ACT;
+                               
+                               ale->adt= BKE_animdata_from_id(data);
+                       }       
+                               break;
                        case ANIMTYPE_DSSKEY:
                        {
                                Key *key= (Key *)data;
@@ -1613,6 +1612,14 @@ static int animdata_filter_dopesheet_obdata (bAnimContext *ac, ListBase *anim_da
                        expanded= FILTER_MESH_OBJD(me);
                }
                        break;
+               case OB_LATTICE: /* ---- Lattice ---- */
+               {
+                       Lattice *lt = (Lattice *)ob->data;
+                       
+                       type= ANIMTYPE_DSLAT;
+                       expanded= FILTER_LATTICE_OBJD(lt);
+               }
+                       break;
        }
        
        /* special exception for drivers instead of action */
@@ -1871,6 +1878,19 @@ static int animdata_filter_dopesheet_ob (bAnimContext *ac, ListBase *anim_data,
                        }
                }
                        break;
+               case OB_LATTICE: /* ------- Lattice ---------- */
+               {
+                       Lattice *lt= (Lattice *)ob->data;
+                       
+                       if ((ads->filterflag & ADS_FILTER_NOLAT) == 0) {
+                               ANIMDATA_FILTER_CASES(lt,
+                                       { /* AnimData blocks - do nothing... */ },
+                                       obdata_ok= 1;,
+                                       obdata_ok= 1;,
+                                       obdata_ok= 1;)
+                       }
+               }
+                       break;
        }
        if (obdata_ok) 
                items += animdata_filter_dopesheet_obdata(ac, anim_data, ads, base, filter_mode);
@@ -2500,6 +2520,23 @@ static int animdata_filter_dopesheet (bAnimContext *ac, ListBase *anim_data, bDo
                                                        dataOk= !(ads->filterflag & ADS_FILTER_NOMESH);)
                                        }
                                                break;
+                                       case OB_LATTICE: /* ------- Lattice ---------- */
+                                       {
+                                               Lattice *lt= (Lattice *)ob->data;
+                                               dataOk= 0;
+                                               ANIMDATA_FILTER_CASES(lt, 
+                                                       if ((ads->filterflag & ADS_FILTER_NOLAT)==0) {
+                                                               /* for the special AnimData blocks only case, we only need to add
+                                                                * the block if it is valid... then other cases just get skipped (hence ok=0)
+                                                                */
+                                                               ANIMDATA_ADD_ANIMDATA(lt);
+                                                               dataOk=0;
+                                                       },
+                                                       dataOk= !(ads->filterflag & ADS_FILTER_NOLAT);, 
+                                                       dataOk= !(ads->filterflag & ADS_FILTER_NOLAT);, 
+                                                       dataOk= !(ads->filterflag & ADS_FILTER_NOLAT);)
+                                       }
+                                               break;
                                        default: /* --- other --- */
                                                dataOk= 0;
                                                break;