Revision: 40883
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40883
Author:   ender79
Date:     2011-10-09 21:59:29 +0000 (Sun, 09 Oct 2011)
Log Message:
-----------
Fix for 28859 (found and reported with fix by nico_ga from #blendercoders)

Modified Paths:
--------------
    branches/bmesh/blender/source/blender/blenkernel/intern/mesh.c

Modified: branches/bmesh/blender/source/blender/blenkernel/intern/mesh.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/mesh.c      
2011-10-09 21:43:13 UTC (rev 40882)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/mesh.c      
2011-10-09 21:59:29 UTC (rev 40883)
@@ -1892,17 +1892,26 @@
                int side, corners;
                
                corners = multires_mdisp_corners(fd);
-               side = sqrt(fd->totdisp / corners);
                
-               for (i=0; i<tot; i++, disps += side*side, ld++) {
-                       ld->totdisp = side*side;
+               if (corners == 0) {
+                       /* Empty MDisp layers appear in at least one of the 
sintel.blend files.
+                          Not sure why this happens, but it seems fine to just 
ignore them here.
+                          If corners==0 for a non-empty layer though, 
something went wrong. */
+                       BLI_assert(fd->totdisp == 0);
+               }
+               else {
+                       side = sqrt(fd->totdisp / corners);
+               
+                       for (i=0; i<tot; i++, disps += side*side, ld++) {
+                               ld->totdisp = side*side;
                        
-                       if (ld->disps)
-                               BLI_cellalloc_free(ld->disps);
+                               if (ld->disps)
+                                       BLI_cellalloc_free(ld->disps);
                        
-                       ld->disps = 
BLI_cellalloc_calloc(sizeof(float)*3*side*side, "converted loop mdisps");
-                       if (fd->disps) {
-                               memcpy(ld->disps, disps, 
sizeof(float)*3*side*side);
+                               ld->disps = 
BLI_cellalloc_calloc(sizeof(float)*3*side*side, "converted loop mdisps");
+                               if (fd->disps) {
+                                       memcpy(ld->disps, disps, 
sizeof(float)*3*side*side);
+                               }
                        }
                }
        }

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

Reply via email to