armature ghost stepsize was not initialized, Aligorith: can you check this is correct?
[blender.git] / source / blender / blenloader / intern / readfile.c
index 7512a7ebb025f206d64a081c80c60a358f08d3ec..88c120dc1e15176b5e1609df0cd0eb02481230ce 100644 (file)
 #include "BLI_storage_types.h" // for relname flags
 
 #include "BKE_animsys.h"
+#include "BKE_anim.h"
 #include "BKE_action.h"
 #include "BKE_armature.h"
 #include "BKE_brush.h"
@@ -1695,12 +1696,6 @@ static void lib_link_fmodifiers(FileData *fd, ID *id, ListBase *list)
                                data->script = newlibadr(fd, id->lib, data->script);
                        }
                                break;
-                       case FMODIFIER_TYPE_SOUND:
-                       {
-                               FMod_Sound *data= (FMod_Sound *)fcm->data;
-                               data->sound = newlibadr(fd, id->lib, data->sound);
-                       }
-                               break;
                }
        }
 }
@@ -1987,6 +1982,19 @@ static void direct_link_animdata(FileData *fd, AnimData *adt)
        adt->actstrip= NULL;
 }      
 
+/* ************ READ MOTION PATHS *************** */
+
+/* direct data for cache */
+static void direct_link_motionpath(FileData *fd, bMotionPath *mpath)
+{
+       /* sanity check */
+       if (mpath == NULL)
+               return;
+       
+       /* relink points cache */
+       mpath->points= newdataadr(fd, mpath->points);
+}
+
 /* ************ READ NODE TREE *************** */
 
 /* singe node tree (also used for material/scene trees), ntree is not NULL */
@@ -3769,6 +3777,10 @@ static void direct_link_pose(FileData *fd, bPose *pose)
                if (pchan->prop)
                        IDP_DirectLinkProperty(pchan->prop, (fd->flags & FD_FLAGS_SWITCH_ENDIAN), fd);
                
+               pchan->mpath= newdataadr(fd, pchan->mpath);
+               if (pchan->mpath)
+                       direct_link_motionpath(fd, pchan->mpath);
+               
                pchan->iktree.first= pchan->iktree.last= NULL;
                pchan->path= NULL;
        }
@@ -3981,6 +3993,10 @@ static void direct_link_object(FileData *fd, Object *ob)
        
        ob->pose= newdataadr(fd, ob->pose);
        direct_link_pose(fd, ob->pose);
+       
+       ob->mpath= newdataadr(fd, ob->mpath);
+       if (ob->mpath)
+               direct_link_motionpath(fd, ob->mpath);
 
        link_list(fd, &ob->defbase);
 // XXX depreceated - old animation system <<<
@@ -10310,6 +10326,67 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
 
        /* put 2.50 compatibility code here until next subversion bump */
 
+       if (1) {
+               Scene *sce;
+               Object *ob;
+               
+               /* game engine changes */
+               for(sce = main->scene.first; sce; sce = sce->id.next) {
+                       sce->gm.eyeseparation = 0.10;
+               }
+               
+               /* anim viz changes */
+               for (ob= main->object.first; ob; ob= ob->id.next) {
+                       /* initialise object defaults */
+                       animviz_settings_init(&ob->avs);
+                       
+                       /* if armature, copy settings for pose from armature data */
+                       if (ob->pose && ob->data) {
+                               bArmature *arm= newlibadr(fd, lib, ob->data);
+                               bAnimVizSettings *avs= &ob->pose->avs;
+                               
+                               /* ghosting settings ---------------- */
+                                       /* ranges */
+                               avs->ghost_bc= avs->ghost_ac= arm->ghostep;
+                               
+                               avs->ghost_sf= arm->ghostsf;
+                               avs->ghost_ef= arm->ghostef;
+                                       
+                                       /* type */
+                               avs->ghost_type= arm->ghosttype;
+                                       
+                                       /* stepsize */
+                               avs->ghost_step= arm->ghostsize;
+                               
+                               /* path settings --------------------- */
+                                       /* ranges */
+                               avs->path_bc= arm->pathbc;
+                               avs->path_ac= arm->pathac;
+                               
+                               avs->path_sf= arm->pathsf;
+                               avs->path_ef= arm->pathef;
+                               
+                                       /* flags */
+                               if (arm->pathflag & ARM_PATH_FNUMS)
+                                       avs->path_viewflag |= MOTIONPATH_VIEW_FNUMS;
+                               if (arm->pathflag & ARM_PATH_KFRAS)
+                                       avs->path_viewflag |= MOTIONPATH_VIEW_KFRAS;
+                               if (arm->pathflag & ARM_PATH_KFNOS)
+                                       avs->path_viewflag |= MOTIONPATH_VIEW_KFNOS;
+                                       
+                                       /* bake flags */
+                               if (arm->pathflag & ARM_PATH_HEADS)
+                                       avs->path_bakeflag |= MOTIONPATH_BAKE_HEADS;
+                                       
+                                       /* type */
+                               if (arm->pathflag & ARM_PATH_ACFRA)
+                                       avs->path_type = MOTIONPATH_TYPE_ACFRA;
+                               
+                                       /* stepsize */
+                               avs->path_step= arm->pathsize;
+                       }
+               }
+       }
 
        /* WATCH IT!!!: pointers from libdata have not been converted yet here! */
        /* WATCH IT 2!: Userdef struct init has to be in src/usiblender.c! */
@@ -10663,13 +10740,6 @@ static void expand_fmodifiers(FileData *fd, Main *mainvar, ListBase *list)
                                expand_doit(fd, mainvar, data->script);
                        }
                                break;
-                       case FMODIFIER_TYPE_SOUND:
-                       {
-                               FMod_Sound *data= (FMod_Sound *)fcm->data;
-
-                               expand_doit(fd, mainvar, data->sound);
-                       }
-                               break;
                }
        }
 }