diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-10-08 15:56:20 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-10-08 16:05:37 +0300 |
commit | 74f557982df88c0318c8809e22ffce83696be58c (patch) | |
tree | 19241035053468e414e25bfe365e13eafe0d3bb3 /source/blender/blenkernel/intern/particle_system.c | |
parent | b0bce65d67ac65bef114cdf22e66f997b4028269 (diff) |
Add id looper for particlesystem.
Diffstat (limited to 'source/blender/blenkernel/intern/particle_system.c')
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 9c720126eca..a59a0b73b69 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -77,6 +77,7 @@ #include "BKE_cdderivedmesh.h" #include "BKE_collision.h" #include "BKE_effect.h" +#include "BKE_library_query.h" #include "BKE_particle.h" #include "BKE_global.h" @@ -4209,6 +4210,30 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys) invert_m4_m4(psys->imat, ob->obmat); } +/* ID looper */ + +void BKE_particlesystem_id_loop(ParticleSystem *psys, ParticleSystemIDFunc func, void *userdata) +{ + ParticleTarget *pt; + + func(psys, (ID **)&psys->part, userdata, IDWALK_NOP); + func(psys, (ID **)&psys->target_ob, userdata, IDWALK_NOP); + func(psys, (ID **)&psys->parent, userdata, IDWALK_NOP); + + for (pt = psys->targets.first; pt; pt = pt->next) { + func(psys, (ID **)&pt->ob, userdata, IDWALK_NOP); + } + + if (psys->part->phystype == PART_PHYS_BOIDS) { + ParticleData *pa; + int p; + + for (p = 0, pa = psys->particles; p < psys->totpart; p++, pa++) { + func(psys, (ID **)&pa->boid->ground, userdata, IDWALK_NOP); + } + } +} + /* **** Depsgraph evaluation **** */ void BKE_particle_system_eval(EvaluationContext *UNUSED(eval_ctx), |