diff options
author | Janne Karhu <jhkarh@gmail.com> | 2011-01-09 21:23:41 +0300 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2011-01-09 21:23:41 +0300 |
commit | 1786923afc85ede081dc3ed1a3970965a61dd761 (patch) | |
tree | bd1527f5a0ab8a9b25af9b4624b7ce34bd0c7196 /source/blender/blenloader | |
parent | 856d9c90572491a9c462b2e7a63535e2ffc3dcf6 (diff) |
Replace uint32_t in pointcache code with unsigned int as it's supported in dna
* Not strictly necessary right now, but better for future.
* Struct data (only boids at the moment) is now written as structs (with dna) so they work between 64 and 32 bit machines too.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 5 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 11 |
2 files changed, 8 insertions, 8 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 9772074207d..cc2b73d87f5 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -2939,12 +2939,11 @@ static void direct_link_pointcache(FileData *fd, PointCache *cache) for(i=0; i<BPHYS_TOT_DATA; i++) { pm->data[i] = newdataadr(fd, pm->data[i]); - /* XXX the cache saves structs and data without DNA */ - if(pm->data[i] && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) { + /* the cache saves non-struct data without DNA */ + if(pm->data[i] && strcmp(ptcache_datastruct[i], "")==0 && (fd->flags & FD_FLAGS_SWITCH_ENDIAN)) { int j, tot= (BKE_ptcache_data_size (i) * pm->totpoint)/4; /* data_size returns bytes */ int *poin= pm->data[i]; - /* XXX fails for boid struct, it has 2 shorts */ for(j= 0; j<tot; j++) SWITCH_INT(poin[j]); } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 050fd5bcaf1..8230050fc2f 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -768,9 +768,6 @@ static void write_boid_state(WriteData *wd, BoidState *state) //for(; cond; cond=cond->next) // writestruct(wd, DATA, "BoidCondition", 1, cond); } -/* TODO: replace *cache with *cachelist once it's coded */ -#define PTCACHE_WRITE_PSYS 0 -#define PTCACHE_WRITE_CLOTH 1 static void write_pointcaches(WriteData *wd, ListBase *ptcaches) { PointCache *cache = ptcaches->first; @@ -786,8 +783,12 @@ static void write_pointcaches(WriteData *wd, ListBase *ptcaches) writestruct(wd, DATA, "PTCacheMem", 1, pm); for(i=0; i<BPHYS_TOT_DATA; i++) { - if(pm->data[i] && pm->data_types & (1<<i)) - writedata(wd, DATA, MEM_allocN_len(pm->data[i]), pm->data[i]); + if(pm->data[i] && pm->data_types & (1<<i)) { + if(strcmp(ptcache_datastruct[i], "")==0) + writedata(wd, DATA, MEM_allocN_len(pm->data[i]), pm->data[i]); + else + writestruct(wd, DATA, ptcache_datastruct[i], pm->totpoint, pm->data[i]); + } } } } |