diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2016-04-13 14:41:11 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2016-04-13 14:41:11 +0300 |
commit | 664f5b8c06a0d935dd859fdcf2998db2f582c5ee (patch) | |
tree | 218e2fcec8d565f7a7dead1c37c881fa6c78f6a7 /source/blender/blenkernel/intern | |
parent | d8d49befa084b545fd390af61b130093b2fd4337 (diff) |
Removed particle DNA.
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/bpath.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/cloth.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/dynamicpaint.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/effect.c | 41 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/fluidsim.c | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/group.c | 11 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object_deform.c | 9 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 328 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/rigidbody.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/smoke.c | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/softbody.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/texture.c | 68 |
12 files changed, 25 insertions, 456 deletions
diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c index 76544e5ed42..37ecbb383e5 100644 --- a/source/blender/blenkernel/intern/bpath.c +++ b/source/blender/blenkernel/intern/bpath.c @@ -55,7 +55,6 @@ #include "DNA_object_fluidsim.h" #include "DNA_object_force.h" #include "DNA_object_types.h" -#include "DNA_particle_types.h" #include "DNA_sequence_types.h" #include "DNA_sound_types.h" #include "DNA_text_types.h" @@ -462,7 +461,6 @@ void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int { Object *ob = (Object *)id; ModifierData *md; - ParticleSystem *psys; #define BPATH_TRAVERSE_POINTCACHE(ptcaches) \ { \ @@ -515,10 +513,6 @@ void BKE_bpath_traverse_id(Main *bmain, ID *id, BPathVisitor visit_cb, const int BPATH_TRAVERSE_POINTCACHE(ob->soft->ptcaches); } - for (psys = ob->particlesystem.first; psys; psys = psys->next) { - BPATH_TRAVERSE_POINTCACHE(psys->ptcaches); - } - #undef BPATH_TRAVERSE_POINTCACHE break; diff --git a/source/blender/blenkernel/intern/cloth.c b/source/blender/blenkernel/intern/cloth.c index 7a2a4e09b3d..b183fe54409 100644 --- a/source/blender/blenkernel/intern/cloth.c +++ b/source/blender/blenkernel/intern/cloth.c @@ -365,7 +365,7 @@ static int do_step_cloth(Object *ob, ClothModifierData *clmd, DerivedMesh *resul mul_m4_v3(ob->obmat, verts->xconst); } - effectors = pdInitEffectors(clmd->scene, ob, NULL, clmd->sim_parms->effector_weights, true); + effectors = pdInitEffectors(clmd->scene, ob, clmd->sim_parms->effector_weights, true); /* Support for dynamic vertex groups, changing from frame to frame */ cloth_apply_vgroup ( clmd, result ); diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index b968f78077b..e49c57dc6dc 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -3843,7 +3843,7 @@ static int dynamicPaint_prepareEffectStep(DynamicPaintSurface *surface, Scene *s /* Init force data if required */ if (surface->effect & MOD_DPAINT_EFFECT_DO_DRIP) { float vel[3] = {0}; - ListBase *effectors = pdInitEffectors(scene, ob, NULL, surface->effector_weights, true); + ListBase *effectors = pdInitEffectors(scene, ob, surface->effector_weights, true); /* allocate memory for force data (dir vector + strength) */ *force = MEM_mallocN(sData->total_points * 4 * sizeof(float), "PaintEffectForces"); diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index c845bb57ff9..97b8582e346 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -43,7 +43,6 @@ #include "DNA_meshdata_types.h" #include "DNA_object_types.h" #include "DNA_object_force.h" -#include "DNA_particle_types.h" #include "DNA_texture_types.h" #include "DNA_scene_types.h" @@ -147,12 +146,11 @@ void free_partdeflect(PartDeflect *pd) MEM_freeN(pd); } -static EffectorCache *new_effector_cache(Scene *scene, Object *ob, ParticleSystem *psys, PartDeflect *pd) +static EffectorCache *new_effector_cache(Scene *scene, Object *ob, PartDeflect *pd) { EffectorCache *eff = MEM_callocN(sizeof(EffectorCache), "EffectorCache"); eff->scene = scene; eff->ob = ob; - eff->psys = psys; eff->pd = pd; eff->frame = -1; return eff; @@ -170,7 +168,7 @@ static void add_object_to_effectors(ListBase **effectors, Scene *scene, Effector if (*effectors == NULL) *effectors = MEM_callocN(sizeof(ListBase), "effectors list"); - eff = new_effector_cache(scene, ob, NULL, ob->pd); + eff = new_effector_cache(scene, ob, ob->pd); /* make sure imat is up to date */ invert_m4_m4(ob->imat, ob->obmat); @@ -179,7 +177,7 @@ static void add_object_to_effectors(ListBase **effectors, Scene *scene, Effector } /* returns ListBase handle with objects taking part in the effecting */ -ListBase *pdInitEffectors(Scene *scene, Object *ob_src, ParticleSystem *UNUSED(psys_src), +ListBase *pdInitEffectors(Scene *scene, Object *ob_src, EffectorWeights *weights, bool precalc) { Base *base; @@ -577,7 +575,7 @@ int get_effector_data(EffectorCache *eff, EffectorData *efd, EffectedPoint *poin return ret; } -static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int *tot, int *p, int *step) +static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoint *point, int *tot, int *p) { *p = 0; efd->index = p; @@ -590,31 +588,6 @@ static void get_effector_tot(EffectorCache *eff, EffectorData *efd, EffectedPoin *tot = *p+1; } } - else if (eff->psys) { - *tot = eff->psys->totpart; - - if (eff->pd->forcefield == PFIELD_CHARGE) { - /* Only the charge of the effected particle is used for - * interaction, not fall-offs. If the fall-offs aren't the - * same this will be unphysical, but for animation this - * could be the wanted behavior. If you want physical - * correctness the fall-off should be spherical 2.0 anyways. - */ - efd->charge = eff->pd->f_strength; - } - else if (eff->pd->forcefield == PFIELD_HARMONIC && (eff->pd->flag & PFIELD_MULTIPLE_SPRINGS)==0) { - /* every particle is mapped to only one harmonic effector particle */ - *p= point->index % eff->psys->totpart; - *tot= *p + 1; - } - - if (eff->psys->part->effector_amount) { - int totpart = eff->psys->totpart; - int amount = eff->psys->part->effector_amount; - - *step = (totpart > amount) ? totpart/amount : 1; - } - } else { *tot = 1; } @@ -875,7 +848,7 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we */ EffectorCache *eff; EffectorData efd; - int p=0, tot = 1, step = 1; + int p=0, tot = 1; /* Cycle through collected objects, get total of (1/(gravity_strength * dist^gravity_power)) */ /* Check for min distance here? (yes would be cool to add that, ton) */ @@ -883,9 +856,9 @@ void pdDoEffectors(ListBase *effectors, ListBase *colliders, EffectorWeights *we if (effectors) for (eff = effectors->first; eff; eff=eff->next) { /* object effectors were fully checked to be OK to evaluate! */ - get_effector_tot(eff, &efd, point, &tot, &p, &step); + get_effector_tot(eff, &efd, point, &tot, &p); - for (; p<tot; p+=step) { + for (; p<tot; p++) { if (get_effector_data(eff, &efd, point, 0)) { efd.falloff= effector_falloff(eff, &efd, point, weights); diff --git a/source/blender/blenkernel/intern/fluidsim.c b/source/blender/blenkernel/intern/fluidsim.c index 8247336d915..8874e059d6c 100644 --- a/source/blender/blenkernel/intern/fluidsim.c +++ b/source/blender/blenkernel/intern/fluidsim.c @@ -43,7 +43,6 @@ #include "DNA_object_fluidsim.h" #include "DNA_object_force.h" // for pointcache #include "DNA_object_types.h" -#include "DNA_particle_types.h" #include "DNA_scene_types.h" #include "BLI_math.h" diff --git a/source/blender/blenkernel/intern/group.c b/source/blender/blenkernel/intern/group.c index a44eb1df9fe..6026913d247 100644 --- a/source/blender/blenkernel/intern/group.c +++ b/source/blender/blenkernel/intern/group.c @@ -40,7 +40,6 @@ #include "DNA_material_types.h" #include "DNA_object_types.h" #include "DNA_scene_types.h" -#include "DNA_particle_types.h" #include "BLI_blenlib.h" #include "BLI_utildefines.h" @@ -79,7 +78,6 @@ void BKE_group_unlink(Main *bmain, Group *group) Object *ob; Scene *sce; SceneRenderLayer *srl; - ParticleSystem *psys; for (ma = bmain->mat.first; ma; ma = ma->id.next) { if (ma->group == group) @@ -119,15 +117,6 @@ void BKE_group_unlink(Main *bmain, Group *group) if (ob->dup_group == group) { ob->dup_group = NULL; } - - for (psys = ob->particlesystem.first; psys; psys = psys->next) { - if (psys->part->dup_group == group) - psys->part->dup_group = NULL; -#if 0 /* not used anymore, only keps for readfile.c, no need to account for this */ - if (psys->part->eff_group == group) - psys->part->eff_group = NULL; -#endif - } } /* group stays in library, but no members */ diff --git a/source/blender/blenkernel/intern/object_deform.c b/source/blender/blenkernel/intern/object_deform.c index b5f63588423..72968d1964c 100644 --- a/source/blender/blenkernel/intern/object_deform.c +++ b/source/blender/blenkernel/intern/object_deform.c @@ -42,7 +42,6 @@ #include "DNA_modifier_types.h" #include "DNA_object_types.h" #include "DNA_object_force.h" -#include "DNA_particle_types.h" #include "DNA_scene_types.h" #include "BKE_action.h" @@ -72,8 +71,6 @@ static Lattice *object_defgroup_lattice_get(ID *id) void BKE_object_defgroup_remap_update_users(Object *ob, int *map) { ModifierData *md; - ParticleSystem *psys; - int a; /* these cases don't use names to refer to vertex groups, so when * they get removed the numbers get out of sync, this corrects that */ @@ -98,12 +95,6 @@ void BKE_object_defgroup_remap_update_users(Object *ob, int *map) } } } - - for (psys = ob->particlesystem.first; psys; psys = psys->next) { - for (a = 0; a < PSYS_TOT_VG; a++) { - psys->vgroup[a] = map[psys->vgroup[a]]; - } - } } /** \} */ diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 36f786c5254..d605232f97d 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -41,7 +41,6 @@ #include "DNA_modifier_types.h" #include "DNA_object_types.h" #include "DNA_object_force.h" -#include "DNA_particle_types.h" #include "DNA_rigidbody_types.h" #include "DNA_scene_types.h" #include "DNA_smoke_types.h" @@ -136,7 +135,7 @@ static int ptcache_data_size[] = { static int ptcache_extra_datasize[] = { 0, - sizeof(ParticleSpring) + 0 }; /* forward declerations */ @@ -196,7 +195,7 @@ static void ptcache_softbody_read(int index, void *soft_v, void **data, float UN } } -static void interpolate_particle_keys(short type, ParticleKey keys[4], float dt, ParticleKey *result, bool velocity) +static void interpolate_particle_keys(short type, PointCacheKey keys[4], float dt, PointCacheKey *result, bool velocity) { float t[4]; @@ -229,7 +228,7 @@ static void ptcache_softbody_interpolate(int index, void *soft_v, void **data, f { SoftBody *soft= soft_v; BodyPoint *bp = soft->bpoint + index; - ParticleKey keys[4]; + PointCacheKey keys[4]; float dfra; if (cfra1 == cfra2) @@ -243,7 +242,7 @@ static void ptcache_softbody_interpolate(int index, void *soft_v, void **data, f memcpy(keys[2].vel, old_data + 3, 3 * sizeof(float)); } else - BKE_ptcache_make_particle_key(keys+2, 0, data, cfra2); + BKE_ptcache_make_key(keys+2, 0, data, cfra2); dfra = cfra2 - cfra1; @@ -267,8 +266,7 @@ static void ptcache_softbody_error(void *UNUSED(soft_v), const char *UNUSED(mess /* ignored for now */ } -/* Particle functions */ -void BKE_ptcache_make_particle_key(ParticleKey *key, int index, void **data, float time) +void BKE_ptcache_make_key(PointCacheKey *key, int index, void **data, float time) { PTCACHE_DATA_TO(data, BPHYS_DATA_LOCATION, index, key->co); PTCACHE_DATA_TO(data, BPHYS_DATA_VELOCITY, index, key->vel); @@ -284,229 +282,6 @@ void BKE_ptcache_make_particle_key(ParticleKey *key, int index, void **data, flo PTCACHE_DATA_TO(data, BPHYS_DATA_AVELOCITY, index, key->ave); key->time = time; } -static int ptcache_particle_write(int index, void *psys_v, void **data, int cfra) -{ - ParticleSystem *psys= psys_v; - ParticleData *pa = psys->particles + index; - BoidParticle *boid = (psys->part->phystype == PART_PHYS_BOIDS) ? pa->boid : NULL; - float times[3]; - int step = psys->pointcache->step; - - /* No need to store unborn or died particles outside cache step bounds */ - if (data[BPHYS_DATA_INDEX] && (cfra < pa->time - step || cfra > pa->dietime + step)) - return 0; - - times[0] = pa->time; - times[1] = pa->dietime; - times[2] = pa->lifetime; - - PTCACHE_DATA_FROM(data, BPHYS_DATA_INDEX, &index); - PTCACHE_DATA_FROM(data, BPHYS_DATA_LOCATION, pa->state.co); - PTCACHE_DATA_FROM(data, BPHYS_DATA_VELOCITY, pa->state.vel); - PTCACHE_DATA_FROM(data, BPHYS_DATA_ROTATION, pa->state.rot); - PTCACHE_DATA_FROM(data, BPHYS_DATA_AVELOCITY, pa->state.ave); - PTCACHE_DATA_FROM(data, BPHYS_DATA_SIZE, &pa->size); - PTCACHE_DATA_FROM(data, BPHYS_DATA_TIMES, times); - - if (boid) { - PTCACHE_DATA_FROM(data, BPHYS_DATA_BOIDS, &boid->data); - } - - /* return flag 1+1=2 for newly born particles to copy exact birth location to previously cached frame */ - return 1 + (pa->state.time >= pa->time && pa->prev_state.time <= pa->time); -} -static void ptcache_particle_read(int index, void *psys_v, void **data, float cfra, float *old_data) -{ - ParticleSystem *psys= psys_v; - ParticleData *pa; - BoidParticle *boid; - float timestep = 0.04f * psys->part->timetweak; - - if (index >= psys->totpart) - return; - - pa = psys->particles + index; - boid = (psys->part->phystype == PART_PHYS_BOIDS) ? pa->boid : NULL; - - if (cfra > pa->state.time) - memcpy(&pa->prev_state, &pa->state, sizeof(ParticleKey)); - - if (old_data) { - /* old format cache */ - memcpy(&pa->state, old_data, sizeof(ParticleKey)); - return; - } - - BKE_ptcache_make_particle_key(&pa->state, 0, data, cfra); - - /* set frames cached before birth to birth time */ - if (cfra < pa->time) - pa->state.time = pa->time; - else if (cfra > pa->dietime) - pa->state.time = pa->dietime; - - if (data[BPHYS_DATA_SIZE]) { - PTCACHE_DATA_TO(data, BPHYS_DATA_SIZE, 0, &pa->size); - } - - if (data[BPHYS_DATA_TIMES]) { - float times[3]; - PTCACHE_DATA_TO(data, BPHYS_DATA_TIMES, 0, ×); - pa->time = times[0]; - pa->dietime = times[1]; - pa->lifetime = times[2]; - } - - if (boid) { - PTCACHE_DATA_TO(data, BPHYS_DATA_BOIDS, 0, &boid->data); - } - - /* determine velocity from previous location */ - if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_VELOCITY]) { - if (cfra > pa->prev_state.time) { - sub_v3_v3v3(pa->state.vel, pa->state.co, pa->prev_state.co); - mul_v3_fl(pa->state.vel, (cfra - pa->prev_state.time) * timestep); - } - else { - sub_v3_v3v3(pa->state.vel, pa->prev_state.co, pa->state.co); - mul_v3_fl(pa->state.vel, (pa->prev_state.time - cfra) * timestep); - } - } - - /* default to no rotation */ - if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_ROTATION]) { - unit_qt(pa->state.rot); - } -} -static void ptcache_particle_interpolate(int index, void *psys_v, void **data, float cfra, float cfra1, float cfra2, float *old_data) -{ - ParticleSystem *psys= psys_v; - ParticleData *pa; - ParticleKey keys[4]; - float dfra, timestep = 0.04f * psys->part->timetweak; - - if (index >= psys->totpart) - return; - - pa = psys->particles + index; - - /* particle wasn't read from first cache so can't interpolate */ - if ((int)cfra1 < pa->time - psys->pointcache->step || (int)cfra1 > pa->dietime + psys->pointcache->step) - return; - - cfra = MIN2(cfra, pa->dietime); - cfra1 = MIN2(cfra1, pa->dietime); - cfra2 = MIN2(cfra2, pa->dietime); - - if (cfra1 == cfra2) - return; - - memcpy(keys+1, &pa->state, sizeof(ParticleKey)); - if (old_data) - memcpy(keys+2, old_data, sizeof(ParticleKey)); - else - BKE_ptcache_make_particle_key(keys+2, 0, data, cfra2); - - /* determine velocity from previous location */ - if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_VELOCITY]) { - if (keys[1].time > keys[2].time) { - sub_v3_v3v3(keys[2].vel, keys[1].co, keys[2].co); - mul_v3_fl(keys[2].vel, (keys[1].time - keys[2].time) * timestep); - } - else { - sub_v3_v3v3(keys[2].vel, keys[2].co, keys[1].co); - mul_v3_fl(keys[2].vel, (keys[2].time - keys[1].time) * timestep); - } - } - - /* determine rotation from velocity */ - if (data[BPHYS_DATA_LOCATION] && !data[BPHYS_DATA_ROTATION]) { - vec_to_quat(keys[2].rot, keys[2].vel, OB_NEGX, OB_POSZ); - } - - if (cfra > pa->time) - cfra1 = MAX2(cfra1, pa->time); - - dfra = cfra2 - cfra1; - - mul_v3_fl(keys[1].vel, dfra * timestep); - mul_v3_fl(keys[2].vel, dfra * timestep); - - interpolate_particle_keys(-1, keys, (cfra - cfra1) / dfra, &pa->state, 1); - interp_qt_qtqt(pa->state.rot, keys[1].rot, keys[2].rot, (cfra - cfra1) / dfra); - - mul_v3_fl(pa->state.vel, 1.f / (dfra * timestep)); - - pa->state.time = cfra; -} - -static int ptcache_particle_totpoint(void *psys_v, int UNUSED(cfra)) -{ - ParticleSystem *psys = psys_v; - return psys->totpart; -} - -static void ptcache_particle_error(void *UNUSED(psys_v), const char *UNUSED(message)) -{ - /* ignored for now */ -} - -static int ptcache_particle_totwrite(void *psys_v, int cfra) -{ - ParticleSystem *psys = psys_v; - ParticleData *pa= psys->particles; - int p, step = psys->pointcache->step; - int totwrite = 0; - - if (cfra == 0) - return psys->totpart; - - for (p=0; p<psys->totpart; p++, pa++) - totwrite += (cfra >= pa->time - step && cfra <= pa->dietime + step); - - return totwrite; -} - -static void ptcache_particle_extra_write(void *psys_v, PTCacheMem *pm, int UNUSED(cfra)) -{ - ParticleSystem *psys = psys_v; - PTCacheExtra *extra = NULL; - - if (psys->part->phystype == PART_PHYS_FLUID && - psys->part->fluid && psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS && - psys->tot_fluidsprings && psys->fluid_springs) { - - extra = MEM_callocN(sizeof(PTCacheExtra), "Point cache: fluid extra data"); - - extra->type = BPHYS_EXTRA_FLUID_SPRINGS; - extra->totdata = psys->tot_fluidsprings; - - extra->data = MEM_callocN(extra->totdata * ptcache_extra_datasize[extra->type], "Point cache: extra data"); - memcpy(extra->data, psys->fluid_springs, extra->totdata * ptcache_extra_datasize[extra->type]); - - BLI_addtail(&pm->extradata, extra); - } -} - -static void ptcache_particle_extra_read(void *psys_v, PTCacheMem *pm, float UNUSED(cfra)) -{ - ParticleSystem *psys = psys_v; - PTCacheExtra *extra = pm->extradata.first; - - for (; extra; extra=extra->next) { - switch (extra->type) { - case BPHYS_EXTRA_FLUID_SPRINGS: - { - if (psys->fluid_springs) - MEM_freeN(psys->fluid_springs); - - psys->fluid_springs = MEM_dupallocN(extra->data); - psys->tot_fluidsprings = psys->alloc_fluidsprings = extra->totdata; - break; - } - } - } -} /* Cloth functions */ static int ptcache_cloth_write(int index, void *cloth_v, void **data, int UNUSED(cfra)) @@ -543,7 +318,7 @@ static void ptcache_cloth_interpolate(int index, void *cloth_v, void **data, flo ClothModifierData *clmd= cloth_v; Cloth *cloth= clmd->clothObject; ClothVertex *vert = cloth->verts + index; - ParticleKey keys[4]; + PointCacheKey keys[4]; float dfra; if (cfra1 == cfra2) @@ -557,7 +332,7 @@ static void ptcache_cloth_interpolate(int index, void *cloth_v, void **data, flo memcpy(keys[2].vel, old_data + 6, 3 * sizeof(float)); } else - BKE_ptcache_make_particle_key(keys+2, 0, data, cfra2); + BKE_ptcache_make_key(keys+2, 0, data, cfra2); dfra = cfra2 - cfra1; @@ -1368,8 +1143,8 @@ static void ptcache_rigidbody_interpolate(int index, void *rb_v, void **data, fl RigidBodyOb *rbo = ob->rigidbody_object; if (rbo->type == RBO_TYPE_ACTIVE) { - ParticleKey keys[4]; - ParticleKey result; + PointCacheKey keys[4]; + PointCacheKey result; float dfra; memset(keys, 0, sizeof(keys)); @@ -1382,7 +1157,7 @@ static void ptcache_rigidbody_interpolate(int index, void *rb_v, void **data, fl memcpy(keys[2].rot, data + 3, 4 * sizeof(float)); } else { - BKE_ptcache_make_particle_key(&keys[2], 0, data, cfra2); + BKE_ptcache_make_key(&keys[2], 0, data, cfra2); } dfra = cfra2 - cfra1; @@ -1448,68 +1223,6 @@ void BKE_ptcache_id_from_softbody(PTCacheID *pid, Object *ob, SoftBody *sb) pid->max_step = 20; pid->file_type = PTCACHE_FILE_PTCACHE; } -void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *psys) -{ - memset(pid, 0, sizeof(PTCacheID)); - - pid->ob= ob; - pid->calldata= psys; - pid->type= 0xdeadbeef; - pid->stack_index= psys->pointcache->index; - pid->cache= psys->pointcache; - pid->cache_ptr= &psys->pointcache; - pid->ptcaches= &psys->ptcaches; - - if (psys->part->type != PART_HAIR) - pid->flag |= PTCACHE_VEL_PER_SEC; - - pid->totpoint = ptcache_particle_totpoint; - pid->totwrite = ptcache_particle_totwrite; - pid->error = ptcache_particle_error; - - pid->write_point = ptcache_particle_write; - pid->read_point = ptcache_particle_read; - pid->interpolate_point = ptcache_particle_interpolate; - - pid->write_stream = NULL; - pid->read_stream = NULL; - - pid->write_openvdb_stream = NULL; - pid->read_openvdb_stream = NULL; - - pid->write_extra_data = NULL; - pid->read_extra_data = NULL; - pid->interpolate_extra_data = NULL; - - pid->write_header = ptcache_basic_header_write; - pid->read_header = ptcache_basic_header_read; - - pid->data_types = (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_VELOCITY) | (1<<BPHYS_DATA_INDEX); - - if (psys->part->phystype == PART_PHYS_BOIDS) - pid->data_types|= (1<<BPHYS_DATA_AVELOCITY) | (1<<BPHYS_DATA_ROTATION) | (1<<BPHYS_DATA_BOIDS); - else if (psys->part->phystype == PART_PHYS_FLUID && psys->part->fluid && psys->part->fluid->flag & SPH_VISCOELASTIC_SPRINGS) { - pid->write_extra_data = ptcache_particle_extra_write; - pid->read_extra_data = ptcache_particle_extra_read; - } - - 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_RAND || - psys->part->avefac != 0.0f) - { - pid->data_types |= (1 << BPHYS_DATA_AVELOCITY); - } - } - - pid->info_types= (1<<BPHYS_DATA_TIMES); - - pid->default_step = 10; - pid->max_step = 20; - pid->file_type = PTCACHE_FILE_PTCACHE; -} void BKE_ptcache_id_from_cloth(PTCacheID *pid, Object *ob, ClothModifierData *clmd) { memset(pid, 0, sizeof(PTCacheID)); @@ -1682,7 +1395,6 @@ void BKE_ptcache_id_from_rigidbody(PTCacheID *pid, Object *ob, RigidBodyWorld *r void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int duplis) { PTCacheID *pid; - ParticleSystem *psys; ModifierData *md; lb->first= lb->last= NULL; @@ -1693,26 +1405,6 @@ void BKE_ptcache_ids_from_object(ListBase *lb, Object *ob, Scene *scene, int dup BLI_addtail(lb, pid); } - for (psys=ob->particlesystem.first; psys; psys=psys->next) { - if (psys->part==NULL) - continue; - - /* check to make sure point cache is actually used by the particles */ - if (ELEM(psys->part->phystype, PART_PHYS_NO, PART_PHYS_KEYED)) - continue; - - /* hair needs to be included in id-list for cache edit mode to work */ - /* if (psys->part->type == PART_HAIR && (psys->flag & PSYS_HAIR_DYNAMICS)==0) */ - /* continue; */ - - if (psys->part->type == PART_FLUID) - continue; - - pid= MEM_callocN(sizeof(PTCacheID), "PTCacheID"); - BKE_ptcache_id_from_particles(pid, ob, psys); - BLI_addtail(lb, pid); - } - for (md=ob->modifiers.first; md; md=md->next) { if (md->type == eModifierType_Cloth) { pid= MEM_callocN(sizeof(PTCacheID), "PTCacheID"); diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 0f1f9b4bdf7..d6fe4c3cad1 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -1255,7 +1255,7 @@ static void rigidbody_update_sim_ob(Scene *scene, RigidBodyWorld *rbw, Object *o ListBase *effectors; /* get effectors present in the group specified by effector_weights */ - effectors = pdInitEffectors(scene, ob, NULL, effector_weights, true); + effectors = pdInitEffectors(scene, ob, effector_weights, true); if (effectors) { float eff_force[3] = {0.0f, 0.0f, 0.0f}; float eff_loc[3], eff_vel[3]; diff --git a/source/blender/blenkernel/intern/smoke.c b/source/blender/blenkernel/intern/smoke.c index b8fe669cab0..fcb7320352f 100644 --- a/source/blender/blenkernel/intern/smoke.c +++ b/source/blender/blenkernel/intern/smoke.c @@ -57,7 +57,6 @@ #include "DNA_meshdata_types.h" #include "DNA_modifier_types.h" #include "DNA_object_types.h" -#include "DNA_particle_types.h" #include "DNA_scene_types.h" #include "DNA_smoke_types.h" @@ -2198,7 +2197,7 @@ static void update_effectors(Scene *scene, Object *ob, SmokeDomainSettings *sds, ListBase *effectors; /* make sure smoke flow influence is 0.0f */ sds->effector_weights->weight[PFIELD_SMOKEFLOW] = 0.0f; - effectors = pdInitEffectors(scene, ob, NULL, sds->effector_weights, true); + effectors = pdInitEffectors(scene, ob, sds->effector_weights, true); if (effectors) { // precalculate wind forces diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index 25a4fdc0cc7..e5673637c23 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -1499,7 +1499,7 @@ static void scan_for_ext_spring_forces(Scene *scene, Object *ob, float timenow) SoftBody *sb = ob->soft; ListBase *do_effector = NULL; - do_effector = pdInitEffectors(scene, ob, NULL, sb->effector_weights, true); + do_effector = pdInitEffectors(scene, ob, sb->effector_weights, true); _scan_for_ext_spring_forces(scene, ob, timenow, 0, sb->totspring, do_effector); pdEndEffectors(&do_effector); } @@ -1519,7 +1519,7 @@ static void sb_sfesf_threads_run(Scene *scene, struct Object *ob, float timenow, int i, totthread, left, dec; int lowsprings =100; /* wild guess .. may increase with better thread management 'above' or even be UI option sb->spawn_cf_threads_nopts */ - do_effector= pdInitEffectors(scene, ob, NULL, ob->soft->effector_weights, true); + do_effector= pdInitEffectors(scene, ob, ob->soft->effector_weights, true); /* figure the number of threads while preventing pretty pointless threading overhead */ totthread= BKE_scene_num_threads(scene); @@ -2209,7 +2209,7 @@ static void softbody_calc_forcesEx(Scene *scene, Object *ob, float forcetime, fl sb_sfesf_threads_run(scene, ob, timenow, sb->totspring, NULL); /* after spring scan because it uses Effoctors too */ - do_effector= pdInitEffectors(scene, ob, NULL, sb->effector_weights, true); + do_effector= pdInitEffectors(scene, ob, sb->effector_weights, true); if (do_deflector) { float defforce[3]; @@ -2271,7 +2271,7 @@ static void softbody_calc_forces(Scene *scene, Object *ob, float forcetime, floa if (do_springcollision || do_aero) scan_for_ext_spring_forces(scene, ob, timenow); /* after spring scan because it uses Effoctors too */ - do_effector= pdInitEffectors(scene, ob, NULL, ob->soft->effector_weights, true); + do_effector= pdInitEffectors(scene, ob, ob->soft->effector_weights, true); if (do_deflector) { float defforce[3]; diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c index d353042b711..69152f23476 100644 --- a/source/blender/blenkernel/intern/texture.c +++ b/source/blender/blenkernel/intern/texture.c @@ -50,7 +50,6 @@ #include "DNA_brush_types.h" #include "DNA_node_types.h" #include "DNA_color_types.h" -#include "DNA_particle_types.h" #include "DNA_linestyle_types.h" #include "IMB_imbuf.h" @@ -910,7 +909,6 @@ void BKE_texture_make_local(Tex *tex) World *wrld; Lamp *la; Brush *br; - ParticleSettings *pa; FreestyleLineStyle *ls; int a; bool is_local = false, is_lib = false; @@ -970,16 +968,6 @@ void BKE_texture_make_local(Tex *tex) } br = br->id.next; } - pa = bmain->particle.first; - while (pa) { - for (a = 0; a < MAX_MTEX; a++) { - if (pa->mtex[a] && pa->mtex[a]->tex == tex) { - if (pa->id.lib) is_lib = true; - else is_local = true; - } - } - pa = pa->id.next; - } ls = bmain->linestyle.first; while (ls) { for (a = 0; a < MAX_MTEX; a++) { @@ -1060,19 +1048,6 @@ void BKE_texture_make_local(Tex *tex) } br = br->id.next; } - pa = bmain->particle.first; - while (pa) { - for (a = 0; a < MAX_MTEX; a++) { - if (pa->mtex[a] && pa->mtex[a]->tex == tex) { - if (pa->id.lib == NULL) { - pa->mtex[a]->tex = tex_new; - id_us_plus(&tex_new->id); - id_us_min(&tex->id); - } - } - } - pa = pa->id.next; - } ls = bmain->linestyle.first; while (ls) { for (a = 0; a < MAX_MTEX; a++) { @@ -1235,10 +1210,6 @@ bool give_active_mtex(ID *id, MTex ***mtex_ar, short *act) *mtex_ar = ((FreestyleLineStyle *)id)->mtex; if (act) *act = (((FreestyleLineStyle *)id)->texact); break; - case ID_PA: - *mtex_ar = ((ParticleSettings *)id)->mtex; - if (act) *act = (((ParticleSettings *)id)->texact); - break; default: *mtex_ar = NULL; if (act) *act = 0; @@ -1266,9 +1237,6 @@ void set_active_mtex(ID *id, short act) case ID_LS: ((FreestyleLineStyle *)id)->texact = act; break; - case ID_PA: - ((ParticleSettings *)id)->texact = act; - break; } } @@ -1378,42 +1346,6 @@ void set_current_brush_texture(Brush *br, Tex *newtex) } } -Tex *give_current_particle_texture(ParticleSettings *part) -{ - MTex *mtex = NULL; - Tex *tex = NULL; - - if (!part) return NULL; - - mtex = part->mtex[(int)(part->texact)]; - if (mtex) tex = mtex->tex; - - return tex; -} - -void set_current_particle_texture(ParticleSettings *part, Tex *newtex) -{ - int act = part->texact; - - if (part->mtex[act] && part->mtex[act]->tex) - id_us_min(&part->mtex[act]->tex->id); - - if (newtex) { - if (!part->mtex[act]) { - part->mtex[act] = BKE_texture_mtex_add(); - part->mtex[act]->texco = TEXCO_ORCO; - part->mtex[act]->blendtype = MTEX_MUL; - } - - part->mtex[act]->tex = newtex; - id_us_plus(&newtex->id); - } - else if (part->mtex[act]) { - MEM_freeN(part->mtex[act]); - part->mtex[act] = NULL; - } -} - /* ------------------------------------------------------------------------- */ EnvMap *BKE_texture_envmap_add(void) |