From 3ca78a40e8b9eb7fa7c01404590ca2592a0b390d Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Sun, 20 Jul 2014 00:41:49 +0200 Subject: Fix T41122: Mask modifier followed by hair particles causes crash on render (cycles). There were several small issues/inconsistencies if how particles' org face index was checked, leading in some cases to invalid indices and hence mem access, in RNA UV/VCol compute for particles. Note org code RNA one was copied from (in BI's convertblender.s) is much more complicated, and seems to never reach those breaking conditions. Also deduplicated most code in those UV/VCol particles funcs, they were doing mostly the same thing! Finally, also got rid of annoying `NO CD_ORIGSPACE, error out of range` error message in console, was another case of not checking whether we did have any faces in final mesh! --- source/blender/blenkernel/intern/particle.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/blender/blenkernel/intern/particle.c') diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 8161f9d8875..27d346f65b9 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -1657,11 +1657,14 @@ int psys_particle_dm_face_lookup(Object *ob, DerivedMesh *dm, int index, const f index_mp_to_orig = NULL; } + totface = dm->getNumTessFaces(dm); + if (!totface) { + return DMCACHE_NOTFOUND; + } + mpoly = dm->getPolyArray(dm); osface = dm->getTessFaceDataArray(dm, CD_ORIGSPACE); - totface = dm->getNumTessFaces(dm); - if (osface == NULL || index_mf_to_mpoly == NULL) { /* Assume we don't need osface data */ if (index < totface) { -- cgit v1.2.3