Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/particle_system.c
| Show First 20 Lines • Show All 4,799 Lines • ▼ Show 20 Lines | |||||
| /* cleanup */ | /* cleanup */ | ||||
| if (psys->lattice_deform_data) { | if (psys->lattice_deform_data) { | ||||
| end_latt_deform(psys->lattice_deform_data); | end_latt_deform(psys->lattice_deform_data); | ||||
| psys->lattice_deform_data = NULL; | psys->lattice_deform_data = NULL; | ||||
| } | } | ||||
| } | } | ||||
| /* system type has changed so set sensible defaults and clear non applicable flags */ | /* system type has changed so set sensible defaults and clear non applicable flags */ | ||||
| void psys_changed_type(Object *ob, ParticleSystem *psys) | void psys_changed_type(Object *ob, ParticleSystem *psys) | ||||
psy-fi: Is this function really needed if we disallow changing the type?
See also PSYS_RECALC_TYPE flag | |||||
lukastoenneAuthorUnsubmitted Not Done Inline ActionsYes, this is still needed because it primarily applies to the ParticleSystemand not the (ID) ParticleSettings block. Previously each particle system for which this was called would modify the ParticleSettings data block which is really bad. At least now all modification here is limited to the psys. Changing type of psys still happens when swapping out the settings datablock, only changes from the settings type property are no longer happening. lukastoenne: Yes, this is still needed because it primarily applies to the `ParticleSystem`and not the (ID)… | |||||
| { | { | ||||
| ParticleSettings *part = psys->part; | ParticleSettings *part = psys->part; | ||||
| PTCacheID pid; | PTCacheID pid; | ||||
| BKE_ptcache_id_from_particles(&pid, ob, psys); | BKE_ptcache_id_from_particles(&pid, ob, psys); | ||||
| if (part->phystype != PART_PHYS_KEYED) | if (part->phystype != PART_PHYS_KEYED) | ||||
| psys->flag &= ~PSYS_KEYED; | psys->flag &= ~PSYS_KEYED; | ||||
| if (part->type == PART_HAIR) { | if (part->type == PART_HAIR) { | ||||
| if (ELEM4(part->ren_as, PART_DRAW_NOT, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR)==0) | |||||
| part->ren_as = PART_DRAW_PATH; | |||||
| if (part->distr == PART_DISTR_GRID) | |||||
| part->distr = PART_DISTR_JIT; | |||||
| if (ELEM3(part->draw_as, PART_DRAW_NOT, PART_DRAW_REND, PART_DRAW_PATH)==0) | |||||
| part->draw_as = PART_DRAW_REND; | |||||
| CLAMP(part->path_start, 0.0f, 100.0f); | |||||
| CLAMP(part->path_end, 0.0f, 100.0f); | |||||
| BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_ALL, 0); | BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_ALL, 0); | ||||
| } | } | ||||
| else { | else { | ||||
| free_hair(ob, 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(psys, PSYS_RESET_ALL); | psys_reset(psys, PSYS_RESET_ALL); | ||||
| } | } | ||||
| void psys_check_boid_data(ParticleSystem *psys) | void psys_check_boid_data(ParticleSystem *psys) | ||||
| { | { | ||||
| BoidParticle *bpa; | BoidParticle *bpa; | ||||
| PARTICLE_P; | PARTICLE_P; | ||||
| ▲ Show 20 Lines • Show All 260 Lines • Show Last 20 Lines | |||||
Is this function really needed if we disallow changing the type?
See also PSYS_RECALC_TYPE flag