[Bf-blender-cvs] [e5ccc1e] blender-v2.76-release: Fix/workaround T46622: crash w/ metas & particles

Campbell Barton noreply at git.blender.org
Tue Nov 3 11:56:51 CET 2015


Commit: e5ccc1e19d7a412314f372623f163626e16dff94
Author: Campbell Barton
Date:   Mon Nov 2 22:59:46 2015 +1100
Branches: blender-v2.76-release
https://developer.blender.org/rBe5ccc1e19d7a412314f372623f163626e16dff94

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.

===================================================================

M	source/blender/blenkernel/intern/particle.c

===================================================================

diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 9aacba8..deb6c8d 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;




More information about the Bf-blender-cvs mailing list