diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-02-05 16:53:34 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2014-02-05 16:53:34 +0400 |
commit | e9fda259dac3d95018bc9378e2f8f3b10a8c46c4 (patch) | |
tree | 1e7cd02aebb6900e76dad8f18660e825e43b06aa /source | |
parent | 13780799ea143a8220aaacd24d1546dde48ac3b5 (diff) |
Fix T38476: incorrect hair draw type after editing particle system in edit mode.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_particle.h | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 5 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 14 |
3 files changed, 13 insertions, 7 deletions
diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index d4965cf55fe..59274347e1f 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -330,6 +330,7 @@ void psys_apply_hair_lattice(struct Scene *scene, struct Object *ob, struct Part struct ParticleSystem *psys_get_target_system(struct Object *ob, struct ParticleTarget *pt); void psys_count_keyed_targets(struct ParticleSimulationData *sim); void psys_update_particle_tree(struct ParticleSystem *psys, float cfra); +void psys_changed_type(struct Object *ob, struct ParticleSystem *psys); void psys_make_temp_pointcache(struct Object *ob, struct ParticleSystem *psys); void psys_get_pointcache_start_end(struct Scene *scene, ParticleSystem *psys, int *sfra, int *efra); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 9ed76c505c0..3d08ec22acb 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -2984,6 +2984,11 @@ void BKE_object_handle_update_ex(EvaluationContext *eval_ctx, psys = ob->particlesystem.first; while (psys) { + /* ensure this update always happens even if psys is disabled */ + if (psys->recalc & PSYS_RECALC_TYPE) { + psys_changed_type(ob, psys); + } + if (psys_check_enabled(ob, psys)) { /* check use of dupli objects here */ if (psys->part && (psys->part->draw_as == PART_DRAW_REND || eval_ctx->for_render) && diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 6c2a42daa2d..78db7e67b23 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -4794,15 +4794,15 @@ static void system_step(ParticleSimulationData *sim, float cfra) } /* system type has changed so set sensible defaults and clear non applicable flags */ -static void psys_changed_type(ParticleSimulationData *sim) +void psys_changed_type(Object *ob, ParticleSystem *psys) { - ParticleSettings *part = sim->psys->part; + ParticleSettings *part = psys->part; PTCacheID pid; - BKE_ptcache_id_from_particles(&pid, sim->ob, sim->psys); + BKE_ptcache_id_from_particles(&pid, ob, psys); if (part->phystype != PART_PHYS_KEYED) - sim->psys->flag &= ~PSYS_KEYED; + psys->flag &= ~PSYS_KEYED; if (part->type == PART_HAIR) { if (ELEM4(part->ren_as, PART_DRAW_NOT, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR)==0) @@ -4820,13 +4820,13 @@ static void psys_changed_type(ParticleSimulationData *sim) BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_ALL, 0); } else { - free_hair(sim->ob, sim->psys, 1); + free_hair(ob, psys, 1); CLAMP(part->path_start, 0.0f, MAX2(100.0f, part->end + part->lifetime)); CLAMP(part->path_end, 0.0f, MAX2(100.0f, part->end + part->lifetime)); } - psys_reset(sim->psys, PSYS_RESET_ALL); + psys_reset(psys, PSYS_RESET_ALL); } void psys_check_boid_data(ParticleSystem *psys) { @@ -4961,7 +4961,7 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys) psys->flag &= ~PSYS_OB_ANIM_RESTORE; if (psys->recalc & PSYS_RECALC_TYPE) - psys_changed_type(&sim); + psys_changed_type(sim.ob, sim.psys); if (psys->recalc & PSYS_RECALC_RESET) psys->totunexist = 0; |