Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/particle.c')
-rw-r--r--source/blender/blenkernel/intern/particle.c196
1 files changed, 100 insertions, 96 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 3fea9e44acb..74a754c0ca8 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -46,7 +46,7 @@
#include "DNA_object_types.h"
#include "DNA_curve_types.h"
#include "DNA_key_types.h"
-#include "DNA_ipo_types.h"
+#include "DNA_ipo_types.h" // XXX old animation system stuff to remove!
#include "BLI_arithb.h"
#include "BLI_blenlib.h"
@@ -65,20 +65,17 @@
#include "BKE_displist.h"
#include "BKE_particle.h"
#include "BKE_DerivedMesh.h"
-#include "BKE_ipo.h"
#include "BKE_object.h"
#include "BKE_softbody.h"
#include "BKE_material.h"
#include "BKE_key.h"
#include "BKE_library.h"
#include "BKE_depsgraph.h"
-#include "BKE_bad_level_calls.h"
#include "BKE_modifier.h"
#include "BKE_mesh.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_pointcache.h"
-#include "blendef.h"
#include "RE_render_ext.h"
static void key_from_object(Object *ob, ParticleKey *key);
@@ -242,11 +239,11 @@ void psys_change_act(void *ob_v, void *act_v)
npsys->flag |= PSYS_CURRENT;
}
}
-Object *psys_get_lattice(Object *ob, ParticleSystem *psys)
+Object *psys_get_lattice(Scene *scene, Object *ob, ParticleSystem *psys)
{
Object *lattice=0;
- if(psys_in_edit_mode(psys)==0){
+ if(psys_in_edit_mode(scene, psys)==0){
ModifierData *md = (ModifierData*)psys_get_modifier(ob,psys);
@@ -287,9 +284,9 @@ int psys_ob_has_hair(Object *ob)
return 0;
}
-int psys_in_edit_mode(ParticleSystem *psys)
+int psys_in_edit_mode(Scene *scene, ParticleSystem *psys)
{
- return ((G.f & G_PARTICLEEDIT) && psys==psys_get_current(OBACT) && psys->edit);
+ return ((G.f & G_PARTICLEEDIT) && psys==psys_get_current((scene->basact)->object) && psys->edit);
}
int psys_check_enabled(Object *ob, ParticleSystem *psys)
{
@@ -351,8 +348,19 @@ void free_hair(ParticleSystem *psys, int softbody)
}
void free_keyed_keys(ParticleSystem *psys)
{
- if(psys->particles && psys->particles->keys)
+ ParticleData *pa;
+ int i;
+
+ if(psys->particles && psys->particles->keys) {
MEM_freeN(psys->particles->keys);
+
+ for(i=0, pa=psys->particles; i<psys->totpart; i++, pa++) {
+ if(pa->keys) {
+ pa->keys= NULL;
+ pa->totkey= 0;
+ }
+ }
+ }
}
void free_child_path_cache(ParticleSystem *psys)
{
@@ -394,7 +402,8 @@ void psys_free(Object *ob, ParticleSystem * psys)
free_keyed_keys(psys);
- PE_free_particle_edit(psys);
+ if(psys->edit && psys->free_edit)
+ psys->free_edit(psys);
if(psys->particles){
MEM_freeN(psys->particles);
@@ -1410,6 +1419,7 @@ static float vert_weight(MDeformVert *dvert, int group)
}
return 0.0;
}
+
static void do_prekink(ParticleKey *state, ParticleKey *par, float *par_rot, float time, float freq, float shape, float amplitude, short type, short axis, float obmat[][4])
{
float vec[3]={0.0,0.0,0.0}, q1[4]={1,0,0,0},q2[4];
@@ -1544,6 +1554,7 @@ static void do_prekink(ParticleKey *state, ParticleKey *par, float *par_rot, flo
break;
}
}
+
static void do_clump(ParticleKey *state, ParticleKey *par, float time, float clumpfac, float clumppow, float pa_clump)
{
if(par && clumpfac!=0.0){
@@ -1561,7 +1572,8 @@ static void do_clump(ParticleKey *state, ParticleKey *par, float time, float clu
VecLerpf(state->co,state->co,par->co,clump);
}
}
-int do_guide(ParticleKey *state, int pa_num, float time, ListBase *lb)
+
+int do_guide(Scene *scene, ParticleKey *state, int pa_num, float time, ListBase *lb)
{
PartDeflect *pd;
ParticleEffectorCache *ec;
@@ -1644,7 +1656,7 @@ int do_guide(ParticleKey *state, int pa_num, float time, ListBase *lb)
/* curve taper */
if(cu->taperobj)
- VecMulf(pa_loc,calc_taper(cu->taperobj,(int)(f_force*guidetime*100.0),100));
+ VecMulf(pa_loc, calc_taper(scene, cu->taperobj, (int)(f_force*guidetime*100.0), 100));
/* TODO */
//else{
///* curve size*/
@@ -1719,7 +1731,7 @@ static void do_rough_end(float *loc, float t, float fac, float shape, ParticleKe
VECADD(state->co,state->co,rough);
}
-static void do_path_effectors(Object *ob, ParticleSystem *psys, int i, ParticleCacheKey *ca, int k, int steps, float *rootco, float effector, float dfra, float cfra, float *length, float *vec)
+static void do_path_effectors(Scene *scene, Object *ob, ParticleSystem *psys, int i, ParticleCacheKey *ca, int k, int steps, float *rootco, float effector, float dfra, float cfra, float *length, float *vec)
{
float force[3] = {0.0f,0.0f,0.0f}, vel[3] = {0.0f,0.0f,0.0f};
ParticleKey eff_key;
@@ -1730,7 +1742,7 @@ static void do_path_effectors(Object *ob, ParticleSystem *psys, int i, ParticleC
QUATCOPY(eff_key.rot,(ca-1)->rot);
pa= psys->particles+i;
- do_effectors(i, pa, &eff_key, ob, psys, rootco, force, vel, dfra, cfra);
+ do_effectors(i, pa, &eff_key, scene, ob, psys, rootco, force, vel, dfra, cfra);
VecMulf(force, effector*pow((float)k / (float)steps, 100.0f * psys->part->eff_hair) / (float)steps);
@@ -1738,12 +1750,12 @@ static void do_path_effectors(Object *ob, ParticleSystem *psys, int i, ParticleC
Normalize(force);
+ VECADDFAC(ca->co, (ca-1)->co, force, *length);
+
if(k < steps) {
VecSubf(vec, (ca+1)->co, ca->co);
*length = VecLength(vec);
}
-
- VECADDFAC(ca->co, (ca-1)->co, force, *length);
}
static int check_path_length(int k, ParticleCacheKey *keys, ParticleCacheKey *state, float max_length, float *cur_length, float length, float *dvec)
{
@@ -1856,20 +1868,20 @@ static void get_strand_normal(Material *ma, float *surfnor, float surfdist, floa
VECCOPY(nor, vnor);
}
-int psys_threads_init_path(ParticleThread *threads, float cfra, int editupdate)
+int psys_threads_init_path(ParticleThread *threads, Scene *scene, float cfra, int editupdate)
{
ParticleThreadContext *ctx= threads[0].ctx;
Object *ob= ctx->ob;
ParticleSystem *psys= ctx->psys;
ParticleSettings *part = psys->part;
- ParticleEditSettings *pset = &G.scene->toolsettings->particle;
+ ParticleEditSettings *pset = &scene->toolsettings->particle;
int totparent=0, between=0;
int steps = (int)pow(2.0,(double)part->draw_step);
int totchild = psys->totchild;
int i, seed, totthread= threads[0].tot;
/*---start figuring out what is actually wanted---*/
- if(psys_in_edit_mode(psys))
+ if(psys_in_edit_mode(scene, psys))
if(psys->renderdata==0 && (psys->edit==NULL || pset->flag & PE_SHOW_CHILD)==0)
totchild=0;
@@ -1914,7 +1926,7 @@ int psys_threads_init_path(ParticleThread *threads, float cfra, int editupdate)
ctx->parent_pass= 0;
ctx->cfra= cfra;
- psys->lattice = psys_get_lattice(ob, psys);
+ psys->lattice = psys_get_lattice(scene, ob, psys);
/* cache all relevant vertex groups if they exist */
if(part->from!=PART_FROM_PARTICLE){
@@ -1929,10 +1941,12 @@ int psys_threads_init_path(ParticleThread *threads, float cfra, int editupdate)
}
/* set correct ipo timing */
+#if 0 // XXX old animation system
if(part->flag&PART_ABS_TIME && part->ipo){
calc_ipo(part->ipo, cfra);
execute_ipo((ID *)part, part->ipo);
}
+#endif // XXX old animation system
return 1;
}
@@ -2047,11 +2061,13 @@ void psys_thread_create_path(ParticleThread *thread, struct ChildParticle *cpa,
keys->steps = ctx->steps;
/* correct child ipo timing */
+#if 0 // XXX old animation system
if((part->flag&PART_ABS_TIME)==0 && part->ipo){
float dsta=part->end-part->sta;
calc_ipo(part->ipo, 100.0f*(ctx->cfra-(part->sta+dsta*cpa->rand[1]))/(part->lifetime*(1.0f - part->randlife*cpa->rand[0])));
execute_ipo((ID *)part, part->ipo);
}
+#endif // XXX old animation system
/* get different child parameters from textures & vgroups */
ptex.length=part->length*(1.0f - part->randlength*cpa->rand[0]);
@@ -2133,7 +2149,7 @@ void psys_thread_create_path(ParticleThread *thread, struct ChildParticle *cpa,
if(part->flag & PART_CHILD_EFFECT) {
for(k=0,state=keys; k<=ctx->steps; k++,state++) {
if(k) {
- do_path_effectors(ob, psys, cpa->pa[0], state, k, ctx->steps, keys->co, pa_effector, 0.0f, ctx->cfra, &eff_length, eff_vec);
+ do_path_effectors(ctx->scene, ob, psys, cpa->pa[0], state, k, ctx->steps, keys->co, pa_effector, 0.0f, ctx->cfra, &eff_length, eff_vec);
}
else {
VecSubf(eff_vec,(state+1)->co,state->co);
@@ -2161,7 +2177,7 @@ void psys_thread_create_path(ParticleThread *thread, struct ChildParticle *cpa,
/* apply different deformations to the child path */
if(part->flag & PART_CHILD_EFFECT)
/* state is safe to cast, since only co and vel are used */
- guided = do_guide((ParticleKey*)state, cpa->parent, t, &(psys->effectors));
+ guided = do_guide(ctx->scene, (ParticleKey*)state, cpa->parent, t, &(psys->effectors));
if(guided==0){
if(part->kink)
@@ -2278,7 +2294,7 @@ static void *exec_child_path_cache(void *data)
return 0;
}
-void psys_cache_child_paths(Object *ob, ParticleSystem *psys, float cfra, int editupdate)
+void psys_cache_child_paths(Scene *scene, Object *ob, ParticleSystem *psys, float cfra, int editupdate)
{
ParticleSettings *part = psys->part;
ParticleThread *pthreads;
@@ -2287,9 +2303,9 @@ void psys_cache_child_paths(Object *ob, ParticleSystem *psys, float cfra, int ed
ListBase threads;
int i, totchild, totparent, totthread;
- pthreads= psys_threads_create(ob, psys);
+ pthreads= psys_threads_create(scene, ob, psys);
- if(!psys_threads_init_path(pthreads, cfra, editupdate)) {
+ if(!psys_threads_init_path(pthreads, scene, cfra, editupdate)) {
psys_threads_free(pthreads);
return;
}
@@ -2344,11 +2360,11 @@ void psys_cache_child_paths(Object *ob, ParticleSystem *psys, float cfra, int ed
/* -Usefull for making use of opengl vertex arrays for super fast strand drawing. */
/* -Makes child strands possible and creates them too into the cache. */
/* -Cached path data is also used to determine cut position for the editmode tool. */
-void psys_cache_paths(Object *ob, ParticleSystem *psys, float cfra, int editupdate)
+void psys_cache_paths(Scene *scene, Object *ob, ParticleSystem *psys, float cfra, int editupdate)
{
ParticleCacheKey *ca, **cache=psys->pathcache;
ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
- ParticleEditSettings *pset = &G.scene->toolsettings->particle;
+ ParticleEditSettings *pset = &scene->toolsettings->particle;
ParticleSettings *part = psys->part;
ParticleData *pa;
@@ -2364,13 +2380,12 @@ void psys_cache_paths(Object *ob, ParticleSystem *psys, float cfra, int editupda
Material *ma;
float birthtime = 0.0, dietime = 0.0;
- float t, time = 0.0, keytime = 0.0, dfra = 1.0, frs_sec = G.scene->r.frs_sec;
+ float t, time = 0.0, keytime = 0.0, dfra = 1.0, frs_sec = scene->r.frs_sec;
float col[3] = {0.5f, 0.5f, 0.5f};
float prev_tangent[3], hairmat[4][4];
int k,i;
int steps = (int)pow(2.0, (double)psys->part->draw_step);
int totpart = psys->totpart;
- char nosel[4], sel[4];
float sel_col[3];
float nosel_col[3];
float length, vec[3];
@@ -2382,25 +2397,25 @@ void psys_cache_paths(Object *ob, ParticleSystem *psys, float cfra, int editupda
if((psys->flag & PSYS_HAIR_DONE)==0 && (psys->flag & PSYS_KEYED)==0)
return;
- if(psys->renderdata)
+ if(psys->renderdata) {
steps = (int)pow(2.0, (double)psys->part->ren_step);
- else if(psys_in_edit_mode(psys)){
+ }
+ else if(psys_in_edit_mode(scene, psys)) {
edit=psys->edit;
//timed = edit->draw_timed;
- PE_get_colors(sel,nosel);
- if(pset->brushtype == PE_BRUSH_WEIGHT){
+ if(pset->brushtype == PE_BRUSH_WEIGHT) {
sel_col[0] = sel_col[1] = sel_col[2] = 1.0f;
nosel_col[0] = nosel_col[1] = nosel_col[2] = 0.0f;
}
else{
- sel_col[0] = (float)sel[0] / 255.0f;
- sel_col[1] = (float)sel[1] / 255.0f;
- sel_col[2] = (float)sel[2] / 255.0f;
- nosel_col[0] = (float)nosel[0] / 255.0f;
- nosel_col[1] = (float)nosel[1] / 255.0f;
- nosel_col[2] = (float)nosel[2] / 255.0f;
+ sel_col[0] = (float)edit->sel_col[0] / 255.0f;
+ sel_col[1] = (float)edit->sel_col[1] / 255.0f;
+ sel_col[2] = (float)edit->sel_col[2] / 255.0f;
+ nosel_col[0] = (float)edit->nosel_col[0] / 255.0f;
+ nosel_col[1] = (float)edit->nosel_col[1] / 255.0f;
+ nosel_col[2] = (float)edit->nosel_col[2] / 255.0f;
}
}
@@ -2420,7 +2435,7 @@ void psys_cache_paths(Object *ob, ParticleSystem *psys, float cfra, int editupda
soft= NULL;
}
- psys->lattice = psys_get_lattice(ob, psys);
+ psys->lattice = psys_get_lattice(scene, ob, psys);
ma= give_current_material(ob, psys->part->omat);
if(ma && (psys->part->draw & PART_DRAW_MAT_COL))
VECCOPY(col, &ma->r)
@@ -2613,16 +2628,16 @@ void psys_cache_paths(Object *ob, ParticleSystem *psys, float cfra, int editupda
for(k=0, ca=cache[i]; k<=steps; k++, ca++) {
/* apply effectors */
if(!(psys->part->flag & PART_CHILD_EFFECT) && edit==0 && k)
- do_path_effectors(ob, psys, i, ca, k, steps, cache[i]->co, effector, dfra, cfra, &length, vec);
+ do_path_effectors(scene, ob, psys, i, ca, k, steps, cache[i]->co, effector, dfra, cfra, &length, vec);
/* apply guide curves to path data */
if(edit==0 && psys->effectors.first && (psys->part->flag & PART_CHILD_EFFECT)==0)
/* ca is safe to cast, since only co and vel are used */
- do_guide((ParticleKey*)ca, i, (float)k/(float)steps, &psys->effectors);
+ do_guide(scene, (ParticleKey*)ca, i, (float)k/(float)steps, &psys->effectors);
/* apply lattice */
if(psys->lattice && edit==0)
- calc_latt_deform(ca->co, 1.0f);
+ calc_latt_deform(psys->lattice, ca->co, 1.0f);
/* figure out rotation */
@@ -2702,8 +2717,8 @@ void psys_cache_paths(Object *ob, ParticleSystem *psys, float cfra, int editupda
psys->totcached = totpart;
if(psys && psys->lattice){
- end_latt_deform();
- psys->lattice=0;
+ end_latt_deform(psys->lattice);
+ psys->lattice= NULL;
}
if(vg_effector)
@@ -2957,7 +2972,9 @@ static void default_particle_settings(ParticleSettings *part)
part->boidfac[i]=0.5;
}
+#if 0 // XXX old animation system
part->ipo = NULL;
+#endif // XXX old animation system
part->simplify_refsize= 1920;
part->simplify_rate= 1.0f;
@@ -3046,46 +3063,26 @@ void make_local_particlesettings(ParticleSettings *part)
}
}
-/* should be integrated to depgraph signals */
-void psys_flush_settings(ParticleSettings *part, int event, int hair_recalc)
+void psys_flush_particle_settings(Scene *scene, ParticleSettings *part, int recalc)
{
- Base *base;
- Object *ob, *tob;
+ Base *base = scene->base.first;
ParticleSystem *psys;
int flush;
- /* update all that have same particle settings */
- for(base = G.scene->base.first; base; base= base->next) {
- if(base->object->particlesystem.first) {
- ob=base->object;
- flush=0;
- for(psys=ob->particlesystem.first; psys; psys=psys->next){
- if(psys->part==part){
- psys->recalc |= event;
- if(hair_recalc)
- psys->recalc |= PSYS_RECALC_HAIR;
- flush++;
- }
- else if(psys->part->type==PART_REACTOR){
- ParticleSystem *tpsys;
- tob=psys->target_ob;
- if(tob==0)
- tob=ob;
- tpsys=BLI_findlink(&tob->particlesystem,psys->target_psys-1);
-
- if(tpsys && tpsys->part==part){
- psys->recalc |= event;
- flush++;
- }
- }
+ for(base = scene->base.first; base; base = base->next) {
+ flush = 0;
+ for(psys = base->object->particlesystem.first; psys; psys=psys->next) {
+ if(psys->part == part) {
+ psys->recalc |= recalc;
+ flush++;
}
- if(flush)
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
}
+ if(flush)
+ DAG_object_flush_update(scene, base->object, OB_RECALC_DATA);
}
}
-LinkNode *psys_using_settings(ParticleSettings *part, int flush_update)
+LinkNode *psys_using_settings(struct Scene *scene, ParticleSettings *part, int flush_update)
{
Object *ob, *tob;
ParticleSystem *psys, *tpsys;
@@ -3113,7 +3110,7 @@ LinkNode *psys_using_settings(ParticleSettings *part, int flush_update)
}
if(flush_update && found)
- DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
+ DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
}
return node;
@@ -3295,10 +3292,12 @@ float psys_get_size(Object *ob, Material *ma, ParticleSystemModifierData *psmd,
size=ptex.size;
}
+#if 0 // XXX old animation system
if(icu_size){
calc_icu(icu_size,pa->time);
size*=icu_size->curval;
}
+#endif // XXX old animation system
if(vg_size)
size*=psys_particle_value_from_verts(psmd->dm,part->from,pa,vg_size);
@@ -3331,11 +3330,12 @@ float psys_get_child_time(ParticleSystem *psys, ChildParticle *cpa, float cfra)
float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float cfra, float *pa_time)
{
ParticleSettings *part = psys->part;
- float size, time;
+ float size; // time XXX
if(part->childtype==PART_CHILD_FACES){
size=part->size;
+#if 0 // XXX old animation system
if((part->flag&PART_ABS_TIME)==0 && part->ipo){
IpoCurve *icu;
@@ -3352,6 +3352,7 @@ float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float cfra,
size = icu->curval;
}
}
+#endif // XXX old animation system
}
else
size=psys->particles[cpa->parent].size;
@@ -3364,7 +3365,7 @@ float psys_get_child_size(ParticleSystem *psys, ChildParticle *cpa, float cfra,
return size;
}
/* get's hair (or keyed) particles state at the "path time" specified in state->time */
-void psys_get_particle_on_path(Object *ob, ParticleSystem *psys, int p, ParticleKey *state, int vel)
+void psys_get_particle_on_path(Scene *scene, Object *ob, ParticleSystem *psys, int p, ParticleKey *state, int vel)
{
ParticleSettings *part = psys->part;
ParticleSystemModifierData *psmd = psys_get_modifier(ob, psys);
@@ -3376,7 +3377,7 @@ void psys_get_particle_on_path(Object *ob, ParticleSystem *psys, int p, Particle
HairKey *hkey[2] = {NULL, NULL};
ParticleKey *par=0, keys[4];
- float t, real_t, dfra, keytime, frs_sec = G.scene->r.frs_sec;
+ float t, real_t, dfra, keytime, frs_sec = scene->r.frs_sec;
float co[3], orco[3];
float hairmat[4][4];
float pa_clump = 0.0, pa_kink = 0.0;
@@ -3387,7 +3388,7 @@ void psys_get_particle_on_path(Object *ob, ParticleSystem *psys, int p, Particle
float *cpa_fuv; int cpa_num; short cpa_from;
- //if(psys_in_edit_mode(psys)){
+ //if(psys_in_edit_mode(scene, psys)){
// if((psys->edit_path->flag & PSYS_EP_SHOW_CHILD)==0)
// totchild=0;
// edit=1;
@@ -3471,7 +3472,7 @@ void psys_get_particle_on_path(Object *ob, ParticleSystem *psys, int p, Particle
}
//}
- //psys_get_particle_on_path(bsys,p,t,bkey,ckey[0]);
+ //psys_get_particle_on_path(scene, bsys,p,t,bkey,ckey[0]);
//if(part->rotfrom==PART_ROT_KEYS)
// QuatInterpol(state->rot,k2.rot,k3.rot,keytime);
@@ -3509,12 +3510,12 @@ void psys_get_particle_on_path(Object *ob, ParticleSystem *psys, int p, Particle
Mat4Mul3Vecfl(hairmat, state->vel);
if(psys->effectors.first && (part->flag & PART_CHILD_GUIDE)==0) {
- do_guide(state, p, state->time, &psys->effectors);
+ do_guide(scene, state, p, state->time, &psys->effectors);
/* TODO: proper velocity handling */
}
if(psys->lattice && edit==0)
- calc_latt_deform(state->co,1.0f);
+ calc_latt_deform(psys->lattice, state->co,1.0f);
}
}
}
@@ -3539,7 +3540,7 @@ void psys_get_particle_on_path(Object *ob, ParticleSystem *psys, int p, Particle
/* get parent states */
while(w<4 && cpa->pa[w]>=0){
keys[w].time = t;
- psys_get_particle_on_path(ob, psys, cpa->pa[w], keys+w, 1);
+ psys_get_particle_on_path(scene, ob, psys, cpa->pa[w], keys+w, 1);
w++;
}
@@ -3565,7 +3566,7 @@ void psys_get_particle_on_path(Object *ob, ParticleSystem *psys, int p, Particle
/* get the parent state */
keys->time = t;
- psys_get_particle_on_path(ob,psys,cpa->parent,keys,1);
+ psys_get_particle_on_path(scene, ob, psys, cpa->parent, keys,1);
/* get the original coordinates (orco) for texture usage */
pa=psys->particles+cpa->parent;
@@ -3578,11 +3579,13 @@ void psys_get_particle_on_path(Object *ob, ParticleSystem *psys, int p, Particle
}
/* correct child ipo timing */
+#if 0 // XXX old animation system
if((part->flag&PART_ABS_TIME)==0 && part->ipo){
calc_ipo(part->ipo, 100.0f*t);
execute_ipo((ID *)part, part->ipo);
}
-
+#endif // XXX old animation system
+
/* get different child parameters from textures & vgroups */
ptex.clump=1.0;
ptex.kink=1.0;
@@ -3651,19 +3654,19 @@ void psys_get_particle_on_path(Object *ob, ParticleSystem *psys, int p, Particle
//if(vel){
// if(t>=0.001f){
// tstate.time=t-0.001f;
- // psys_get_particle_on_path(ob,psys,p,&tstate,0);
+ // psys_get_particle_on_path(scene,ob,psys,p,&tstate,0);
// VECSUB(state->vel,state->co,tstate.co);
// }
// else{
// tstate.time=t+0.001f;
- // psys_get_particle_on_path(ob,psys,p,&tstate,0);
+ // psys_get_particle_on_path(scene, ob,psys,p,&tstate,0);
// VECSUB(state->vel,tstate.co,state->co);
// }
//}
}
}
/* gets particle's state at a time, returns 1 if particle exists and can be seen and 0 if not */
-int psys_get_particle_state(Object *ob, ParticleSystem *psys, int p, ParticleKey *state, int always){
+int psys_get_particle_state(struct Scene *scene, Object *ob, ParticleSystem *psys, int p, ParticleKey *state, int always){
ParticleSettings *part=psys->part;
ParticleData *pa=0;
float cfra;
@@ -3673,7 +3676,7 @@ int psys_get_particle_state(Object *ob, ParticleSystem *psys, int p, ParticleKey
if(state->time>0)
cfra=state->time;
else
- cfra=bsystem_time(0,(float)G.scene->r.cfra,0.0);
+ cfra= bsystem_time(scene, 0, (float)scene->r.cfra,0.0);
if(psys->totchild && p>=totpart){
if(part->from!=PART_FROM_PARTICLE && part->childtype==PART_CHILD_FACES){
@@ -3709,7 +3712,7 @@ int psys_get_particle_state(Object *ob, ParticleSystem *psys, int p, ParticleKey
else
state->time= (cfra-pa->time)/(pa->dietime-pa->time);
- psys_get_particle_on_path(ob,psys,p,state,1);
+ psys_get_particle_on_path(scene, ob, psys, p, state,1);
return 1;
}
else{
@@ -3741,7 +3744,7 @@ int psys_get_particle_state(Object *ob, ParticleSystem *psys, int p, ParticleKey
do_clump(state,key1,t,part->clumpfac,part->clumppow,1.0);
if(psys->lattice)
- calc_latt_deform(state->co,1.0f);
+ calc_latt_deform(psys->lattice, state->co,1.0f);
}
else{
if (pa) { /* TODO PARTICLE - should this ever be NULL? - Campbell */
@@ -3753,7 +3756,7 @@ int psys_get_particle_state(Object *ob, ParticleSystem *psys, int p, ParticleKey
/* let's interpolate to try to be as accurate as possible */
if(pa->state.time + 1.0f > state->time && pa->prev_state.time - 1.0f < state->time) {
ParticleKey keys[4];
- float dfra, keytime, frs_sec = G.scene->r.frs_sec;
+ float dfra, keytime, frs_sec = scene->r.frs_sec;
if(pa->prev_state.time >= pa->state.time) {
/* prev_state is wrong so let's not use it, this can happen at frame 1 or particle birth */
@@ -3793,7 +3796,7 @@ int psys_get_particle_state(Object *ob, ParticleSystem *psys, int p, ParticleKey
}
if(psys->lattice)
- calc_latt_deform(state->co,1.0f);
+ calc_latt_deform(psys->lattice, state->co,1.0f);
}
}
@@ -3974,4 +3977,5 @@ void psys_make_billboard(ParticleBillboardData *bb, float xvec[3], float yvec[3]
VECADDFAC(center, bb->vec, xvec, bb->offset[0]);
VECADDFAC(center, center, yvec, bb->offset[1]);
-} \ No newline at end of file
+}
+