Merging r38390 through r38418 from trunk into soc-2011-tomato
[blender-staging.git] / source / blender / blenloader / intern / writefile.c
index 0ba4082686a95c09f5f544bfe670874860dfe8a7..771f83221addc9adff18ed65f4cc6241692d11ac 100644 (file)
@@ -838,6 +838,7 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase)
 {
        ParticleSettings *part;
        ParticleDupliWeight *dw;
+       GroupObject *go;
        int a;
 
        part= idbase->first;
@@ -852,8 +853,16 @@ static void write_particlesettings(WriteData *wd, ListBase *idbase)
                        writestruct(wd, DATA, "EffectorWeights", 1, part->effector_weights);
 
                        dw = part->dupliweights.first;
-                       for(; dw; dw=dw->next)
+                       for(; dw; dw=dw->next) {
+                               /* update indices */
+                               dw->index = 0;
+                               go = part->dup_group->gobject.first;
+                               while(go && go->ob != dw->ob) {
+                                       go=go->next;
+                                       dw->index++;
+                               }
                                writestruct(wd, DATA, "ParticleDupliWeight", 1, dw);
+                       }
 
                        if(part->boids && part->phystype == PART_PHYS_BOIDS) {
                                BoidState *state = part->boids->states.first;