Fix #27539: Sculpt data is lost after editing base mesh
authorSergey Sharybin <sergey.vfx@gmail.com>
Thu, 2 Jun 2011 04:58:27 +0000 (04:58 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Thu, 2 Jun 2011 04:58:27 +0000 (04:58 +0000)
Face's totdisp was set to correct value, but memory hasn't been
allocated for disps. Handle this in multires_topology_changed(),
so the whole MDISPS layer wouldn't be totally re-allocated when
applying displacement.

source/blender/blenkernel/intern/multires.c

index 637f5da45afdbbd9f0f54aa1535ad8eae7c91da2..13ab89200db1deac766e1b95fa3e94bfa3df1d64 100644 (file)
@@ -1756,7 +1756,7 @@ void multires_topology_changed(Scene *scene, Object *ob)
                int nvert= me->mface[i].v4 ? 4 : 3;
 
                /* allocate memory for mdisp, the whole disp layer would be erased otherwise */
-               if(!mdisp->totdisp) {
+               if(!mdisp->totdisp || !mdisp->disps) {
                        if(grid) {
                                mdisp->totdisp= nvert*grid;
                                mdisp->disps= MEM_callocN(mdisp->totdisp*sizeof(float)*3, "mdisp topology");