Keyed physics refresh:
[blender-staging.git] / source / blender / blenloader / intern / readfile.c
index 479fa7604238b1587f7d888a755c247ff58c9e1c..c2b19a804eefd1eef905275547e8327e2462fb52 100644 (file)
@@ -2968,6 +2968,9 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache)
                for(; pm; pm=pm->next)
                        pm->data = newdataadr(fd, pm->data);
        }
                for(; pm; pm=pm->next)
                        pm->data = newdataadr(fd, pm->data);
        }
+       else
+               cache->mem_cache.first = cache->mem_cache.last = NULL;
+
        cache->flag &= ~(PTCACHE_SIMULATION_VALID|PTCACHE_BAKE_EDIT_ACTIVE);
        cache->simframe= 0;
 }
        cache->flag &= ~(PTCACHE_SIMULATION_VALID|PTCACHE_BAKE_EDIT_ACTIVE);
        cache->simframe= 0;
 }
@@ -3011,12 +3014,18 @@ static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase
                
                psys->part = newlibadr_us(fd, id->lib, psys->part);
                if(psys->part) {
                
                psys->part = newlibadr_us(fd, id->lib, psys->part);
                if(psys->part) {
+                       KeyedParticleTarget *kpt = psys->keyed_targets.first;
+
+                       for(; kpt; kpt=kpt->next)
+                               kpt->ob=newlibadr(fd, id->lib, kpt->ob);
+
                        psys->target_ob = newlibadr(fd, id->lib, psys->target_ob);
                        psys->target_ob = newlibadr(fd, id->lib, psys->target_ob);
-                       psys->keyed_ob = newlibadr(fd, id->lib, psys->keyed_ob);
 
                        for(a=0,pa=psys->particles; a<psys->totpart; a++,pa++){
                                pa->stick_ob=newlibadr(fd, id->lib, pa->stick_ob);
                        }
 
                        for(a=0,pa=psys->particles; a<psys->totpart; a++,pa++){
                                pa->stick_ob=newlibadr(fd, id->lib, pa->stick_ob);
                        }
+
+
                }
                else {
                        /* particle modifier must be removed before particle system */
                }
                else {
                        /* particle modifier must be removed before particle system */
@@ -3066,6 +3075,8 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
                                direct_link_pointcache(fd, sb->pointcache);
                }
 
                                direct_link_pointcache(fd, sb->pointcache);
                }
 
+               link_list(fd, &psys->keyed_targets);
+
                psys->edit = 0;
                psys->free_edit = NULL;
                psys->pathcache = 0;
                psys->edit = 0;
                psys->free_edit = NULL;
                psys->pathcache = 0;