reading in hair with dynamics wasnt working but mostly crashed when duplicating the...
authorCampbell Barton <ideasman42@gmail.com>
Thu, 4 Feb 2010 16:54:25 +0000 (16:54 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 4 Feb 2010 16:54:25 +0000 (16:54 +0000)
from reading all places dynamic hair is used I think these changes are correct (cloth seems to share pointcache with the psys) but its not obvious.

jahka: please check this is ok.

source/blender/blenkernel/intern/object.c
source/blender/blenloader/intern/readfile.c

index 0baf9b00ecf1f7abfd15e7f9c3ebbef790722d37..3be01e38368612ca15aaf3da2a3ba136916457bf 100644 (file)
@@ -1164,6 +1164,12 @@ ParticleSystem *copy_particlesystem(ParticleSystem *psys)
        
        psysn->pointcache= BKE_ptcache_copy_list(&psysn->ptcaches, &psys->ptcaches);
 
+       /* XXX - from reading existing code this seems correct but intended usage of
+        * pointcache should /w cloth should be added in 'ParticleSystem' - campbell */
+       if(psysn->clmd) {
+               psysn->clmd->point_cache= psysn->pointcache;
+       }
+
        id_us_plus((ID *)psysn->part);
 
        return psysn;
index 051bc1851b886d7d6cd9e0e611129b7a13d71cce..e9cbbb95b022b6f1e059faa9abc99081d845fa54 100644 (file)
@@ -3187,6 +3187,13 @@ static void lib_link_particlesystems(FileData *fd, Object *ob, ID *id, ListBase
                                pt->ob=newlibadr(fd, id->lib, pt->ob);
 
                        psys->target_ob = newlibadr(fd, id->lib, psys->target_ob);
+
+                       if(psys->clmd) {
+                               /* XXX - from reading existing code this seems correct but intended usage of
+                                * pointcache should /w cloth should be added in 'ParticleSystem' - campbell */
+                               psys->clmd->point_cache= psys->pointcache;
+                               psys->clmd->ptcaches.first= psys->clmd->ptcaches.last= NULL;
+                       }
                }
                else {
                        /* particle modifier must be removed before particle system */