Fix T38476: incorrect hair draw type after editing particle system in edit mode.
This commit is contained in:
parent
13780799ea
commit
e9fda259da
Notes:
blender-bot
2023-02-14 11:14:36 +01:00
Referenced by issue #38476, Hair displays as Emitter Referenced by issue #38476, Hair displays as Emitter
|
@ -330,6 +330,7 @@ void psys_apply_hair_lattice(struct Scene *scene, struct Object *ob, struct Part
|
|||
struct ParticleSystem *psys_get_target_system(struct Object *ob, struct ParticleTarget *pt);
|
||||
void psys_count_keyed_targets(struct ParticleSimulationData *sim);
|
||||
void psys_update_particle_tree(struct ParticleSystem *psys, float cfra);
|
||||
void psys_changed_type(struct Object *ob, struct ParticleSystem *psys);
|
||||
|
||||
void psys_make_temp_pointcache(struct Object *ob, struct ParticleSystem *psys);
|
||||
void psys_get_pointcache_start_end(struct Scene *scene, ParticleSystem *psys, int *sfra, int *efra);
|
||||
|
|
|
@ -2984,6 +2984,11 @@ void BKE_object_handle_update_ex(EvaluationContext *eval_ctx,
|
|||
|
||||
psys = ob->particlesystem.first;
|
||||
while (psys) {
|
||||
/* ensure this update always happens even if psys is disabled */
|
||||
if (psys->recalc & PSYS_RECALC_TYPE) {
|
||||
psys_changed_type(ob, psys);
|
||||
}
|
||||
|
||||
if (psys_check_enabled(ob, psys)) {
|
||||
/* check use of dupli objects here */
|
||||
if (psys->part && (psys->part->draw_as == PART_DRAW_REND || eval_ctx->for_render) &&
|
||||
|
|
|
@ -4794,15 +4794,15 @@ static void system_step(ParticleSimulationData *sim, float cfra)
|
|||
}
|
||||
|
||||
/* system type has changed so set sensible defaults and clear non applicable flags */
|
||||
static void psys_changed_type(ParticleSimulationData *sim)
|
||||
void psys_changed_type(Object *ob, ParticleSystem *psys)
|
||||
{
|
||||
ParticleSettings *part = sim->psys->part;
|
||||
ParticleSettings *part = psys->part;
|
||||
PTCacheID pid;
|
||||
|
||||
BKE_ptcache_id_from_particles(&pid, sim->ob, sim->psys);
|
||||
BKE_ptcache_id_from_particles(&pid, ob, psys);
|
||||
|
||||
if (part->phystype != PART_PHYS_KEYED)
|
||||
sim->psys->flag &= ~PSYS_KEYED;
|
||||
psys->flag &= ~PSYS_KEYED;
|
||||
|
||||
if (part->type == PART_HAIR) {
|
||||
if (ELEM4(part->ren_as, PART_DRAW_NOT, PART_DRAW_PATH, PART_DRAW_OB, PART_DRAW_GR)==0)
|
||||
|
@ -4820,13 +4820,13 @@ static void psys_changed_type(ParticleSimulationData *sim)
|
|||
BKE_ptcache_id_clear(&pid, PTCACHE_CLEAR_ALL, 0);
|
||||
}
|
||||
else {
|
||||
free_hair(sim->ob, sim->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(sim->psys, PSYS_RESET_ALL);
|
||||
psys_reset(psys, PSYS_RESET_ALL);
|
||||
}
|
||||
void psys_check_boid_data(ParticleSystem *psys)
|
||||
{
|
||||
|
@ -4961,7 +4961,7 @@ void particle_system_update(Scene *scene, Object *ob, ParticleSystem *psys)
|
|||
psys->flag &= ~PSYS_OB_ANIM_RESTORE;
|
||||
|
||||
if (psys->recalc & PSYS_RECALC_TYPE)
|
||||
psys_changed_type(&sim);
|
||||
psys_changed_type(sim.ob, sim.psys);
|
||||
|
||||
if (psys->recalc & PSYS_RECALC_RESET)
|
||||
psys->totunexist = 0;
|
||||
|
|
Loading…
Reference in New Issue