Make lattice deform safe for threading
[blender.git] / source / blender / modifiers / intern / MOD_particleinstance.c
index e846ce11262b8d0a294da57a069b729f56d3c90a..c51fa329df22fc7eb810bdf9d3922fe1249a01bd 100644 (file)
@@ -261,7 +261,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
                maxloop += totloop;
        }
 
-       psys->lattice = psys_get_lattice(&sim);
+       psys->lattice_deform_data = psys_create_lattice_deform_data(&sim);
 
        if (psys->flag & (PSYS_HAIR_DONE | PSYS_KEYED) || psys->pointcache->flag & PTCACHE_BAKED) {
                float min_r[3], max_r[3];
@@ -378,9 +378,9 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
 
        CDDM_calc_edges(result);
 
-       if (psys->lattice) {
-               end_latt_deform(psys->lattice);
-               psys->lattice = NULL;
+       if (psys->lattice_deform_data) {
+               end_latt_deform(psys->lattice_deform_data);
+               psys->lattice_deform_data = NULL;
        }
 
        if (size)