avoid calling newdataadr() on NULL vertex groups, gives a small speedup on loading...
authorCampbell Barton <ideasman42@gmail.com>
Wed, 20 Apr 2011 12:06:23 +0000 (12:06 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 20 Apr 2011 12:06:23 +0000 (12:06 +0000)
source/blender/blenloader/intern/readfile.c

index 1673cbf8458f55909505077a6de39dfa35ab4304..93d266668e27a1b84634b57fe46a30b9c2a1649b 100644 (file)
@@ -3412,15 +3412,19 @@ static void lib_link_mesh(FileData *fd, Main *main)
 
 static void direct_link_dverts(FileData *fd, int count, MDeformVert *mdverts)
 {
-       int     i;
+       int i;
 
-       if (!mdverts)
+       if (mdverts == NULL) {
                return;
+       }
 
-       for (i=0; i<count; i++) {
-               mdverts[i].dw=newdataadr(fd, mdverts[i].dw);
-               if (!mdverts[i].dw)
-                       mdverts[i].totweight=0;
+       for (i= count; i > 0; i--, mdverts++) {
+               if(mdverts->dw) {
+                       mdverts->dw= newdataadr(fd, mdverts->dw);
+               }
+               if (mdverts->dw == NULL) {
+                       mdverts->totweight= 0;
+               }
        }
 }