Fix for error in looptri commit
authorCampbell Barton <ideasman42@gmail.com>
Thu, 16 Jul 2015 18:22:24 +0000 (04:22 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 16 Jul 2015 18:22:24 +0000 (04:22 +1000)
Sculpting w/ subsurf crashed

source/blender/blenkernel/intern/subsurf_ccg.c

index 1ab6a354605661bd1f71134cd91b2cc0d526063f..4bc6f62901d67dcb0e68e6329c12433294653ec3 100644 (file)
@@ -59,6 +59,7 @@
 #include "BKE_ccg.h"
 #include "BKE_cdderivedmesh.h"
 #include "BKE_global.h"
+#include "BKE_mesh.h"
 #include "BKE_mesh_mapping.h"
 #include "BKE_multires.h"
 #include "BKE_paint.h"
@@ -3569,6 +3570,12 @@ static struct PBVH *ccgDM_getPBVH(Object *ob, DerivedMesh *dm)
 
                looptri = MEM_mallocN(sizeof(*looptri) * looptris_num, __func__);
 
+               BKE_mesh_recalc_looptri(
+                       me->mloop, me->mpoly,
+                       me->mvert,
+                       me->totloop, me->totpoly,
+                       looptri);
+
                ob->sculpt->pbvh = ccgdm->pbvh = BKE_pbvh_new();
                BLI_assert(!(me->mface == NULL && me->mpoly != NULL)); /* BMESH ONLY complain if mpoly is valid but not mface */
                BKE_pbvh_build_mesh(ccgdm->pbvh, me->mpoly, me->mloop, me->mvert, me->totvert, &me->vdata,