diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-17 18:05:51 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-17 18:05:51 +0300 |
commit | 6fc8a74886a30f89562bb542ef3b24cc64b3208a (patch) | |
tree | df0503b6cf4f6b762eca66b90f4360c495d624aa /source/blender/blenkernel/intern/particle_system.c | |
parent | a262ea8c47f8106f66e16935c556f383ef306861 (diff) |
Cleanup: trailing space for blenkernel
Diffstat (limited to 'source/blender/blenkernel/intern/particle_system.c')
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 202 |
1 files changed, 101 insertions, 101 deletions
diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 9eaebc2c55c..fd63285ea85 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -238,7 +238,7 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart) } } } - + if (psys->particles) { totsaved=MIN2(psys->totpart,totpart); /*save old pars*/ @@ -268,7 +268,7 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart) MEM_freeN(psys->particles); psys_free_pdd(psys); } - + psys->particles=newpars; psys->totpart=totpart; @@ -313,14 +313,14 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm_final, DerivedMesh *dm_deform { /* use for building derived mesh mapping info: * - * node: the allocated links - total derived mesh element count + * node: the allocated links - total derived mesh element count * nodearray: the array of nodes aligned with the base mesh's elements, so * each original elements can reference its derived elements */ Mesh *me= (Mesh*)ob->data; bool use_modifier_stack= psys->part->use_modifier_stack; PARTICLE_P; - + /* CACHE LOCATIONS */ if (!dm_final->deformedOnly) { /* Will use later to speed up subsurf/derivedmesh */ @@ -424,7 +424,7 @@ void psys_calc_dmcache(Object *ob, DerivedMesh *dm_final, DerivedMesh *dm_deform /* TODO PARTICLE, make the following line unnecessary, each function * should know to use the num or num_dmcache, set the num_dmcache to * an invalid value, just in case */ - + LOOP_PARTICLES { pa->num_dmcache = DMCACHE_NOTFOUND; } @@ -453,15 +453,15 @@ void psys_tasks_create(ParticleThreadContext *ctx, int startpart, int endpart, P int numtasks = ceil_ii((endpart - startpart), MAX_PARTICLES_PER_TASK); float particles_per_task = (float)(endpart - startpart) / (float)numtasks, p, pnext; int i; - + tasks = MEM_callocN(sizeof(ParticleTask) * numtasks, "ParticleThread"); *r_numtasks = numtasks; *r_tasks = tasks; - + p = (float)startpart; for (i = 0; i < numtasks; i++, p = pnext) { pnext = p + particles_per_task; - + tasks[i].ctx = ctx; tasks[i].begin = (int)p; tasks[i].end = min_ii((int)pnext, endpart); @@ -471,7 +471,7 @@ void psys_tasks_create(ParticleThreadContext *ctx, int startpart, int endpart, P void psys_tasks_free(ParticleTask *tasks, int numtasks) { int i; - + /* threads */ for (i = 0; i < numtasks; ++i) { if (tasks[i].rng) @@ -534,7 +534,7 @@ static void initialize_particle_texture(ParticleSimulationData *sim, ParticleDat ParticleTexture ptex; psys_get_texture(sim, pa, &ptex, PAMAP_INIT, 0.f); - + switch (part->type) { case PART_EMITTER: if (ptex.exist < psys_frand(psys, p + 125)) { @@ -558,7 +558,7 @@ void initialize_particle(ParticleSimulationData *sim, ParticleData *pa) { ParticleSettings *part = sim->psys->part; float birth_time = (float)(pa - sim->psys->particles) / (float)sim->psys->totpart; - + pa->flag &= ~PARS_UNEXIST; pa->time = part->sta + (part->end - part->sta) * birth_time; @@ -617,7 +617,7 @@ static void free_unexisting_particles(ParticleSimulationData *sim) if (psys->totunexist) { int newtotpart = psys->totpart - psys->totunexist; ParticleData *npa, *newpars; - + npa = newpars = MEM_callocN(newtotpart * sizeof(ParticleData), "particles"); for (p=0, pa=psys->particles; p<newtotpart; p++, pa++, npa++) { @@ -705,7 +705,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,utan,vtan,0,0); else psys_particle_on_emitter(sim->psmd, part->from,pa->num, pa->num_dmcache, pa->fuv,pa->foffset,loc,nor,0,0,0,0); - + /* get possible textural influence */ psys_get_texture(sim, pa, &ptex, PAMAP_IVEL, cfra); @@ -713,7 +713,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic /* let's convert: */ /* -location */ mul_m4_v3(ob->obmat, loc); - + /* -normal */ mul_mat3_m4_v3(ob->obmat, nor); normalize_v3(nor); @@ -731,10 +731,10 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic copy_v3_v3(utan, nor); mul_v3_fl(utan,dot_v3v3(vtan,nor)); sub_v3_v3(vtan, utan); - + normalize_v3(vtan); } - + /* -velocity (boids need this even if there's no random velocity) */ if (part->randfac != 0.0f || (part->phystype==PART_PHYS_BOIDS && pa->boid)) { @@ -755,7 +755,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic mul_mat3_m4_v3(ob->obmat,r_ave); normalize_v3(r_ave); } - + /* -rotation */ if (part->randrotfac != 0.0f) { r_rot[0] = 2.0f * (psys_frand(psys, p + 16) - 0.5f); @@ -792,7 +792,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic negate_v3_v3(mat[2], r_vel); normalize_v3(mat[2]); cross_v3_v3v3(mat[1], mat[2], mat[0]); - + /* apply rotation */ mat3_to_quat_is_ok( q,mat); copy_qt_qt(state->rot, q); @@ -811,11 +811,11 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic sub_v3_v3v3(vel, loc, state->co); mul_v3_fl(vel, part->obfac/dtime); } - + /* *emitter normal */ if (part->normfac != 0.f) madd_v3_v3fl(vel, nor, part->normfac); - + /* *emitter tangent */ if (sim->psmd && part->tanfac != 0.f) madd_v3_v3fl(vel, vtan, part->tanfac); @@ -844,7 +844,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic /* *particle */ if (part->partfac != 0.f) madd_v3_v3fl(vel, p_vel, part->partfac); - + mul_v3_v3fl(state->vel, vel, ptex.ivel); /* -location from emitter */ @@ -883,7 +883,7 @@ void psys_get_birth_coords(ParticleSimulationData *sim, ParticleData *pa, Partic use_global_space = true; break; } - + /* create rotation quat */ @@ -992,7 +992,7 @@ static void evaluate_emitter_anim(Scene *scene, Object *ob, float cfra) { if (ob->parent) evaluate_emitter_anim(scene, ob->parent, cfra); - + /* we have to force RECALC_ANIM here since where_is_objec_time only does drivers */ BKE_animsys_evaluate_animdata(scene, &ob->id, ob->adt, cfra, ADT_RECALC_ANIM); BKE_object_where_is_calc_time(scene, ob, cfra); @@ -1006,7 +1006,7 @@ void reset_particle(ParticleSimulationData *sim, ParticleData *pa, float dtime, ParticleTexture ptex; int p = pa - psys->particles; part=psys->part; - + /* get precise emitter matrix if particle is born */ if (part->type != PART_HAIR && dtime > 0.f && pa->time < cfra && pa->time >= sim->psys->cfra) { evaluate_emitter_anim(sim->scene, sim->ob, pa->time); @@ -1083,7 +1083,7 @@ static void reset_all_particles(ParticleSimulationData *sim, float dtime, float { ParticleData *pa; int p, totpart=sim->psys->totpart; - + for (p=from, pa=sim->psys->particles+from; p<totpart; p++, pa++) reset_particle(sim, pa, dtime, cfra); } @@ -1144,7 +1144,7 @@ static void set_keyed_keys(ParticleSimulationData *sim) int keyed_flag = 0; ksim.scene= sim->scene; - + /* no proper targets so let's clear and bail out */ if (psys->totkeyed==0) { free_keyed_keys(psys); @@ -1154,16 +1154,16 @@ static void set_keyed_keys(ParticleSimulationData *sim) if (totpart && psys->particles->totkey != totkeys) { free_keyed_keys(psys); - + key = MEM_callocN(totpart*totkeys*sizeof(ParticleKey), "Keyed keys"); - + LOOP_PARTICLES { pa->keys = key; pa->totkey = totkeys; key += totkeys; } } - + psys->flag &= ~PSYS_KEYED; @@ -1245,17 +1245,17 @@ static void psys_update_particle_bvhtree(ParticleSystem *psys, float cfra) BLI_rw_mutex_lock(&psys_bvhtree_rwlock, THREAD_LOCK_READ); need_rebuild = !psys->bvhtree || psys->bvhtree_frame != cfra; BLI_rw_mutex_unlock(&psys_bvhtree_rwlock); - + if (need_rebuild) { LOOP_SHOWN_PARTICLES { totpart++; } - + BLI_rw_mutex_lock(&psys_bvhtree_rwlock, THREAD_LOCK_WRITE); - + BLI_bvhtree_free(psys->bvhtree); psys->bvhtree = BLI_bvhtree_new(totpart, 0.0, 4, 6); - + LOOP_SHOWN_PARTICLES { if (pa->alive == PARS_ALIVE) { if (pa->state.time == cfra) @@ -1265,9 +1265,9 @@ static void psys_update_particle_bvhtree(ParticleSystem *psys, float cfra) } } BLI_bvhtree_balance(psys->bvhtree); - + psys->bvhtree_frame = cfra; - + BLI_rw_mutex_unlock(&psys_bvhtree_rwlock); } } @@ -1361,7 +1361,7 @@ static void integrate_particle(ParticleSettings *part, ParticleData *pa, float d if (external_acceleration) add_v3_v3(acceleration, external_acceleration); - + /* calculate next state */ add_v3_v3(states[i].vel, impulse); @@ -1494,7 +1494,7 @@ static void sph_springs_modify(ParticleSystem *psys, float dtime) SPHFluidSettings *fluid = psys->part->fluid; ParticleData *pa1, *pa2; ParticleSpring *spring = psys->fluid_springs; - + float h, d, Rij[3], rij, Lij; int i; @@ -1587,9 +1587,9 @@ static void sph_evaluate_func(BVHTree *tree, ParticleSystem **psys, float co[3], } else { BLI_rw_mutex_lock(&psys_bvhtree_rwlock, THREAD_LOCK_READ); - + BLI_bvhtree_range_query(psys[i]->bvhtree, co, interaction_radius, callback, pfr); - + BLI_rw_mutex_unlock(&psys_bvhtree_rwlock); } } @@ -1769,7 +1769,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa } } } - + /* Artificial buoyancy force in negative gravity direction */ if (fluid->buoyancy > 0.f && gravity) madd_v3_v3fl(force, gravity, fluid->buoyancy * (density-rest_density)); @@ -2516,7 +2516,7 @@ static int collision_sphere_to_edges(ParticleCollision *col, float radius, Parti result->uv[0] = u; - + hit = cur; *t = ct; } @@ -2541,7 +2541,7 @@ static int collision_sphere_to_verts(ParticleCollision *col, float radius, Parti cur->inside = 0; ct = collision_newton_rhapson(col, radius, cur, nr_distance_to_vert); - + if (ct >= 0.f && ct < *t) { *result = *cur; @@ -2688,7 +2688,7 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR /* get exact velocity right before collision */ madd_v3_v3v3fl(v0, col->ve1, col->acc, dt1); - + /* convert collider velocity from 1/framestep to 1/s TODO: here we assume 1 frame step for collision modifier */ mul_v3_fl(pce->vel, col->inv_timestep); @@ -2705,14 +2705,14 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR /* angular <-> linear velocity */ if (dynamic_rotation) { float vr_tan[3], v1_tan[3], ave[3]; - + /* linear velocity of particle surface */ cross_v3_v3v3(vr_tan, pce->nor, pa->state.ave); mul_v3_fl(vr_tan, pa->size); /* change to coordinates that move with the collision plane */ sub_v3_v3v3(v1_tan, v0_tan, vc_tan); - + /* The resulting velocity is a weighted average of particle cm & surface * velocity. This weight (related to particle's moment of inertia) could * be made a parameter for angular <-> linear conversion. @@ -2775,7 +2775,7 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR v0[2] = 0.0f; } } - + /* re-apply acceleration to final location and velocity */ madd_v3_v3v3fl(pa->state.co, co, v0, dt2); madd_v3_v3fl(pa->state.co, col->acc, 0.5f*dt2*dt2); @@ -2784,7 +2784,7 @@ static int collision_response(ParticleData *pa, ParticleCollision *col, BVHTreeR /* make sure particle stays on the right side of the surface */ if (!through) { distance = collision_point_distance_with_normal(co, pce, -1.f, col, nor); - + if (distance < col->radius + COLLISION_MIN_DISTANCE) madd_v3_v3fl(co, nor, col->radius + COLLISION_MIN_DISTANCE - distance); @@ -2885,7 +2885,7 @@ static void collision_check(ParticleSimulationData *sim, int p, float dfra, floa /* 10 iterations to catch multiple collisions */ while (collision_count < PARTICLE_COLLISION_MAX_COLLISIONS) { if (collision_detect(pa, &col, &hit, sim->colliders)) { - + collision_count++; if (collision_count == PARTICLE_COLLISION_MAX_COLLISIONS) @@ -2989,19 +2989,19 @@ static bool psys_hair_use_simulation(ParticleData *pa, float max_length) * but this can happen in old files when e.g. cutting hair. */ const float min_length = 0.1f * max_length; - + HairKey *key; int k; - + if (pa->totkey < 2) return false; - + for (k=1, key=pa->hair+1; k<pa->totkey; k++,key++) { float length = len_v3v3(key->co, (key-1)->co); if (length < min_length) return false; } - + return true; } @@ -3012,7 +3012,7 @@ static MDeformVert *hair_set_pinning(MDeformVert *dvert, float weight) dvert->dw = MEM_callocN(sizeof(MDeformWeight), "deformWeight"); dvert->totweight = 1; } - + dvert->dw->weight = weight; dvert++; } @@ -3034,7 +3034,7 @@ static void hair_create_input_dm(ParticleSimulationData *sim, int totpoint, int float hairmat[4][4]; float max_length; float hair_radius; - + dm = *r_dm; if (!dm) { *r_dm = dm = CDDM_new(totpoint, totedge, 0, 0, 0); @@ -3043,12 +3043,12 @@ static void hair_create_input_dm(ParticleSimulationData *sim, int totpoint, int mvert = CDDM_get_verts(dm); medge = CDDM_get_edges(dm); dvert = DM_get_vert_data_layer(dm, CD_MDEFORMVERT); - + hairdata = *r_hairdata; if (!hairdata) { *r_hairdata = hairdata = MEM_mallocN(sizeof(ClothHairData) * totpoint, "hair data"); } - + /* calculate maximum segment length */ max_length = 0.0f; LOOP_PARTICLES { @@ -3060,12 +3060,12 @@ static void hair_create_input_dm(ParticleSimulationData *sim, int totpoint, int } } } - + psys->clmd->sim_parms->vgroup_mass = 1; - + /* XXX placeholder for more flexible future hair settings */ hair_radius = part->size; - + /* make vgroup for pin roots etc.. */ hair_index = 1; LOOP_PARTICLES { @@ -3153,7 +3153,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim) int totedge; float (*deformedVerts)[3]; bool realloc_roots; - + if (!psys->clmd) { psys->clmd = (ClothModifierData*)modifier_new(eModifierType_Cloth); psys->clmd->sim_parms->goalspring = 0.0f; @@ -3161,7 +3161,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim) psys->clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_GOAL|CLOTH_SIMSETTINGS_FLAG_NO_SPRING_COMPRESS; psys->clmd->coll_parms->flags &= ~CLOTH_COLLSETTINGS_FLAG_SELF; } - + /* count simulated points */ totpoint = 0; totedge = 0; @@ -3172,7 +3172,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim) totpoint += pa->totkey + 1; /* +1 for virtual root point */ } } - + realloc_roots = false; /* whether hair root info array has to be reallocated */ if (psys->hair_in_dm) { DerivedMesh *dm = psys->hair_in_dm; @@ -3182,36 +3182,36 @@ static void do_hair_dynamics(ParticleSimulationData *sim) realloc_roots = true; } } - + if (!psys->hair_in_dm || !psys->clmd->hairdata || realloc_roots) { if (psys->clmd->hairdata) { MEM_freeN(psys->clmd->hairdata); psys->clmd->hairdata = NULL; } } - + hair_create_input_dm(sim, totpoint, totedge, &psys->hair_in_dm, &psys->clmd->hairdata); - + if (psys->hair_out_dm) psys->hair_out_dm->release(psys->hair_out_dm); - + psys->clmd->point_cache = psys->pointcache; /* for hair sim we replace the internal cloth effector weights temporarily * to use the particle settings */ clmd_effweights = psys->clmd->sim_parms->effector_weights; psys->clmd->sim_parms->effector_weights = psys->part->effector_weights; - + deformedVerts = MEM_mallocN(sizeof(*deformedVerts) * psys->hair_in_dm->getNumVerts(psys->hair_in_dm), "do_hair_dynamics vertexCos"); psys->hair_out_dm = CDDM_copy(psys->hair_in_dm); psys->hair_out_dm->getVertCos(psys->hair_out_dm, deformedVerts); - + clothModifier_do(psys->clmd, sim->scene, sim->ob, psys->hair_in_dm, deformedVerts); - + CDDM_apply_vert_coords(psys->hair_out_dm, deformedVerts); - + MEM_freeN(deformedVerts); - + /* restore cloth effector weights */ psys->clmd->sim_parms->effector_weights = clmd_effweights; } @@ -3260,11 +3260,11 @@ static void save_hair(ParticleSimulationData *sim, float UNUSED(cfra)) PARTICLE_P; invert_m4_m4(ob->imat, ob->obmat); - + psys->lattice_deform_data= psys_create_lattice_deform_data(sim); if (psys->totpart==0) return; - + /* save new keys for elements if needed */ LOOP_PARTICLES { /* first time alloc */ @@ -3417,7 +3417,7 @@ static void dynamics_step_sph_ddr_task_cb_ex( } static void dynamics_step_sph_classical_basic_integrate_task_cb_ex( - void *__restrict userdata, + void *__restrict userdata, const int p, const ParallelRangeTLS *__restrict UNUSED(tls)) { @@ -3556,7 +3556,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) { ParticleTarget *pt = psys->targets.first; psys_update_particle_bvhtree(psys, cfra); - + for (; pt; pt=pt->next) { /* Updating others systems particle tree for fluid-fluid interaction */ if (pt->ob) psys_update_particle_bvhtree(BLI_findlink(&pt->ob->particlesystem, pt->psys-1), cfra); @@ -3613,7 +3613,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) LOOP_DYNAMIC_PARTICLES { /* do global forces & effectors */ basic_integrate(sim, p, pa->state.time, cfra); - + /* deflection */ if (sim->colliders) collision_check(sim, p, pa->state.time, cfra); @@ -3627,7 +3627,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) { LOOP_DYNAMIC_PARTICLES { bbd.goal_ob = NULL; - + boid_brain(&bbd, p, pa); if (pa->alive != PARS_DYING) { @@ -3761,7 +3761,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra) float disp, dietime; psys_update_effectors(sim); - + disp= psys_get_current_display_percentage(psys); LOOP_PARTICLES { @@ -3811,7 +3811,7 @@ static void particles_fluid_step( #ifdef WITH_MOD_FLUID { FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(sim->ob, eModifierType_Fluidsim); - + if ( fluidmd && fluidmd->fss) { FluidsimSettings *fss= fluidmd->fss; ParticleSettings *part = psys->part; @@ -3822,7 +3822,7 @@ static void particles_fluid_step( int p, j, totpart; int readMask, activeParts = 0, fileParts = 0; gzFile gzf; - + // XXX if (ob==G.obedit) // off... // return; @@ -3831,7 +3831,7 @@ static void particles_fluid_step( BLI_path_abs(filename, modifier_path_relbase(bmain, sim->ob)); - BLI_path_frame(filename, curFrame, 0); // fixed #frame-no + BLI_path_frame(filename, curFrame, 0); // fixed #frame-no gzf = BLI_gzopen(filename, "rb"); if (!gzf) { @@ -3839,46 +3839,46 @@ static void particles_fluid_step( // XXX bad level call elbeemDebugOut(debugStrBuffer); return; } - + gzread(gzf, &totpart, sizeof(totpart)); totpart = (use_render_params) ? totpart:(part->disp*totpart) / 100; - + part->totpart= totpart; part->sta=part->end = 1.0f; part->lifetime = sim->scene->r.efra + 1; - + /* allocate particles */ realloc_particles(sim, part->totpart); - + // set up reading mask readMask = fss->typeFlags; - + for (p=0, pa=psys->particles; p<totpart; p++, pa++) { int ptype=0; - - gzread(gzf, &ptype, sizeof( ptype )); + + gzread(gzf, &ptype, sizeof( ptype )); if (ptype & readMask) { activeParts++; - + gzread(gzf, &(pa->size), sizeof(float)); - + pa->size /= 10.0f; - + for (j=0; j<3; j++) { float wrf; - gzread(gzf, &wrf, sizeof( wrf )); + gzread(gzf, &wrf, sizeof( wrf )); pa->state.co[j] = wrf; //fprintf(stderr,"Rj%d ",j); } for (j=0; j<3; j++) { float wrf; - gzread(gzf, &wrf, sizeof( wrf )); + gzread(gzf, &wrf, sizeof( wrf )); pa->state.vel[j] = wrf; } - + zero_v3(pa->state.ave); unit_qt(pa->state.rot); - + pa->time = 1.f; pa->dietime = sim->scene->r.efra + 1; pa->lifetime = sim->scene->r.efra; @@ -3888,18 +3888,18 @@ static void particles_fluid_step( else { // skip... for (j=0; j<2*3+1; j++) { - float wrf; gzread(gzf, &wrf, sizeof( wrf )); + float wrf; gzread(gzf, &wrf, sizeof( wrf )); } } fileParts++; } gzclose(gzf); - + totpart = psys->totpart = activeParts; BLI_snprintf(debugStrBuffer,sizeof(debugStrBuffer),"readFsPartData::done - particles:%d, active:%d, file:%d, mask:%d\n", psys->totpart,activeParts,fileParts,readMask); // bad level call // XXX elbeemDebugOut(debugStrBuffer); - + } // fluid sim particles done } #else @@ -3945,7 +3945,7 @@ static void system_step(ParticleSimulationData *sim, float cfra, const bool use_ pid = &ptcacheid; BKE_ptcache_id_from_particles(pid, sim->ob, psys); - + BKE_ptcache_id_time(pid, sim->scene, 0.0f, &startframe, &endframe, NULL); /* clear everything on start frame, or when psys needs full reset! */ @@ -3954,7 +3954,7 @@ static void system_step(ParticleSimulationData *sim, float cfra, const bool use_ BKE_ptcache_validate(cache, startframe); cache->flag &= ~PTCACHE_REDO_NEEDED; } - + CLAMP(cache_cfra, startframe, endframe); } @@ -4063,7 +4063,7 @@ static void system_step(ParticleSimulationData *sim, float cfra, const bool use_ } } } - + /* 4. only write cache starting from second frame */ if (pid) { BKE_ptcache_validate(cache, (int)cache_cfra); |