From 2070cd5d4929b969046492e55da34736a9d6304c Mon Sep 17 00:00:00 2001 From: Lukas Toenne Date: Wed, 11 Jul 2012 16:08:04 +0000 Subject: Fix #32058, Crash when using ParticleInstance with an hidden particle system. The instance modifier needs to access the derived mesh data of the particle parent object to create stuff on the hairs, however the dm does not exist when the particle modifier is hidden. This is a general design problem: Objects accessing another object's derived mesh data is unsafe. For now it just checks valid dm pointer and uses identity transform if NULL. --- source/blender/blenkernel/intern/particle.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source') diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index dcd1a797a7a..c8b07e2ec11 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -3400,6 +3400,12 @@ void psys_mat_hair_to_object(Object *UNUSED(ob), DerivedMesh *dm, short from, Pa { float vec[3]; + /* can happen when called from a different object's modifier */ + if (!dm) { + unit_m4(hairmat); + return; + } + psys_face_mat(0, dm, pa, hairmat, 0); psys_particle_on_dm(dm, from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, vec, 0, 0, 0, 0, 0); copy_v3_v3(hairmat[3], vec); -- cgit v1.2.3