diff options
author | Nicholas Bishop <nicholasbishop@gmail.com> | 2007-12-23 06:03:54 +0300 |
---|---|---|
committer | Nicholas Bishop <nicholasbishop@gmail.com> | 2007-12-23 06:03:54 +0300 |
commit | 9efe5e5b2327cf22bd187a3d17371f5d156ef9fa (patch) | |
tree | d10cc0ee59c778654d785073f51ad3455503d11d | |
parent | 6f730601af1e169bb80a2f73839dea8091211b5c (diff) |
Fixed bug #7981, Crash with multires
Caused by incorrect handling of multires with orco mapping
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 21 |
2 files changed, 13 insertions, 18 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index dd56fe2df61..9d51fc645ba 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -2598,7 +2598,8 @@ float *multires_render_pin(Object *ob, Mesh *me, int *orig_lvl) } /* Propagate the changes to render level - fails if mesh topology changed */ -void multires_render_final(Object *ob, Mesh *me, DerivedMesh **dm, float *vert_copy, const int orig_lvl) +void multires_render_final(Object *ob, Mesh *me, DerivedMesh **dm, float *vert_copy, + const int orig_lvl, CustomDataMask dataMask) { if(me->mr) { if((*dm)->getNumVerts(*dm) == me->totvert && @@ -2619,6 +2620,9 @@ void multires_render_final(Object *ob, Mesh *me, DerivedMesh **dm, float *vert_c (*dm)= CDDM_copy(old); old->release(old); + if(dataMask & CD_MASK_ORCO) + add_orco_dm(ob, *dm, NULL); + /* Restore the original verts */ me->mr->newlvl= BLI_countlist(&me->mr->levels); multires_set_level(ob, me, 1); @@ -2646,7 +2650,7 @@ DerivedMesh *mesh_create_derived_render(Object *ob, CustomDataMask dataMask) vert_copy= multires_render_pin(ob, me, &orig_lvl); mesh_calc_modifiers(ob, NULL, NULL, &final, 1, 1, 0, dataMask); - multires_render_final(ob, me, &final, vert_copy, orig_lvl); + multires_render_final(ob, me, &final, vert_copy, orig_lvl, dataMask); return final; } @@ -2681,7 +2685,7 @@ DerivedMesh *mesh_create_derived_no_deform_render(Object *ob, vert_copy= multires_render_pin(ob, me, &orig_lvl); mesh_calc_modifiers(ob, vertCos, NULL, &final, 1, 0, 0, dataMask); - multires_render_final(ob, me, &final, vert_copy, orig_lvl); + multires_render_final(ob, me, &final, vert_copy, orig_lvl, dataMask); return final; } diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 79a8afedf3f..56b1fe7e75b 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -489,21 +489,12 @@ float *get_mesh_orco_verts(Object *ob) vcos= mesh_getRefKeyCos(me, &totvert); } else { - MultiresLevel *lvl = NULL; - MVert *mvert = NULL; - - if(me->mr) { - lvl = multires_level_n(me->mr, me->mr->pinlvl); - vcos = MEM_callocN(sizeof(*vcos)*lvl->totvert, "orco mr mesh"); - mvert = me->mr->verts; - totvert = lvl->totvert; - } - else { - Mesh *tme = me->texcomesh?me->texcomesh:me; - vcos = MEM_callocN(sizeof(*vcos)*me->totvert, "orco mesh"); - mvert = tme->mvert; - totvert = MIN2(tme->totvert, me->totvert); - } + MVert *mvert = NULL; + Mesh *tme = me->texcomesh?me->texcomesh:me; + + vcos = MEM_callocN(sizeof(*vcos)*me->totvert, "orco mesh"); + mvert = tme->mvert; + totvert = MIN2(tme->totvert, me->totvert); for(a=0; a<totvert; a++, mvert++) { vcos[a][0]= mvert->co[0]; |