Commit: ba5d6f5b6b3251a56b924f3b1c448068110a72f2
Author: Campbell Barton
Date:   Mon Nov 2 22:59:46 2015 +1100
Branches: master
https://developer.blender.org/rBba5d6f5b6b3251a56b924f3b1c448068110a72f2

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;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to