diff options
author | Janne Karhu <jhkarh@gmail.com> | 2012-03-19 01:33:00 +0400 |
---|---|---|
committer | Janne Karhu <jhkarh@gmail.com> | 2012-03-19 01:33:00 +0400 |
commit | 709ca0ece9b28858cea8084f8040ce0b7455958a (patch) | |
tree | 155f9061bdb676283be269767f1f3cb40ddf325f /source/blender/blenkernel/intern/pointcache.c | |
parent | 9db821a5db8e45b671af665062732c08c7fc2b13 (diff) |
"Fix" for [#30098] Particle rotation wrong / explode modifier
- The main problem was that in order to be accurate all particle
rotations have to be calculated incrementally so the only working
solution is to store rotations to the point cache (previously
this was only done for dynamic rotations). This can nearly double
the point cache size so it's not ideal to have this as a default
as in many cases you don't care about particle rotations.
- Particle rotation panel now has a new "enable" checkbox that
enables rotation calculations and the storing of rotations to
point cache.
- Old files will have rotations enabled via do_versions so that in
the worst case old files will only get bigger point caches, but no
sudden loss of particle rotations.
Diffstat (limited to 'source/blender/blenkernel/intern/pointcache.c')
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index b3c242178f1..622c3ebe119 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -315,9 +315,10 @@ static void ptcache_particle_read(int index, void *psys_v, void **data, float cf } } - /* determine rotation from velocity */ + /* default to no rotation */ if(data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_ROTATION]) { - vec_to_quat( pa->state.rot,pa->state.vel, OB_NEGX, OB_POSZ); + pa->state.rot[0]=1.0f; + pa->state.rot[1]=pa->state.rot[2]=pa->state.rot[3]=0; } } static void ptcache_particle_interpolate(int index, void *psys_v, void **data, float cfra, float cfra1, float cfra2, float *old_data) @@ -815,13 +816,14 @@ void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *p pid->read_extra_data = ptcache_particle_extra_read; } - if(psys->part->rotmode!=PART_ROT_VEL - || psys->part->avemode!=PART_AVE_SPIN || psys->part->avefac!=0.0f) - pid->data_types|= (1<<BPHYS_DATA_AVELOCITY) | (1<<BPHYS_DATA_ROTATION); - - if(psys->part->flag & PART_ROT_DYN) + if(psys->part->flag & PART_ROTATIONS) { pid->data_types|= (1<<BPHYS_DATA_ROTATION); + if(psys->part->rotmode!=PART_ROT_VEL + || psys->part->avemode!=PART_AVE_SPIN || psys->part->avefac!=0.0f) + pid->data_types|= (1<<BPHYS_DATA_AVELOCITY); + } + pid->info_types= (1<<BPHYS_DATA_TIMES); pid->default_step = 10; |