Fix #73168: Stop particle draw code from crashing

Not a real fix, just preventing crashes due to broken particle data.
Particle draw code can get into an invalid state, which can crash
drawing code. This just prevents the crash.

Pull Request: https://projects.blender.org/blender/blender/pulls/123075
This commit is contained in:
Lukas Tönne
2024-06-11 15:39:52 +02:00
parent 1e237da1db
commit e175259f44
2 changed files with 4 additions and 5 deletions

View File

@@ -1571,9 +1571,6 @@ static void particle_batch_cache_ensure_edit_pos_and_seg(PTCacheEdit *edit,
particle_batch_cache_fill_segments_edit(
edit, particle, edit->pathcache, 0, edit->totcached, &elb, &data_step);
}
else {
BLI_assert_msg(0, "Hairs are not in edit mode!");
}
hair_cache->indices = GPU_indexbuf_build(&elb);
}

View File

@@ -179,8 +179,10 @@ static void rna_ParticleEdit_redo(bContext *C, PointerRNA * /*ptr*/)
DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
}
BKE_particle_batch_cache_dirty_tag(edit->psys, BKE_PARTICLE_BATCH_DIRTY_ALL);
psys_free_path_cache(edit->psys, edit);
if (edit->psys) {
BKE_particle_batch_cache_dirty_tag(edit->psys, BKE_PARTICLE_BATCH_DIRTY_ALL);
psys_free_path_cache(edit->psys, edit);
}
DEG_id_tag_update(&scene->id, ID_RECALC_SYNC_TO_EVAL);
}