doxygen: blender/blenkernel tagged.
[blender.git] / source / blender / blenkernel / intern / ipo.c
index dd7904b478234c7c08d3e54d3119a8d27375f7fd..92098d59e0e3624f7c1ee9b3699da2daf4b072cd 100644 (file)
@@ -16,7 +16,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
  * ***** END GPL LICENSE BLOCK *****
  */
 
+/** \file blender/blenkernel/intern/ipo.c
+ *  \ingroup bke
+ */
+
+
 /* NOTE:
  *
  * This file is no longer used to provide tools for the depreceated IPO system. Instead, it
 #include <string.h>
 #include <stddef.h>
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 #include "MEM_guardedalloc.h"
 
 #include "DNA_anim_types.h"
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
 #include "DNA_constraint_types.h"
-#include "DNA_curve_types.h"
 #include "DNA_camera_types.h"
 #include "DNA_lamp_types.h"
 #include "DNA_ipo_types.h"
 #include "DNA_key_types.h"
 #include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
 #include "DNA_nla_types.h"
-#include "DNA_object_types.h"
-#include "DNA_object_force.h"
-#include "DNA_particle_types.h"
 #include "DNA_sequence_types.h"
 #include "DNA_scene_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_view3d_types.h"
 #include "DNA_world_types.h"
+#include "DNA_object_types.h"
 
+#include "BLI_math.h" /* windows needs for M_PI */
 #include "BLI_blenlib.h"
-#include "BLI_arithb.h"
 #include "BLI_dynstr.h"
+#include "BLI_utildefines.h"
 
-#include "BKE_utildefines.h"
 
+#include "BKE_ipo.h"
 #include "BKE_animsys.h"
 #include "BKE_action.h"
-#include "BKE_blender.h"
-#include "BKE_curve.h"
-#include "BKE_constraint.h"
 #include "BKE_fcurve.h"
 #include "BKE_global.h"
-#include "BKE_ipo.h"
-#include "BKE_library.h"
 #include "BKE_main.h"
-#include "BKE_mesh.h"
 #include "BKE_nla.h"
-#include "BKE_object.h"
-
+#include "BKE_sequencer.h"
 
 
 /* *************************************************** */
@@ -122,7 +108,7 @@ void free_ipo (Ipo *ipo)
 /* Mapping Table for bitflag <-> RNA path */
 typedef struct AdrBit2Path {
        int bit;
-       char *path;
+       const char *path;
        int array_index;
 } AdrBit2Path;
 
@@ -131,27 +117,26 @@ typedef struct AdrBit2Path {
 
 /* Object layers */
 static AdrBit2Path ob_layer_bits[]= {
-       {(1<<0), "layer", 0},
-       {(1<<1), "layer", 1},
-       {(1<<2), "layer", 2},
-       {(1<<3), "layer", 3},
-       {(1<<4), "layer", 4},
-       {(1<<5), "layer", 5},
-       {(1<<6), "layer", 6},
-       {(1<<7), "layer", 7},
-       {(1<<8), "layer", 8},
-       {(1<<9), "layer", 9},
-       {(1<<10), "layer", 10},
-       {(1<<11), "layer", 11},
-       {(1<<12), "layer", 12},
-       {(1<<13), "layer", 13},
-       {(1<<14), "layer", 14},
-       {(1<<15), "layer", 15},
-       {(1<<16), "layer", 16},
-       {(1<<17), "layer", 17},
-       {(1<<18), "layer", 18},
-       {(1<<19), "layer", 19},
-       {(1<<20), "layer", 20}
+       {(1<<0), "layers", 0},
+       {(1<<1), "layers", 1},
+       {(1<<2), "layers", 2},
+       {(1<<3), "layers", 3},
+       {(1<<4), "layers", 4},
+       {(1<<5), "layers", 5},
+       {(1<<6), "layers", 6},
+       {(1<<7), "layers", 7},
+       {(1<<8), "layers", 8},
+       {(1<<9), "layers", 9},
+       {(1<<10), "layers", 10},
+       {(1<<11), "layers", 11},
+       {(1<<12), "layers", 12},
+       {(1<<13), "layers", 13},
+       {(1<<14), "layers", 14},
+       {(1<<15), "layers", 15},
+       {(1<<16), "layers", 16},
+       {(1<<17), "layers", 17},
+       {(1<<18), "layers", 18},
+       {(1<<19), "layers", 19}
 };
 
 /* Material mode */
@@ -192,7 +177,7 @@ static AdrBit2Path *adrcode_bitmaps_to_paths (int blocktype, int adrcode, int *t
 /* ADRCODE to RNA-Path Conversion Code  - Standard */
 
 /* Object types */
-static char *ob_adrcodes_to_paths (int adrcode, int *array_index)
+static const char *ob_adrcodes_to_paths (int adrcode, int *array_index)
 {
        /* set array index like this in-case nothing sets it correctly  */
        *array_index= 0;
@@ -213,17 +198,17 @@ static char *ob_adrcodes_to_paths (int adrcode, int *array_index)
                        *array_index= 2; return "delta_location";
                
                case OB_ROT_X:
-                       *array_index= 0; return "rotation";
+                       *array_index= 0; return "rotation_euler";
                case OB_ROT_Y:
-                       *array_index= 1; return "rotation";
+                       *array_index= 1; return "rotation_euler";
                case OB_ROT_Z:
-                       *array_index= 2; return "rotation";
+                       *array_index= 2; return "rotation_euler";
                case OB_DROT_X:
-                       *array_index= 0; return "delta_rotation";
+                       *array_index= 0; return "delta_rotation_euler";
                case OB_DROT_Y:
-                       *array_index= 1; return "delta_rotation";
+                       *array_index= 1; return "delta_rotation_euler";
                case OB_DROT_Z:
-                       *array_index= 2; return "delta_rotation";
+                       *array_index= 2; return "delta_rotation_euler";
                        
                case OB_SIZE_X:
                        *array_index= 0; return "scale";
@@ -273,7 +258,7 @@ static char *ob_adrcodes_to_paths (int adrcode, int *array_index)
 /* PoseChannel types 
  * NOTE: pchan name comes from 'actname' added earlier... 
  */
-static char *pchan_adrcodes_to_paths (int adrcode, int *array_index)
+static const char *pchan_adrcodes_to_paths (int adrcode, int *array_index)
 {
        /* set array index like this in-case nothing sets it correctly  */
        *array_index= 0;
@@ -281,24 +266,21 @@ static char *pchan_adrcodes_to_paths (int adrcode, int *array_index)
        /* result depends on adrcode */
        switch (adrcode) {
                case AC_QUAT_W:
-                       *array_index= 0; return "rotation";
+                       *array_index= 0; return "rotation_quaternion";
                case AC_QUAT_X:
-                       *array_index= 1; return "rotation";
+                       *array_index= 1; return "rotation_quaternion";
                case AC_QUAT_Y:
-                       *array_index= 2; return "rotation";
+                       *array_index= 2; return "rotation_quaternion";
                case AC_QUAT_Z:
-                       *array_index= 3; return "rotation";
+                       *array_index= 3; return "rotation_quaternion";
                        
                case AC_EUL_X:
-                       *array_index= 0; return "euler_rotation";
+                       *array_index= 0; return "rotation_euler";
                case AC_EUL_Y:
-                       *array_index= 1; return "euler_rotation";
+                       *array_index= 1; return "rotation_euler";
                case AC_EUL_Z:
-                       *array_index= 2; return "euler_rotation";
-                       
-               case -1: /* special case for euler-rotations used by old drivers */
-                       *array_index= 0; return "euler_rotation";
-                       
+                       *array_index= 2; return "rotation_euler";
+               
                case AC_LOC_X:
                        *array_index= 0; return "location";
                case AC_LOC_Y:
@@ -320,7 +302,7 @@ static char *pchan_adrcodes_to_paths (int adrcode, int *array_index)
 }
 
 /* Constraint types */
-static char *constraint_adrcodes_to_paths (int adrcode, int *array_index)
+static const char *constraint_adrcodes_to_paths (int adrcode, int *array_index)
 {
        /* set array index like this in-case nothing sets it correctly  */
        *array_index= 0;
@@ -338,9 +320,9 @@ static char *constraint_adrcodes_to_paths (int adrcode, int *array_index)
 
 /* ShapeKey types 
  * NOTE: as we don't have access to the keyblock where the data comes from (for now), 
- *             we'll just use numerical indicies for now... 
+ *             we'll just use numerical indices for now... 
  */
-static char *shapekey_adrcodes_to_paths (int adrcode, int *array_index)
+static char *shapekey_adrcodes_to_paths (int adrcode, int *UNUSED(array_index))
 {
        static char buf[128];
        
@@ -354,9 +336,9 @@ static char *shapekey_adrcodes_to_paths (int adrcode, int *array_index)
 }
 
 /* MTex (Texture Slot) types */
-static char *mtex_adrcodes_to_paths (int adrcode, int *array_index)
+static const char *mtex_adrcodes_to_paths (int adrcode, int *UNUSED(array_index))
 {
-       char *base=NULL, *prop=NULL;
+       const char *base=NULL, *prop=NULL;
        static char buf[128];
        
        /* base part of path */
@@ -424,7 +406,7 @@ static char *mtex_adrcodes_to_paths (int adrcode, int *array_index)
 }
 
 /* Texture types */
-static char *texture_adrcodes_to_paths (int adrcode, int *array_index)
+static const char *texture_adrcodes_to_paths (int adrcode, int *array_index)
 {
        /* set array index like this in-case nothing sets it correctly  */
        *array_index= 0;
@@ -504,7 +486,7 @@ static char *texture_adrcodes_to_paths (int adrcode, int *array_index)
 }
 
 /* Material Types */
-static char *material_adrcodes_to_paths (int adrcode, int *array_index)
+static const char *material_adrcodes_to_paths (int adrcode, int *array_index)
 {
        /* set array index like this in-case nothing sets it correctly  */
        *array_index= 0;
@@ -588,7 +570,7 @@ static char *material_adrcodes_to_paths (int adrcode, int *array_index)
 }
 
 /* Camera Types */
-static char *camera_adrcodes_to_paths (int adrcode, int *array_index)
+static const char *camera_adrcodes_to_paths (int adrcode, int *array_index)
 {
        /* set array index like this in-case nothing sets it correctly  */
        *array_index= 0;
@@ -601,8 +583,9 @@ static char *camera_adrcodes_to_paths (int adrcode, int *array_index)
                                return "ortho_scale";
                        else
                                return "lens"; 
+#else // XXX lazy hack for now...
+                       return "lens";
 #endif // XXX this cannot be resolved easily
-                       break;
                        
                case CAM_STA:
                        return "clip_start";
@@ -627,7 +610,7 @@ static char *camera_adrcodes_to_paths (int adrcode, int *array_index)
 }
 
 /* Lamp Types */
-static char *lamp_adrcodes_to_paths (int adrcode, int *array_index)
+static const char *lamp_adrcodes_to_paths (int adrcode, int *array_index)
 {
        /* set array index like this in-case nothing sets it correctly  */
        *array_index= 0;
@@ -669,7 +652,7 @@ static char *lamp_adrcodes_to_paths (int adrcode, int *array_index)
 }
 
 /* Sound Types */
-static char *sound_adrcodes_to_paths (int adrcode, int *array_index)
+static const char *sound_adrcodes_to_paths (int adrcode, int *array_index)
 {
        /* set array index like this in-case nothing sets it correctly  */
        *array_index= 0;
@@ -692,7 +675,7 @@ static char *sound_adrcodes_to_paths (int adrcode, int *array_index)
 }
 
 /* World Types */
-static char *world_adrcodes_to_paths (int adrcode, int *array_index)
+static const char *world_adrcodes_to_paths (int adrcode, int *array_index)
 {
        /* set array index like this in-case nothing sets it correctly  */
        *array_index= 0;
@@ -731,6 +714,11 @@ static char *world_adrcodes_to_paths (int adrcode, int *array_index)
                        *array_index= 1; return "stars.color";
                case WO_STAR_B:
                        *array_index= 2; return "stars.color"; */
+               case WO_STAR_R:
+               case WO_STAR_G:
+               case WO_STAR_B:
+                       printf("WARNING: WO_STAR_R/G/B deprecated\n");
+                       return NULL;
                
                case WO_STARDIST:
                        return "stars.min_distance";
@@ -745,7 +733,7 @@ static char *world_adrcodes_to_paths (int adrcode, int *array_index)
 }
 
 /* Particle Types */
-static char *particle_adrcodes_to_paths (int adrcode, int *array_index)
+static const char *particle_adrcodes_to_paths (int adrcode, int *array_index)
 {
        /* set array index like this in-case nothing sets it correctly  */
        *array_index= 0;
@@ -815,15 +803,16 @@ static char *particle_adrcodes_to_paths (int adrcode, int *array_index)
 /* Allocate memory for RNA-path for some property given a blocktype, adrcode, and 'root' parts of path
  *     Input:
  *             - blocktype, adrcode    - determines setting to get
- *             - actname, constname    - used to build path
+ *             - actname, constname,seq - used to build path
  *     Output:
  *             - array_index                   - index in property's array (if applicable) to use
  *             - return                                - the allocated path...
  */
-static char *get_rna_access (int blocktype, int adrcode, char actname[], char constname[], int *array_index)
+static char *get_rna_access (int blocktype, int adrcode, char actname[], char constname[], Sequence *seq, int *array_index)
 {
        DynStr *path= BLI_dynstr_new();
-       char *propname=NULL, *rpath=NULL;
+       const char *propname=NULL;
+       char *rpath=NULL;
        char buf[512];
        int dummy_index= 0;
        
@@ -867,23 +856,37 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
                
                case ID_SO: /* sound */
                        propname= sound_adrcodes_to_paths(adrcode, &dummy_index);
+                       break;
                
                case ID_WO: /* world */
                        propname= world_adrcodes_to_paths(adrcode, &dummy_index);
-
+                       break;
+               
                case ID_PA: /* particle */
                        propname= particle_adrcodes_to_paths(adrcode, &dummy_index);
+                       break;
                        
-               /* XXX problematic blocktypes */
                case ID_CU: /* curve */
                        /* this used to be a 'dummy' curve which got evaluated on the fly... 
                         * now we've got real var for this!
                         */
                        propname= "eval_time";
                        break;
-                       
+               
+               /* XXX problematic blocktypes */                
                case ID_SEQ: /* sequencer strip */
                        //SEQ_FAC1:
+                       switch (adrcode) {
+                       case SEQ_FAC1:
+                               propname= "effect_fader";
+                               break;
+                       case SEQ_FAC_SPEED:
+                               propname= "speed_fader";
+                               break;
+                       case SEQ_FAC_OPACITY:
+                               propname= "blend_opacity";
+                               break;
+                       }
                        //      poin= &(seq->facf0); // XXX this doesn't seem to be included anywhere in sequencer RNA...
                        break;
                        
@@ -915,31 +918,47 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
                        *array_index= dummy_index;
        }
        
-       /* append preceeding bits to path */
+       /* append preceding bits to path */
        if ((actname && actname[0]) && (constname && constname[0])) {
                /* Constraint in Pose-Channel */
-               sprintf(buf, "pose.pose_channels[\"%s\"].constraints[\"%s\"]", actname, constname);
+               sprintf(buf, "pose.bones[\"%s\"].constraints[\"%s\"]", actname, constname);
        }
        else if (actname && actname[0]) {
-               /* Pose-Channel */
-               sprintf(buf, "pose.pose_channels[\"%s\"]", actname);
+               if ((blocktype == ID_OB) && strcmp(actname, "Object")==0) {
+                       /* Actionified "Object" IPO's... no extra path stuff needed */
+               }
+               else if ((blocktype == ID_KE) && strcmp(actname, "Shape")==0) {
+                       /* Actionified "Shape" IPO's - these are forced onto object level via the action container there... */
+                       strcpy(buf, "data.shape_keys");
+               }
+               else {
+                       /* Pose-Channel */
+                       sprintf(buf, "pose.bones[\"%s\"]", actname);
+               }
        }
        else if (constname && constname[0]) {
                /* Constraint in Object */
                sprintf(buf, "constraints[\"%s\"]", constname);
        }
+       else if (seq) {
+               /* Sequence names in Scene */
+               sprintf(buf, "sequence_editor.sequences_all[\"%s\"]", seq->name+2);
+       }
        else
                strcpy(buf, ""); /* empty string */
        BLI_dynstr_append(path, buf);
        
-       /* append property to path (only if applicable) */
-       if (blocktype > 0) {
-               /* need to add dot before property if there was anything precceding this */
-               if (buf[0])
-                       BLI_dynstr_append(path, ".");
-               
-               /* now write name of property */
-               BLI_dynstr_append(path, propname);
+       /* need to add dot before property if there was anything precceding this */
+       if (buf[0])
+               BLI_dynstr_append(path, ".");
+       
+       /* now write name of property */
+       BLI_dynstr_append(path, propname);
+       
+       /* if there was no array index pointer provided, add it to the path */
+       if (array_index == NULL) {
+               sprintf(buf, "[\"%d\"]", dummy_index);
+               BLI_dynstr_append(path, buf);
        }
        
        /* convert to normal MEM_malloc'd string */
@@ -953,11 +972,40 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
 /* *************************************************** */
 /* Conversion Utilities */
 
+/* Convert adrcodes to driver target transform channel types */
+static short adrcode_to_dtar_transchan (short adrcode)
+{
+       switch (adrcode) {
+               case OB_LOC_X:  
+                       return DTAR_TRANSCHAN_LOCX;
+               case OB_LOC_Y:
+                       return DTAR_TRANSCHAN_LOCY;
+               case OB_LOC_Z:
+                       return DTAR_TRANSCHAN_LOCZ;
+               
+               case OB_ROT_X:  
+                       return DTAR_TRANSCHAN_ROTX;
+               case OB_ROT_Y:
+                       return DTAR_TRANSCHAN_ROTY;
+               case OB_ROT_Z:
+                       return DTAR_TRANSCHAN_ROTZ;
+               
+               case OB_SIZE_X: 
+                       return DTAR_TRANSCHAN_SCALEX;
+               case OB_SIZE_Y:
+                       return DTAR_TRANSCHAN_SCALEX;
+               case OB_SIZE_Z:
+                       return DTAR_TRANSCHAN_SCALEX;
+                       
+               default:
+                       return 0;
+       }
+}
+
 /* Convert IpoDriver to ChannelDriver - will free the old data (i.e. the old driver) */
 static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
 {
        ChannelDriver *cdriver;
-       DriverTarget *dtar=NULL, *dtar2=NULL;
        
        /* allocate memory for new driver */
        cdriver= MEM_callocN(sizeof(ChannelDriver), "ChannelDriver");
@@ -965,92 +1013,63 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
        /* if 'pydriver', just copy data across */
        if (idriver->type == IPO_DRIVER_TYPE_PYTHON) {
                /* PyDriver only requires the expression to be copied */
-               // TODO: but the expression will be useless...
+               // FIXME: expression will be useless due to API changes, but at least not totally lost
                cdriver->type = DRIVER_TYPE_PYTHON;
-               strcpy(cdriver->expression, idriver->name); // XXX is this safe? 
+               if (idriver->name[0])
+                       BLI_strncpy(cdriver->expression, idriver->name, sizeof(cdriver->expression));
        }
        else {
-               /* what to store depends on the 'blocktype' (ID_OB or ID_PO - object or posechannel) */
-               if (idriver->blocktype == ID_AR) {
-                       /* ID_PO */
+               DriverVar *dvar = NULL;
+               DriverTarget *dtar = NULL;
+               
+               /* this should be ok for all types here... */
+               cdriver->type= DRIVER_TYPE_AVERAGE;
+               
+               /* what to store depends on the 'blocktype' - object or posechannel */
+               if (idriver->blocktype == ID_AR) { /* PoseChannel */
                        if (idriver->adrcode == OB_ROT_DIFF) {
-                               /* Rotational Difference is a special type of driver now... */
-                               cdriver->type= DRIVER_TYPE_ROTDIFF;
-                               
-                               /* make 2 driver targets */
-                               dtar= driver_add_new_target(cdriver);
-                               dtar2= driver_add_new_target(cdriver);
+                               /* Rotational Difference requires a special type of variable */
+                               dvar= driver_add_new_variable(cdriver);
+                               driver_change_variable_type(dvar, DVAR_TYPE_ROT_DIFF);
                                
-                               /* driver must use bones from same armature... */
-                               dtar->id= dtar2->id= (ID *)idriver->ob;
+                                       /* first bone target */
+                               dtar= &dvar->targets[0];
+                               dtar->id= (ID *)idriver->ob;
+                               if (idriver->name[0])
+                                       BLI_strncpy(dtar->pchan_name, idriver->name, sizeof(dtar->pchan_name));
                                
-                               /* paths for the two targets get the pointers to the relevant Pose-Channels 
-                                *      - return pointers to Pose-Channels not rotation channels, as calculation code is picky
-                                *      - old bone names were stored in same var, in idriver->name
-                                *
-                                *      - we use several hacks here - blocktype == -1 specifies that no property needs to be found, and
-                                *        providing a name for 'actname' will automatically imply Pose-Channel with name 'actname'
-                                */
-                               dtar->rna_path= get_rna_access(-1, -1, idriver->name, NULL, NULL);
-                               dtar2->rna_path= get_rna_access(-1, -1, idriver->name+DRIVER_NAME_OFFS, NULL, NULL);
+                                       /* second bone target (name was stored in same var as the first one) */
+                               dtar= &dvar->targets[1];
+                               dtar->id= (ID *)idriver->ob;
+                               if (idriver->name[0]) // xxx... for safety
+                                       BLI_strncpy(dtar->pchan_name, idriver->name+DRIVER_NAME_OFFS, sizeof(dtar->pchan_name));
                        }
                        else {
-                               /* 'standard' driver */
-                               cdriver->type= DRIVER_TYPE_AVERAGE;
+                               /* only a single variable, of type 'transform channel' */
+                               dvar= driver_add_new_variable(cdriver);
+                               driver_change_variable_type(dvar, DVAR_TYPE_TRANSFORM_CHAN);
                                
-                               /* make 1 driver target */
-                               dtar= driver_add_new_target(cdriver);
+                               /* only requires a single target */
+                               dtar= &dvar->targets[0];
                                dtar->id= (ID *)idriver->ob;
-                               
-                               switch (idriver->adrcode) {
-                                       case OB_LOC_X:  /* x,y,z location are quite straightforward */
-                                               dtar->rna_path= get_rna_access(ID_PO, AC_LOC_X, idriver->name, NULL, &dtar->array_index);
-                                               break;
-                                       case OB_LOC_Y:
-                                               dtar->rna_path= get_rna_access(ID_PO, AC_LOC_Y, idriver->name, NULL, &dtar->array_index);
-                                               break;
-                                       case OB_LOC_Z:
-                                               dtar->rna_path= get_rna_access(ID_PO, AC_LOC_Z, idriver->name, NULL, &dtar->array_index);
-                                               break;
-                                               
-                                       case OB_SIZE_X: /* x,y,z scaling are also quite straightforward */
-                                               dtar->rna_path= get_rna_access(ID_PO, AC_SIZE_X, idriver->name, NULL, &dtar->array_index);
-                                               break;
-                                       case OB_SIZE_Y:
-                                               dtar->rna_path= get_rna_access(ID_PO, AC_SIZE_Y, idriver->name, NULL, &dtar->array_index);
-                                               break;
-                                       case OB_SIZE_Z:
-                                               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... */     
-                                       case OB_ROT_Y:
-                                       case OB_ROT_Z:
-                                       {
-                                               /* -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;
-                                       }
-                                               break;
-                               }
+                               if (idriver->name[0])
+                                       BLI_strncpy(dtar->pchan_name, idriver->name, sizeof(dtar->pchan_name));
+                               dtar->transChan= adrcode_to_dtar_transchan(idriver->adrcode);
+                               dtar->flag |= DTAR_FLAG_LOCALSPACE; /* old drivers took local space */
                        }
                }
-               else {
-                       /* ID_OB */
-                       cdriver->type= DRIVER_TYPE_AVERAGE;
-                       
-                       /* make 1 driver target */
-                       dtar= driver_add_new_target(cdriver);
+               else { /* Object */
+                       /* only a single variable, of type 'transform channel' */
+                       dvar= driver_add_new_variable(cdriver);
+                       driver_change_variable_type(dvar, DVAR_TYPE_TRANSFORM_CHAN);
                        
+                               /* only requires single target */
+                       dtar= &dvar->targets[0];
                        dtar->id= (ID *)idriver->ob;
-                       dtar->rna_path= get_rna_access(ID_OB, idriver->adrcode, NULL, NULL, &dtar->array_index);
+                       dtar->transChan= adrcode_to_dtar_transchan(idriver->adrcode);
                }
        }
        
-       
-       /* free old driver */
-       MEM_freeN(idriver);
-       
        /* return the new one */
        return cdriver;
 }
@@ -1058,7 +1077,7 @@ static ChannelDriver *idriver_to_cdriver (IpoDriver *idriver)
 /* Add F-Curve to the correct list 
  *     - grpname is needed to be used as group name where relevant, and is usually derived from actname
  */
-static void fcurve_add_to_list (ListBase *groups, ListBase *list, FCurve *fcu, char *grpname)
+static void fcurve_add_to_list (ListBase *groups, ListBase *list, FCurve *fcu, char *grpname, int muteipo)
 {
        /* If we're adding to an action, we will have groups to write to... */
        if (groups && grpname) {
@@ -1069,7 +1088,7 @@ static void fcurve_add_to_list (ListBase *groups, ListBase *list, FCurve *fcu, c
                bActionGroup *agrp= NULL;
                
                /* init the temp action */
-               //memset(&tmp_act, 0, sizeof(bAction)); // XXX only enable this line if we get errors
+               memset(&tmp_act, 0, sizeof(bAction)); // XXX only enable this line if we get errors
                tmp_act.groups.first= groups->first;
                tmp_act.groups.last= groups->last;
                tmp_act.curves.first= list->first;
@@ -1085,10 +1104,12 @@ static void fcurve_add_to_list (ListBase *groups, ListBase *list, FCurve *fcu, c
                                agrp= MEM_callocN(sizeof(bActionGroup), "bActionGroup");
                                
                                agrp->flag = AGRP_SELECTED;
-                               BLI_snprintf(agrp->name, 64, grpname);
+                               if (muteipo) agrp->flag |= AGRP_MUTED;
+                               
+                               strncpy(agrp->name, grpname, sizeof(agrp->name));
                                
                                BLI_addtail(&tmp_act.groups, agrp);
-                               BLI_uniquename(&tmp_act.groups, agrp, "Group", '.', offsetof(bActionGroup, name), 64);
+                               BLI_uniquename(&tmp_act.groups, agrp, "Group", '.', offsetof(bActionGroup, name), sizeof(agrp->name));
                        }
                }
                
@@ -1096,6 +1117,9 @@ static void fcurve_add_to_list (ListBase *groups, ListBase *list, FCurve *fcu, c
                /* WARNING: this func should only need to look at the stuff we initialised, if not, things may crash */
                action_groups_add_channel(&tmp_act, agrp, fcu);
                
+               if (agrp->flag & AGRP_MUTED) /* flush down */
+                       fcu->flag |= FCURVE_MUTED;
+               
                /* set the output lists based on the ones in the temp action */
                groups->first= tmp_act.groups.first;
                groups->last= tmp_act.groups.last;
@@ -1112,21 +1136,20 @@ static void fcurve_add_to_list (ListBase *groups, ListBase *list, FCurve *fcu, c
  * is not relevant, BUT do not free the IPO-Curve itself...
  *     actname: name of Action-Channel (if applicable) that IPO-Curve's IPO-block belonged to
  *     constname: name of Constraint-Channel (if applicable) that IPO-Curve's IPO-block belonged to
+ *      seq: sequencer-strip (if applicable) that IPO-Curve's IPO-block belonged to
  */
-static void icu_to_fcurves (ListBase *groups, ListBase *list, IpoCurve *icu, char *actname, char *constname)
+static void icu_to_fcurves (ID *id, ListBase *groups, ListBase *list, IpoCurve *icu, char *actname, char *constname, Sequence * seq, int muteipo)
 {
        AdrBit2Path *abp;
        FCurve *fcu;
-       int i=0, totbits;
+       int totbits;
        
        /* allocate memory for a new F-Curve */
        fcu= MEM_callocN(sizeof(FCurve), "FCurve");
        
-       /* convert driver - will free the old one... */
-       if (icu->driver) {
+       /* convert driver */
+       if (icu->driver)
                fcu->driver= idriver_to_cdriver(icu->driver);
-               icu->driver= NULL;
-       }
        
        /* copy flags */
        if (icu->flag & IPO_VISIBLE) fcu->flag |= FCURVE_VISIBLE;
@@ -1184,6 +1207,8 @@ static void icu_to_fcurves (ListBase *groups, ListBase *list, IpoCurve *icu, cha
                 * 3) filter the keyframes for the flag of interest
                 */
                for (b=0; b < totbits; b++, abp++) {
+                       unsigned int i=0;
+                       
                        /* make a copy of existing base-data if not the last curve */
                        if (b < (totbits-1))
                                fcurve= copy_fcurve(fcu);
@@ -1191,7 +1216,7 @@ static void icu_to_fcurves (ListBase *groups, ListBase *list, IpoCurve *icu, cha
                                fcurve= fcu;
                                
                        /* set path */
-                       fcurve->rna_path= BLI_strdupn(abp->path, strlen(abp->path));
+                       fcurve->rna_path= BLI_strdup(abp->path);
                        fcurve->array_index= abp->array_index;
                        
                        /* convert keyframes 
@@ -1207,7 +1232,7 @@ static void icu_to_fcurves (ListBase *groups, ListBase *list, IpoCurve *icu, cha
                                fcurve->bezt= MEM_callocN(sizeof(BezTriple)*fcurve->totvert, "BezTriples");
                                
                                /* loop through copying all BezTriples individually, as we need to modify a few things */
-                               for (dst=fcurve->bezt, src=icu->bezt; i < fcurve->totvert; i++, dst++, src++) {
+                               for (dst=fcurve->bezt, src=icu->bezt, i=0; i < fcurve->totvert; i++, dst++, src++) {
                                        /* firstly, copy BezTriple data */
                                        *dst= *src;
                                        
@@ -1231,18 +1256,16 @@ static void icu_to_fcurves (ListBase *groups, ListBase *list, IpoCurve *icu, cha
                        }
                        
                        /* add new F-Curve to list */
-                       fcurve_add_to_list(groups, list, fcurve, actname);
+                       fcurve_add_to_list(groups, list, fcurve, actname, muteipo);
                }
-               
-               /* free old data of curve now that it's no longer needed for converting any more curves */
-               if (icu->bezt) MEM_freeN(icu->bezt);
-               if (icu->bp) MEM_freeN(icu->bezt);
        }
        else {
+               unsigned int i=0;
+               
                /* get rna-path
                 *      - we will need to set the 'disabled' flag if no path is able to be made (for now)
                 */
-               fcu->rna_path= get_rna_access(icu->blocktype, icu->adrcode, actname, constname, &fcu->array_index);
+               fcu->rna_path= get_rna_access(icu->blocktype, icu->adrcode, actname, constname, seq, &fcu->array_index);
                if (fcu->rna_path == NULL)
                        fcu->flag |= FCURVE_DISABLED;
                
@@ -1259,7 +1282,7 @@ static void icu_to_fcurves (ListBase *groups, ListBase *list, IpoCurve *icu, cha
                        fcu->bezt= MEM_callocN(sizeof(BezTriple)*fcu->totvert, "BezTriples");
                        
                        /* loop through copying all BezTriples individually, as we need to modify a few things */
-                       for (dst=fcu->bezt, src=icu->bezt; i < fcu->totvert; i++, dst++, src++) {
+                       for (dst=fcu->bezt, src=icu->bezt, i=0; i < fcu->totvert; i++, dst++, src++) {
                                /* firstly, copy BezTriple data */
                                *dst= *src;
                                
@@ -1270,8 +1293,10 @@ static void icu_to_fcurves (ListBase *groups, ListBase *list, IpoCurve *icu, cha
                                /* 'hide' flag is now used for keytype - only 'keyframes' existed before */
                                dst->hide= BEZT_KEYTYPE_KEYFRAME;
                                        
-                               /* correct values for euler rotation curves - they were degrees/10 */
-                               // XXX for now, just make them into radians as RNA sets/reads directly in that form
+                               /* correct values for euler rotation curves 
+                                *      - they were degrees/10 
+                                *      - we need radians for RNA to do the right thing
+                                */
                                if ( ((icu->blocktype == ID_OB) && ELEM3(icu->adrcode, OB_ROT_X, OB_ROT_Y, OB_ROT_Z)) ||
                                         ((icu->blocktype == ID_PO) && ELEM3(icu->adrcode, AC_EUL_X, AC_EUL_Y, AC_EUL_Z)) )
                                {
@@ -1282,29 +1307,53 @@ static void icu_to_fcurves (ListBase *groups, ListBase *list, IpoCurve *icu, cha
                                        dst->vec[2][1] *= fac;
                                }
                                
+                               /* correct values for path speed curves 
+                                *      - their values were 0-1
+                                *      - we now need as 'frames'
+                                */
+                               if ( (id) && (icu->blocktype == GS(id->name)) && 
+                                        (fcu->rna_path && strcmp(fcu->rna_path, "eval_time")==0) )
+                               {
+                                       Curve *cu = (Curve *)id;
+                                       
+                                       dst->vec[0][1] *= cu->pathlen;
+                                       dst->vec[1][1] *= cu->pathlen;
+                                       dst->vec[2][1] *= cu->pathlen;
+                               }
+                               
                                /* correct times for rotation drivers 
                                 *      - need to go from degrees to radians...
                                 *      - there's only really 1 target to worry about 
+                                *  - were also degrees/10
                                 */
-                               if (fcu->driver && fcu->driver->targets.first) {
-                                       DriverTarget *dtar= fcu->driver->targets.first;
+                               if (fcu->driver && fcu->driver->variables.first) {
+                                       DriverVar *dvar= fcu->driver->variables.first;
+                                       DriverTarget *dtar= &dvar->targets[0];
                                        
-                                       /* 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;
+                                       if (ELEM3(dtar->transChan, DTAR_TRANSCHAN_ROTX, DTAR_TRANSCHAN_ROTY, DTAR_TRANSCHAN_ROTZ)) {
+                                               const float fac= (float)M_PI / 18.0f;
                                                
                                                dst->vec[0][0] *= fac;
                                                dst->vec[1][0] *= fac;
                                                dst->vec[2][0] *= fac;
                                        }
                                }
+                               
+                               /* correct values for sequencer curves, that were not locked to frame */
+                               if (seq && (seq->flag & SEQ_IPO_FRAME_LOCKED) == 0) {
+                                       double mul= (seq->enddisp-seq->startdisp)/100.0f;
+                                       double offset= seq->startdisp;
+                                       
+                                       dst->vec[0][0] *= mul;
+                                       dst->vec[0][0] += offset;
+                                       
+                                       dst->vec[1][0] *= mul;
+                                       dst->vec[1][0] += offset;
+                                       
+                                       dst->vec[2][0] *= mul;
+                                       dst->vec[2][0] += offset;
+                               }
                        }
-                       
-                       /* free this data now */
-                       MEM_freeN(icu->bezt);
                }
                else if (icu->bp) {
                        /* TODO: need to convert from BPoint type to the more compact FPoint type... but not priority, since no data used this */
@@ -1313,7 +1362,7 @@ static void icu_to_fcurves (ListBase *groups, ListBase *list, IpoCurve *icu, cha
                }
                
                /* add new F-Curve to list */
-               fcurve_add_to_list(groups, list, fcu, actname);
+               fcurve_add_to_list(groups, list, fcu, actname, muteipo);
        }
 }
 
@@ -1323,9 +1372,9 @@ static void icu_to_fcurves (ListBase *groups, ListBase *list, IpoCurve *icu, cha
  * This does not assume that any ID or AnimData uses it, but does assume that
  * it is given two lists, which it will perform driver/animation-data separation.
  */
-static void ipo_to_animato (Ipo *ipo, char actname[], char constname[], ListBase *animgroups, ListBase *anim, ListBase *drivers)
+static void ipo_to_animato (ID *id, Ipo *ipo, char actname[], char constname[], Sequence * seq, ListBase *animgroups, ListBase *anim, ListBase *drivers)
 {
-       IpoCurve *icu, *icn;
+       IpoCurve *icu;
        
        /* sanity check */
        if (ELEM3(NULL, ipo, anim, drivers))
@@ -1347,25 +1396,44 @@ static void ipo_to_animato (Ipo *ipo, char actname[], char constname[], ListBase
        }
        
        /* loop over IPO-Curves, freeing as we progress */
-       for (icu= ipo->curve.first; icu; icu= icn) {
-               /* get link to next (for later) */
-               icn= icu->next;
-               
+       for (icu= ipo->curve.first; icu; icu= icu->next) {
                /* Since an IPO-Curve may end up being made into many F-Curves (i.e. bitflag curves), 
                 * we figure out the best place to put the channel, then tell the curve-converter to just dump there
                 */
                if (icu->driver) {
                        /* Blender 2.4x allowed empty drivers, but we don't now, since they cause more trouble than they're worth */
-                       if ((icu->driver->ob) || (icu->driver->type == IPO_DRIVER_TYPE_PYTHON))
-                               icu_to_fcurves(NULL, drivers, icu, actname, constname);
-                       else
+                       if ((icu->driver->ob) || (icu->driver->type == IPO_DRIVER_TYPE_PYTHON)) {
+                               icu_to_fcurves(id, NULL, drivers, icu, actname, constname, seq, ipo->muteipo);
+                       }
+                       else {
                                MEM_freeN(icu->driver);
+                               icu->driver= NULL;
+                       }
                }
                else
-                       icu_to_fcurves(animgroups, anim, icu, actname, constname);
+                       icu_to_fcurves(id, animgroups, anim, icu, actname, constname, seq, ipo->muteipo);
+       }
+       
+       /* if this IPO block doesn't have any users after this one, free... */
+       ipo->id.us--;
+       if ( (ipo->id.us == 0) || ((ipo->id.us == 1) && (ipo->id.flag & LIB_FAKEUSER)) ) 
+       {
+               IpoCurve *icn;
                
-               /* free this IpoCurve now that it's been converted */
-               BLI_freelinkN(&ipo->curve, icu);
+               for (icu= ipo->curve.first; icu; icu= icn) {
+                       icn= icu->next;
+                       
+                       /* free driver */
+                       if (icu->driver)
+                               MEM_freeN(icu->driver);
+                               
+                       /* free old data of curve now that it's no longer needed for converting any more curves */
+                       if (icu->bezt) MEM_freeN(icu->bezt);
+                       if (icu->bp) MEM_freeN(icu->bezt);
+                       
+                       /* free this IPO-Curve */
+                       BLI_freelinkN(&ipo->curve, icu);
+               }
        }
 }
 
@@ -1374,7 +1442,7 @@ static void ipo_to_animato (Ipo *ipo, char actname[], char constname[], ListBase
  * to Objects, where ob->ipo and ob->action need to be combined).
  * NOTE: we need to be careful here, as same data-structs are used for new system too!
  */
-static void action_to_animato (bAction *act, ListBase *groups, ListBase *curves, ListBase *drivers)
+static void action_to_animato (ID *id, bAction *act, ListBase *groups, ListBase *curves, ListBase *drivers)
 {
        bActionChannel *achan, *achann;
        bConstraintChannel *conchan, *conchann;
@@ -1395,7 +1463,7 @@ static void action_to_animato (bAction *act, ListBase *groups, ListBase *curves,
                
                /* convert Action Channel's IPO data */
                if (achan->ipo) {
-                       ipo_to_animato(achan->ipo, achan->name, NULL, groups, curves, drivers);
+                       ipo_to_animato(id, achan->ipo, achan->name, NULL, NULL, groups, curves, drivers);
                        achan->ipo->id.us--;
                        achan->ipo= NULL;
                }
@@ -1407,7 +1475,7 @@ static void action_to_animato (bAction *act, ListBase *groups, ListBase *curves,
                        
                        /* convert Constraint Channel's IPO data */
                        if (conchan->ipo) {
-                               ipo_to_animato(conchan->ipo, achan->name, conchan->name, groups, curves, drivers);
+                               ipo_to_animato(id, conchan->ipo, achan->name, conchan->name, NULL, groups, curves, drivers);
                                conchan->ipo->id.us--;
                                conchan->ipo= NULL;
                        }
@@ -1428,7 +1496,7 @@ static void action_to_animato (bAction *act, ListBase *groups, ListBase *curves,
  * This assumes that AnimData has been added already. Separation of drivers
  * from animation data is accomplished here too...
  */
-static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[])
+static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[], Sequence *seq)
 {
        AnimData *adt= BKE_animdata_from_id(id);
        ListBase anim = {NULL, NULL};
@@ -1443,8 +1511,8 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[])
        }
        
        if (G.f & G_DEBUG) {
-               printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s  curves:%d \n", 
-                       id->name+2, ipo->id.name+2, (actname)?actname:"<None>", (constname)?constname:"<None>", 
+               printf("ipo to animdata - ID:%s, IPO:%s, actname:%s constname:%s seqname:%s  curves:%d \n", 
+                      id->name+2, ipo->id.name+2, (actname)?actname:"<None>", (constname)?constname:"<None>", (seq)?(seq->name+2):"<None>",
                        BLI_countlist(&ipo->curve));
        }
        
@@ -1452,26 +1520,30 @@ static void ipo_to_animdata (ID *id, Ipo *ipo, char actname[], char constname[])
         * and the try to put these lists in the right places, but do not free the lists here
         */
        // XXX there shouldn't be any need for the groups, so don't supply pointer for that now... 
-       ipo_to_animato(ipo, actname, constname, NULL, &anim, &drivers);
+       ipo_to_animato(id, ipo, actname, constname, seq, NULL, &anim, &drivers);
        
        /* deal with animation first */
        if (anim.first) {
                if (G.f & G_DEBUG) printf("\thas anim \n");
                /* try to get action */
                if (adt->action == NULL) {
-                       adt->action= add_empty_action("ConvData_Action"); // XXX we need a better name for this
-                       if (G.f & G_DEBUG) printf("\t\tadded new action \n");
+                       char nameBuf[MAX_ID_NAME];
+                       
+                       BLI_snprintf(nameBuf, sizeof(nameBuf), "CDA:%s", ipo->id.name+2);
+                       
+                       adt->action= add_empty_action(nameBuf);
+                       if (G.f & G_DEBUG) printf("\t\tadded new action - '%s' \n", nameBuf);
                }
                
                /* add F-Curves to action */
-               addlisttolist(&adt->action->curves, &anim);
+               BLI_movelisttolist(&adt->action->curves, &anim);
        }
        
        /* deal with drivers */
        if (drivers.first) {
                if (G.f & G_DEBUG) printf("\thas drivers \n");
                /* add drivers to end of driver stack */
-               addlisttolist(&adt->drivers, &drivers);
+               BLI_movelisttolist(&adt->drivers, &drivers);
        }
 }
 
@@ -1494,7 +1566,7 @@ static void action_to_animdata (ID *id, bAction *act)
        }
        
        /* convert Action data */
-       action_to_animato(act, &adt->action->groups, &adt->action->curves, &adt->drivers);
+       action_to_animato(id, act, &adt->action->groups, &adt->action->curves, &adt->drivers);
 }
 
 /* ------------------------- */
@@ -1518,7 +1590,7 @@ static void nlastrips_to_animdata (ID *id, ListBase *strips)
                /* this old strip is only worth something if it had an action... */
                if (as->act) {
                        /* convert Action data (if not yet converted), storing the results in the same Action */
-                       action_to_animato(as->act, &as->act->groups, &as->act->curves, &adt->drivers);
+                       action_to_animato(id, as->act, &as->act->groups, &as->act->curves, &adt->drivers);
                        
                        /* create a new-style NLA-strip which references this Action, then copy over relevant settings */
                        {
@@ -1604,13 +1676,12 @@ void do_versions_ipos_to_animato(Main *main)
        }
                
        /* only convert if version is right */
-       // XXX???
        if (main->versionfile >= 250) {
                printf("WARNING: Animation data too new to convert (Version %d) \n", main->versionfile);
                return;
        }
-       else
-               printf("INFO: Converting to Animato... \n"); // xxx debug
+       else if (G.f & G_DEBUG)
+               printf("INFO: Converting to Animato... \n");
                
        /* ----------- Animation Attached to Data -------------- */
        
@@ -1630,7 +1701,7 @@ void do_versions_ipos_to_animato(Main *main)
                        
                        /* IPO first to take into any non-NLA'd Object Animation */
                        if (ob->ipo) {
-                               ipo_to_animdata(id, ob->ipo, NULL, NULL);
+                               ipo_to_animdata(id, ob->ipo, NULL, NULL, NULL);
                                
                                ob->ipo->id.us--;
                                ob->ipo= NULL;
@@ -1664,7 +1735,7 @@ void do_versions_ipos_to_animato(Main *main)
                        
                        /* IPO second... */
                        if (ob->ipo) {
-                               ipo_to_animdata(id, ob->ipo, NULL, NULL);
+                               ipo_to_animdata(id, ob->ipo, NULL, NULL, NULL);
                                ob->ipo->id.us--;
                                ob->ipo= NULL;
                        }
@@ -1684,7 +1755,7 @@ void do_versions_ipos_to_animato(Main *main)
                                                /* although this was the constraint's local IPO, we still need to provide pchan + con 
                                                 * so that drivers can be added properly...
                                                 */
-                                               ipo_to_animdata(id, con->ipo, pchan->name, con->name);
+                                               ipo_to_animdata(id, con->ipo, pchan->name, con->name, NULL);
                                                con->ipo->id.us--;
                                                con->ipo= NULL;
                                        }
@@ -1704,7 +1775,7 @@ void do_versions_ipos_to_animato(Main *main)
                                /* although this was the constraint's local IPO, we still need to provide con 
                                 * so that drivers can be added properly...
                                 */
-                               ipo_to_animdata(id, con->ipo, NULL, con->name);
+                               ipo_to_animdata(id, con->ipo, NULL, con->name, NULL);
                                con->ipo->id.us--;
                                con->ipo= NULL;
                        }
@@ -1724,7 +1795,7 @@ void do_versions_ipos_to_animato(Main *main)
                                
                                /* convert Constraint Channel's IPO data */
                                if (conchan->ipo) {
-                                       ipo_to_animdata(id, conchan->ipo, NULL, conchan->name);
+                                       ipo_to_animdata(id, conchan->ipo, NULL, conchan->name, NULL);
                                        conchan->ipo->id.us--;
                                        conchan->ipo= NULL;
                                }
@@ -1750,7 +1821,7 @@ void do_versions_ipos_to_animato(Main *main)
                        adt= BKE_id_add_animdata(id);
                        
                        /* Convert Shapekey data... */
-                       ipo_to_animdata(id, key->ipo, NULL, NULL);
+                       ipo_to_animdata(id, key->ipo, NULL, NULL, NULL);
                        key->ipo->id.us--;
                        key->ipo= NULL;
                }
@@ -1768,12 +1839,79 @@ void do_versions_ipos_to_animato(Main *main)
                        adt= BKE_id_add_animdata(id);
                        
                        /* Convert Material data... */
-                       ipo_to_animdata(id, ma->ipo, NULL, NULL);
+                       ipo_to_animdata(id, ma->ipo, NULL, NULL, NULL);
                        ma->ipo->id.us--;
                        ma->ipo= NULL;
                }
        }
        
+       /* worlds */
+       for (id= main->world.first; id; id= id->next) {
+               World *wo= (World *)id;
+               
+               if (G.f & G_DEBUG) printf("\tconverting world %s \n", id->name+2);
+               
+               /* we're only interested in the IPO */
+               if (wo->ipo) {
+                       /* Add AnimData block */
+                       adt= BKE_id_add_animdata(id);
+                       
+                       /* Convert World data... */
+                       ipo_to_animdata(id, wo->ipo, NULL, NULL, NULL);
+                       wo->ipo->id.us--;
+                       wo->ipo= NULL;
+               }
+       }
+       
+       /* sequence strips */
+       for (id= main->scene.first; id; id= id->next) {
+               Scene *scene = (Scene *)id;
+               Editing * ed = scene->ed;
+               if (ed && ed->seqbasep) {
+                       Sequence * seq;
+                       
+                       adt= BKE_id_add_animdata(id);
+                       
+                       SEQ_BEGIN(ed, seq) {
+                               IpoCurve *icu = (seq->ipo) ? seq->ipo->curve.first : NULL;
+                               short adrcode = SEQ_FAC1;
+                               
+                               if (G.f & G_DEBUG) 
+                                       printf("\tconverting sequence strip %s \n", seq->name+2);
+                               
+                               if (ELEM(NULL, seq->ipo, icu)) {
+                                       seq->flag |= SEQ_USE_EFFECT_DEFAULT_FADE;
+                                       continue;
+                               }
+                               
+                               /* patch adrcode, so that we can map
+                                  to different DNA variables later 
+                                  (semi-hack (tm) )
+                               */
+                               switch (seq->type) {
+                                       case SEQ_IMAGE:
+                                       case SEQ_META:
+                                       case SEQ_SCENE:
+                                       case SEQ_MOVIE:
+                                       case SEQ_COLOR:
+                                               adrcode = SEQ_FAC_OPACITY;
+                                               break;
+                                       case SEQ_SPEED:
+                                               adrcode = SEQ_FAC_SPEED;
+                                               break;
+                               }
+                               icu->adrcode = adrcode;
+                               
+                               /* convert IPO */
+                               ipo_to_animdata((ID *)scene, seq->ipo, NULL, NULL, seq);
+                               seq->ipo->id.us--;
+                               seq->ipo = NULL;
+                       }
+                       SEQ_END
+               }
+       }
+
+
        /* textures */
        for (id= main->tex.first; id; id= id->next) {
                Tex *te= (Tex *)id;
@@ -1786,7 +1924,7 @@ void do_versions_ipos_to_animato(Main *main)
                        adt= BKE_id_add_animdata(id);
                        
                        /* Convert Texture data... */
-                       ipo_to_animdata(id, te->ipo, NULL, NULL);
+                       ipo_to_animdata(id, te->ipo, NULL, NULL, NULL);
                        te->ipo->id.us--;
                        te->ipo= NULL;
                }
@@ -1804,7 +1942,7 @@ void do_versions_ipos_to_animato(Main *main)
                        adt= BKE_id_add_animdata(id);
                        
                        /* Convert Camera data... */
-                       ipo_to_animdata(id, ca->ipo, NULL, NULL);
+                       ipo_to_animdata(id, ca->ipo, NULL, NULL, NULL);
                        ca->ipo->id.us--;
                        ca->ipo= NULL;
                }
@@ -1822,12 +1960,30 @@ void do_versions_ipos_to_animato(Main *main)
                        adt= BKE_id_add_animdata(id);
                        
                        /* Convert Lamp data... */
-                       ipo_to_animdata(id, la->ipo, NULL, NULL);
+                       ipo_to_animdata(id, la->ipo, NULL, NULL, NULL);
                        la->ipo->id.us--;
                        la->ipo= NULL;
                }
        }
        
+       /* curves */
+       for (id= main->curve.first; id; id= id->next) {
+               Curve *cu= (Curve *)id;
+               
+               if (G.f & G_DEBUG) printf("\tconverting curve %s \n", id->name+2);
+               
+               /* we're only interested in the IPO */
+               if (cu->ipo) {
+                       /* Add AnimData block */
+                       adt= BKE_id_add_animdata(id);
+                       
+                       /* Convert Curve data... */
+                       ipo_to_animdata(id, cu->ipo, NULL, NULL, NULL);
+                       cu->ipo->id.us--;
+                       cu->ipo= NULL;
+               }
+       }
+       
        /* --------- Unconverted Animation Data ------------------ */
        /* For Animation data which may not be directly connected (i.e. not linked) to any other 
         * data, we need to perform a separate pass to make sure that they are converted to standalone
@@ -1846,7 +2002,7 @@ void do_versions_ipos_to_animato(Main *main)
                if (G.f & G_DEBUG) printf("\tconverting action %s \n", id->name+2);
                
                /* be careful! some of the actions we encounter will be converted ones... */
-               action_to_animato(act, &act->groups, &act->curves, &drivers);
+               action_to_animato(NULL, act, &act->groups, &act->curves, &drivers);
        }
        
        /* ipo's */
@@ -1861,7 +2017,7 @@ void do_versions_ipos_to_animato(Main *main)
                        
                        /* add a new action for this, and convert all data into that action */
                        new_act= add_empty_action("ConvIPO_Action"); // XXX need a better name...
-                       ipo_to_animato(ipo, NULL, NULL, NULL, &new_act->curves, &drivers);
+                       ipo_to_animato(NULL, ipo, NULL, NULL, NULL, NULL, &new_act->curves, &drivers);
                }
                
                /* clear fake-users, and set user-count to zero to make sure it is cleared on file-save */
@@ -1872,6 +2028,7 @@ void do_versions_ipos_to_animato(Main *main)
        /* free unused drivers from actions + ipos */
        free_fcurves(&drivers);
        
-       printf("INFO: Animato convert done \n"); // xxx debug
+       if (G.f & G_DEBUG)
+               printf("INFO: Animato convert done \n");
 }