From ba5d6f5b6b3251a56b924f3b1c448068110a72f2 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 2 Nov 2015 22:59:46 +1100 Subject: Fix/workaround T46622: crash w/ metas & particles Metas are scanning all scenes duplis, which can go into particle systems without an initialized derived-mesh. For now just do NULL check, its not correct but real fix is not fitting well with current design. --- source/blender/blenkernel/intern/particle.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 9aacba8d02e..deb6c8df4d4 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -4013,10 +4013,18 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, float loc[3]; int num; + /* XXX: on checking '(psmd->dm != NULL)' + * This is incorrect but needed for metaball evaluation. + * Ideally this would be calcualted via the depsgraph, however with metaballs, + * the entire scenes dupli's are scanned, which also looks into uncalculated data. + * + * For now just include this workaround as an alternative to crashing, + * but longer term metaballs should behave in a more manageable way, see: T46622. */ + uv[0] = uv[1] = 0.f; if (cpa) { - if (part->childtype == PART_CHILD_FACES) { + if ((part->childtype == PART_CHILD_FACES) && (psmd->dm != NULL)) { mtface = CustomData_get_layer(&psmd->dm->faceData, CD_MTFACE); if (mtface) { mface = psmd->dm->getTessFaceData(psmd->dm, cpa->num, CD_MFACE); @@ -4032,7 +4040,7 @@ void psys_get_dupli_texture(ParticleSystem *psys, ParticleSettings *part, } } - if (part->from == PART_FROM_FACE) { + if ((part->from == PART_FROM_FACE) && (psmd->dm != NULL)) { mtface = CustomData_get_layer(&psmd->dm->faceData, CD_MTFACE); num = pa->num_dmcache; -- cgit v1.2.3